diff options
author | Silvan Mosberger <contact@infinisil.com> | 2020-02-21 10:02:16 +0100 |
---|---|---|
committer | Silvan Mosberger <contact@infinisil.com> | 2020-02-21 10:10:07 +0100 |
commit | 7d8a33125f5e65c764bc500bccf3faac5549a61c (patch) | |
tree | 6286aa781f2b3f1810360853ac321c949177987f | |
parent | 1ddb140d95c6a1ab914f1d9f3d5169b12074c333 (diff) |
swift: Fix build for glibc 2.30
-rw-r--r-- | pkgs/development/compilers/swift/default.nix | 10 | ||||
-rw-r--r-- | pkgs/development/compilers/swift/patches/swift-package-manager-glibc-2.30.patch | 25 |
2 files changed, 35 insertions, 0 deletions
diff --git a/pkgs/development/compilers/swift/default.nix b/pkgs/development/compilers/swift/default.nix index 77bc3cc5b73e7..25accf8c94934 100644 --- a/pkgs/development/compilers/swift/default.nix +++ b/pkgs/development/compilers/swift/default.nix @@ -26,6 +26,7 @@ , git , libgit2 , fetchFromGitHub +, fetchpatch , findutils , makeWrapper , gnumake @@ -224,6 +225,15 @@ stdenv.mkDerivation { # 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|' swift/stdlib/public/Platform/glibc.modulemap.gyb + # Compatibility with glibc 2.30 + # Adapted from https://github.com/apple/swift-package-manager/pull/2408 + patch -p1 -d swiftpm -i ${./patches/swift-package-manager-glibc-2.30.patch} + # https://github.com/apple/swift/pull/27288 + patch -p1 -d swift -i ${fetchpatch { + url = "https://github.com/apple/swift/commit/f968f4282d53f487b29cf456415df46f9adf8748.patch"; + sha256 = "1aa7l66wlgip63i4r0zvi9072392bnj03s4cn12p706hbpq0k37c"; + }} + PREFIX=''${out/#\/} substituteInPlace indexstore-db/Utilities/build-script-helper.py \ --replace usr "$PREFIX" diff --git a/pkgs/development/compilers/swift/patches/swift-package-manager-glibc-2.30.patch b/pkgs/development/compilers/swift/patches/swift-package-manager-glibc-2.30.patch new file mode 100644 index 0000000000000..14ef38497645f --- /dev/null +++ b/pkgs/development/compilers/swift/patches/swift-package-manager-glibc-2.30.patch @@ -0,0 +1,25 @@ +diff --git a/Sources/Basic/Process.swift b/Sources/Basic/Process.swift +index f388c769..8f208691 100644 +--- a/Sources/Basic/Process.swift ++++ b/Sources/Basic/Process.swift +@@ -322,7 +322,10 @@ public final class Process: ObjectIdentifierProtocol { + defer { posix_spawn_file_actions_destroy(&fileActions) } + + // Workaround for https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=89e435f3559c53084498e9baad22172b64429362 +- let devNull = strdup("/dev/null") ++ // Change allowing for newer version of glibc ++ guard let devNull = strdup("/dev/null") else { ++ throw SystemError.posix_spawn(0, arguments) ++ } + defer { free(devNull) } + // Open /dev/null as stdin. + posix_spawn_file_actions_addopen(&fileActions, 0, devNull, O_RDONLY, 0) +@@ -348,7 +351,7 @@ public final class Process: ObjectIdentifierProtocol { + + let argv = CStringArray(arguments) + let env = CStringArray(environment.map({ "\($0.0)=\($0.1)" })) +- let rv = posix_spawnp(&processID, argv.cArray[0], &fileActions, &attributes, argv.cArray, env.cArray) ++ let rv = posix_spawnp(&processID, argv.cArray[0]!, &fileActions, &attributes, argv.cArray, env.cArray) + + guard rv == 0 else { + throw SystemError.posix_spawn(rv, arguments) |