Unverified Commit 7521b913 authored by Emily's avatar Emily Committed by GitHub
Browse files

swiftPackages.*: 5.8 -> 5.10.1 (#447292)

parents d12b719a ae6bec7d
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -1243,6 +1243,7 @@ with lib.maintainers;
  swift = {
    members = [
      dduan
      samasaur
      stephank
      trepetti
      trundle
+129 −151
Original line number Diff line number Diff line
@@ -35,12 +35,12 @@
  cctools, # libtool
  sigtool,
  DarwinTools,
  apple-sdk_13,
  apple-sdk_14,
  darwinMinVersionHook,
}:

let
  apple-sdk_swift = apple-sdk_13; # Use the SDK that was available when Swift shipped.
  apple-sdk_swift = apple-sdk_14; # Use the SDK that was available when Swift shipped.

  deploymentVersion =
    if lib.versionOlder (targetPlatform.darwinMinVersion or "0") "10.15" then
@@ -322,7 +322,6 @@ stdenv.mkDerivation {
      -e 's|/bin/cp|${coreutils}/bin/cp|g' \
      -e 's|/usr/bin/file|${file}/bin/file|g'

     patch -p1 -d swift -i ${./patches/swift-cmake-3.25-compat.patch}
    patch -p1 -d swift -i ${./patches/swift-wrap.patch}
    patch -p1 -d swift -i ${./patches/swift-linux-fix-libc-paths.patch}
    patch -p1 -d swift -i ${
@@ -351,28 +350,6 @@ stdenv.mkDerivation {

    for lldbPatch in ${
      lib.escapeShellArgs [
         # Fixes for SWIG 4
         (fetchpatch2 {
           url = "https://github.com/llvm/llvm-project/commit/81fc5f7909a4ef5a8d4b5da2a10f77f7cb01ba63.patch?full_index=1";
           stripLen = 1;
           hash = "sha256-Znw+C0uEw7lGETQLKPBZV/Ymo2UigZS+Hv/j1mUo7p0=";
         })
         (fetchpatch2 {
           url = "https://github.com/llvm/llvm-project/commit/f0a25fe0b746f56295d5c02116ba28d2f965c175.patch?full_index=1";
           stripLen = 1;
           hash = "sha256-QzVeZzmc99xIMiO7n//b+RNAvmxghISKQD93U2zOgFI=";
         })
         (fetchpatch2 {
           url = "https://github.com/llvm/llvm-project/commit/ba35c27ec9aa9807f5b4be2a0c33ca9b045accc7.patch?full_index=1";
           stripLen = 1;
           hash = "sha256-LXl+WbpmWZww5xMDrle3BM2Tw56v8k9LO1f1Z1/wDTs=";
         })
         (fetchpatch2 {
           url = "https://github.com/llvm/llvm-project/commit/9ec115978ea2bdfc60800cd3c21264341cdc8b0a.patch?full_index=1";
           stripLen = 1;
           hash = "sha256-u0zSejEjfrH3ZoMFm1j+NVv2t5AP9cE5yhsrdTS1dG4=";
         })

        # Fix the build with modern libc++.
        (fetchpatch {
          name = "add-cstdio.patch";
@@ -393,30 +370,21 @@ stdenv.mkDerivation {
    patch -p1 -d llvm-project/clang -i ${./patches/clang-toolchain-dir.patch}
    patch -p1 -d llvm-project/clang -i ${./patches/clang-wrap.patch}
    patch -p1 -d llvm-project/clang -i ${./patches/clang-purity.patch}
     patch -p2 -d llvm-project/clang -i ${
       fetchpatch {
         name = "clang-cmake-fix-interpreter.patch";
         url = "https://github.com/llvm/llvm-project/commit/b5eaf500f2441eff2277ea2973878fb1f171fd0a.patch";
         sha256 = "1rma1al0rbm3s3ql6bnvbcighp74lri1lcrwbyacgdqp80fgw1b6";
       }
     }

    # gcc-13 build fixes
     patch -p2 -d llvm-project/llvm -i ${
       fetchpatch {
         name = "gcc-13.patch";
         url = "https://github.com/llvm/llvm-project/commit/ff1681ddb303223973653f7f5f3f3435b48a1983.patch";
         hash = "sha256-nkRPWx8gNvYr7mlvEUiOAb1rTrf+skCZjAydJVUHrcI=";
    patch -p1 -d llvm-project/cmake -i ${
      fetchpatch2 {
        name = "cmake-fix.patch";
        url = "https://github.com/llvm/llvm-project/commit/3676a86a4322e8c2b9c541f057b5d3704146b8f3.patch?full_index=1";
        stripLen = 1;
        hash = "sha256-zP9dQOmWs7qrxkBRj70DyQBbRjH78B6tNJVy6ilA1xM=";
      }
    }

    ${lib.optionalString stdenv.hostPlatform.isLinux ''
      substituteInPlace llvm-project/clang/lib/Driver/ToolChains/Linux.cpp \
         --replace 'SysRoot + "/lib' '"${glibc}/lib" "' \
         --replace 'SysRoot + "/usr/lib' '"${glibc}/lib" "' \
         --replace 'LibDir = "lib";' 'LibDir = "${glibc}/lib";' \
         --replace 'LibDir = "lib64";' 'LibDir = "${glibc}/lib";' \
         --replace 'LibDir = X32 ? "libx32" : "lib64";' 'LibDir = "${glibc}/lib";'
        --replace-fail 'LibDir = "lib";' 'LibDir = "${glibc}/lib";' \
        --replace-fail 'LibDir = "lib64";' 'LibDir = "${glibc}/lib";' \
        --replace-fail 'LibDir = X32 ? "libx32" : "lib64";' 'LibDir = "${glibc}/lib";'

      # uuid.h is not part of glibc, but of libuuid.
      sed -i 's|''${GLIBC_INCLUDE_PATH}/uuid/uuid.h|${libuuid.dev}/include/uuid/uuid.h|' \
@@ -457,6 +425,13 @@ stdenv.mkDerivation {
          hash = "sha256-wPZQ4wtEWk8HaKMfzjamlU6p/IW5EFiTssY63rGM+ZA=";
        }
      }
      patch -p1 -d swift-corelibs-libdispatch -i ${
        # Fix the build with modern Clang.
        fetchpatch {
          url = "https://github.com/swiftlang/swift-corelibs-libdispatch/commit/38872e2d44d66d2fb94186988509defc734888a5.patch";
          hash = "sha256-GABwDeTjciV36Sa0FS10mCfFCqRoBBstgW/OiKdPahA=";
        }
      }
    ''}
  '';

@@ -541,7 +516,7 @@ stdenv.mkDerivation {

    # Ensure that the built Clang can find the runtime libraries by
    # copying the symlinks from the main wrapper.
    cp -P ${clang}/resource-root/{lib,share} $SWIFT_BUILD_ROOT/llvm/lib/clang/15.0.0/
    cp -P ${clang}/resource-root/{lib,share} $SWIFT_BUILD_ROOT/llvm/lib/clang/16.0.0/

  ''
  + lib.optionalString stdenv.hostPlatform.isDarwin ''
@@ -570,8 +545,11 @@ stdenv.mkDerivation {
      -DBOOTSTRAPPING_MODE=BOOTSTRAPPING${lib.optionalString stdenv.hostPlatform.isDarwin "-WITH-HOSTLIBS"}
      -DSWIFT_ENABLE_EXPERIMENTAL_DIFFERENTIABLE_PROGRAMMING=ON
      -DSWIFT_ENABLE_EXPERIMENTAL_CONCURRENCY=ON
      -DSWIFT_ENABLE_EXPERIMENTAL_CXX_INTEROP=ON
      -DSWIFT_ENABLE_EXPERIMENTAL_DISTRIBUTED=ON
      -DSWIFT_ENABLE_EXPERIMENTAL_STRING_PROCESSING=ON
      -DSWIFT_ENABLE_BACKTRACING=ON
      -DSWIFT_ENABLE_EXPERIMENTAL_OBSERVATION=ON
      -DLLVM_DIR=$SWIFT_BUILD_ROOT/llvm/lib/cmake/llvm
      -DClang_DIR=$SWIFT_BUILD_ROOT/llvm/lib/cmake/clang
      -DSWIFT_PATH_TO_CMARK_SOURCE=$SWIFT_SOURCE_ROOT/swift-cmark
@@ -712,7 +690,7 @@ stdenv.mkDerivation {
    # Undo the clang and swift wrapping we did for the build.
    # (This happened via patches to cmake files.)
    cd $SWIFT_BUILD_ROOT
    mv llvm/bin/clang-15{-unwrapped,}
    mv llvm/bin/clang-16{-unwrapped,}
    mv swift/bin/swift-frontend{-unwrapped,}

    mkdir $lib
@@ -751,7 +729,7 @@ stdenv.mkDerivation {

    # Swift has a separate resource root from Clang, but locates the Clang
    # resource root via subdir or symlink.
    mv $SWIFT_BUILD_ROOT/llvm/lib/clang/15.0.0 $lib/lib/swift/clang
    mv $SWIFT_BUILD_ROOT/llvm/lib/clang/16.0.0 $lib/lib/swift/clang
  '';

  preFixup = lib.optionalString stdenv.hostPlatform.isLinux ''
+6 −13
Original line number Diff line number Diff line
@@ -3,20 +3,15 @@ From: Will Dietz <w@wdtz.org>
Date: Thu, 18 May 2017 11:56:12 -0500
Subject: [PATCH] "purity" patch for 5.0

---
 lib/Driver/ToolChains/Gnu.cpp | 7 -------
 1 file changed, 7 deletions(-)

diff --git a/lib/Driver/ToolChains/Gnu.cpp b/lib/Driver/ToolChains/Gnu.cpp
index fe3c0191bb..c6a482bece 100644
--- a/lib/Driver/ToolChains/Gnu.cpp
+++ b/lib/Driver/ToolChains/Gnu.cpp
@@ -487,12 +487,6 @@ void tools::gnutools::Linker::ConstructJob(Compilation &C, const JobAction &JA,
   if (!IsStatic) {
--- clang/lib/Driver/ToolChains/Gnu.cpp
+++ clang/lib/Driver/ToolChains/Gnu.cpp
@@ -480,13 +480,6 @@
   } else {
     if (Args.hasArg(options::OPT_rdynamic))
       CmdArgs.push_back("-export-dynamic");
-
-    if (!Args.hasArg(options::OPT_shared) && !IsStaticPIE) {
-    if (!Args.hasArg(options::OPT_shared) && !IsStaticPIE &&
-        !Args.hasArg(options::OPT_r)) {
-      CmdArgs.push_back("-dynamic-linker");
-      CmdArgs.push_back(Args.MakeArgString(Twine(D.DyldPrefix) +
-                                           ToolChain.getDynamicLinker(Args)));
@@ -24,5 +19,3 @@ index fe3c0191bb..c6a482bece 100644
   }
 
   CmdArgs.push_back("-o");
-- 
2.11.0
+0 −1509

File deleted.

Preview size limit exceeded, changes collapsed.

+14 −14
Original line number Diff line number Diff line
@@ -5,15 +5,15 @@ patch it to also consider `-idirafter` and `-isystem` as added by cc-wrapper.

--- a/lib/ClangImporter/ClangIncludePaths.cpp
+++ b/lib/ClangImporter/ClangIncludePaths.cpp
@@ -120,6 +120,7 @@ static clang::driver::Driver createClangDriver(const ASTContext &ctx) {
@@ -142,6 +142,7 @@
 /// \return a path without dots (`../`, './').
 static llvm::Optional<Path>
 findFirstIncludeDir(const llvm::opt::InputArgList &args,
 static llvm::Optional<Path> findFirstIncludeDir(
     const llvm::opt::InputArgList &args,
+    const llvm::opt::ArgList &DriverArgs,
                     const ArrayRef<const char *> expectedFileNames) {
     const ArrayRef<const char *> expectedFileNames,
     const llvm::IntrusiveRefCntPtr<llvm::vfs::FileSystem> &vfs) {
   // C++ stdlib paths are added as `-internal-isystem`.
   std::vector<std::string> includeDirs =
@@ -128,6 +129,14 @@ findFirstIncludeDir(const llvm::opt::InputArgList &args,
@@ -151,6 +152,14 @@
   llvm::append_range(includeDirs,
                      args.getAllArgValues(
                          clang::driver::options::OPT_internal_externc_isystem));
@@ -28,21 +28,21 @@ patch it to also consider `-idirafter` and `-isystem` as added by cc-wrapper.
 
   for (const auto &includeDir : includeDirs) {
     Path dir(includeDir);
@@ -193,7 +202,7 @@ getGlibcFileMapping(ASTContext &ctx) {
   // Ideally we would check that all of the headers referenced from the
@@ -218,7 +227,7 @@
   // modulemap are present.
   Path glibcDir;
-  if (auto dir = findFirstIncludeDir(parsedIncludeArgs,
+  if (auto dir = findFirstIncludeDir(parsedIncludeArgs, clangDriverArgs,
                                      {"inttypes.h", "unistd.h", "stdint.h"})) {
   if (auto dir = findFirstIncludeDir(
-          parsedIncludeArgs, {"inttypes.h", "unistd.h", "stdint.h"}, vfs)) {
+          parsedIncludeArgs, clangDriverArgs, {"inttypes.h", "unistd.h", "stdint.h"}, vfs)) {
     glibcDir = dir.value();
   } else {
@@ -251,7 +260,7 @@ getLibStdCxxFileMapping(ASTContext &ctx) {
     ctx.Diags.diagnose(SourceLoc(), diag::glibc_not_found, triple.str());
@@ -276,7 +285,7 @@
   auto parsedStdlibArgs = parseClangDriverArgs(clangDriver, stdlibArgStrings);
 
   Path cxxStdlibDir;
-  if (auto dir = findFirstIncludeDir(parsedStdlibArgs,
+  if (auto dir = findFirstIncludeDir(parsedStdlibArgs, clangDriverArgs,
                                      {"cstdlib", "string", "vector"})) {
                                      {"cstdlib", "string", "vector"}, vfs)) {
     cxxStdlibDir = dir.value();
   } else {
Loading