summary refs log tree commit diff
diff options
context:
space:
mode:
authortaku0 <mxxouy6x3m_github@tatapa.org>2018-02-12 15:31:47 +0900
committertaku0 <mxxouy6x3m_github@tatapa.org>2018-02-12 22:03:40 +0900
commitc275c3dc303938fa205df09cb3f9c1152bd5f03e (patch)
tree644a217cc72715db312b0021b26589f950dcc1b6
parente2783b299c906756b3954948b08aa8a08b90878f (diff)
downloadnixpkgs-c275c3dc303938fa205df09cb3f9c1152bd5f03e.tar
nixpkgs-c275c3dc303938fa205df09cb3f9c1152bd5f03e.tar.gz
nixpkgs-c275c3dc303938fa205df09cb3f9c1152bd5f03e.tar.bz2
nixpkgs-c275c3dc303938fa205df09cb3f9c1152bd5f03e.tar.lz
nixpkgs-c275c3dc303938fa205df09cb3f9c1152bd5f03e.tar.xz
nixpkgs-c275c3dc303938fa205df09cb3f9c1152bd5f03e.tar.zst
nixpkgs-c275c3dc303938fa205df09cb3f9c1152bd5f03e.zip
swift: 3.1.1 -> 4.0.3
-rw-r--r--pkgs/development/compilers/swift/default.nix46
-rw-r--r--pkgs/development/compilers/swift/patches/0002-build-presets-linux-allow-custom-install-prefix.patch4
-rw-r--r--pkgs/development/compilers/swift/patches/icu59.patch12
-rw-r--r--pkgs/development/compilers/swift/patches/sigunused.patch21
4 files changed, 46 insertions, 37 deletions
diff --git a/pkgs/development/compilers/swift/default.nix b/pkgs/development/compilers/swift/default.nix
index 62edb9044e5..360f96e1242 100644
--- a/pkgs/development/compilers/swift/default.nix
+++ b/pkgs/development/compilers/swift/default.nix
@@ -31,11 +31,13 @@
 , paxctl
 , findutils
 , makeWrapper
+, gnumake
+, file
 #, systemtap
 }:
 
 let
-  v_major = "3.1.1";
+  v_major = "4.0.3";
   version = "${v_major}-RELEASE";
   version_friendly = "${v_major}";
 
@@ -53,48 +55,48 @@ let
     # For more inforation, see: https://github.com/apple/swift/pull/3594#issuecomment-234169759
     clang = fetch {
       repo = "swift-clang";
-      sha256 = "1gmdgr8jph87nya8cgdl7iwrggbji2sag996m27hkbszw4nxy8sd";
+      sha256 = "0zm624iwiprk3c3nzqf4p1fd9zqic4yi3jv51cw3249ax4x6vy10";
     };
     llvm = fetch {
       repo = "swift-llvm";
-      sha256 = "0nwd7cp6mbj7f6a2rx8123n7ygs8406hsx7hp7ybagww6v75bwzi";
+      sha256 = "11vw6461c0cdvwm1wna1a5709fjj14hzp6br6jg94p4f6jp3yv4d";
     };
     compilerrt = fetch {
       repo = "swift-compiler-rt";
-      sha256 = "1gjcr6g3ffs3nhf4a84iwg4flbd7rqcf9rvvclwyq96msa3mj950";
+      sha256 = "1hj4qaj4c9n2wzg2cvarbyl0n708zd1dlw4zkzq07fjxxqs36nfa";
     };
     cmark = fetch {
       repo = "swift-cmark";
-      sha256 = "0qf2f3zd8lndkfbxbz6vkznzz8rvq5gigijh7pgmfx9fi4zcssqx";
+      sha256 = "1nmxp0fj749sgar682c5nsj7zxxigqwg973baxj2r656a7ybh325";
     };
     lldb = fetch {
       repo = "swift-lldb";
-      sha256 = "17n4whpf3wxw9zaayiq21gk9q3547qxi4rvxld2hybh0k7a1bj5c";
+      sha256 = "0yk5qg85008vcn63vn2jpn5ls9pdhda222p2w1cfkrj27k5k8vqr";
     };
     llbuild = fetch {
       repo = "swift-llbuild";
-      sha256 = "1l3hnb2s01jby91k1ipbc3bhszq14vyx5pzdhf2chld1yhpg420d";
+      sha256 = "0jffw6z1s6ck1i05brw59x6vsg7zrxbz5n2wz72fj29rh3nppc7a";
     };
     pm = fetch {
       repo = "swift-package-manager";
-      sha256 = "1ayy5vk3mjk354pg9bf68wvnaj3jymx23w0qnlw1jxz256ff8fwi";
+      sha256 = "0xj070b8fii7ijfsnyq4fxgv6569vdrg0yippi85h2p1l7s9aagh";
     };
     xctest = fetch {
       repo = "swift-corelibs-xctest";
-      sha256 = "0cj5y7wanllfldag08ci567x12aw793c79afckpbsiaxmwy4xhnm";
+      sha256 = "0l355wq8zfwrpv044xf4smjwbm0bmib360748n8cwls3vkr9l2yv";
     };
     foundation = fetch {
       repo = "swift-corelibs-foundation";
-      sha256 = "1d1ldk7ckqn4mhmdhsx2zrmsd6jfxzgdywn2pki7limk979hcwjc";
+      sha256 = "0s7yc5gsbd96a4bs8c6q24dyfjm4xhcr2nzhl2ics8dmi60j15s4";
     };
     libdispatch = fetch {
       repo = "swift-corelibs-libdispatch";
-      sha256 = "0ckjg41fjak06i532azhryckjq64fkxzsal4svf5v4s8n9mkq2sg";
+      sha256 = "0x8zzq3shhvmhq4sbhaaa0ddiv3nw347pz6ayym6jyzq7j9n15ia";
       fetchSubmodules = true;
     };
     swift = fetch {
       repo = "swift";
-      sha256 = "0879jlv37lmxc1apzi53xn033y72548i86r7fzwr0g52124q5gry";
+      sha256 = "0a1gq0k5701i418f0qi7kywv16q7vh4a4wp0f6fpyv4sjkq27msx";
     };
   };
 
@@ -120,7 +122,8 @@ let
   ];
 
   builder = ''
-    NIX_CFLAGS_COMPILE=$( echo ${clang.default_cxx_stdlib_compile} )
+    # gcc-6.4.0/include/c++/6.4.0/cstdlib:75:15: fatal error: 'stdlib.h' file not found
+    NIX_CFLAGS_COMPILE="$( echo ${clang.default_cxx_stdlib_compile} ) $NIX_CFLAGS_COMPILE"
 
     $SWIFT_SOURCE_ROOT/swift/utils/build-script \
       --preset=buildbot_linux \
@@ -163,6 +166,7 @@ stdenv.mkDerivation rec {
     which
     findutils
     makeWrapper
+    gnumake
   ] ++ stdenv.lib.optional stdenv.needsPax paxctl;
 
   # TODO: Revisit what's propagated and how
@@ -216,6 +220,14 @@ stdenv.mkDerivation rec {
     # Just patch all the things for now, we can focus this later
     patchShebangs $SWIFT_SOURCE_ROOT
 
+    # TODO eliminate use of env.
+    find -type f -print0 | xargs -0 sed -i \
+      -e 's|/usr/bin/env|${coreutils}/bin/env|g' \
+      -e 's|/usr/bin/make|${gnumake}/bin/make|g' \
+      -e 's|/bin/mkdir|${coreutils}/bin/mkdir|g' \
+      -e 's|/bin/cp|${coreutils}/bin/cp|g' \
+      -e 's|/usr/bin/file|${file}/bin/file|g'
+
     substituteInPlace swift/stdlib/public/Platform/CMakeLists.txt \
       --replace '/usr/include' "${stdenv.cc.libc.dev}/include"
     substituteInPlace swift/utils/build-script-impl \
@@ -232,6 +244,9 @@ stdenv.mkDerivation rec {
     # https://bugs.swift.org/browse/SR-4633
     patch -p1 -d swift -i ${./patches/icu59.patch}
 
+    # https://bugs.swift.org/browse/SR-5779
+    sed -i -e 's|"-latomic"|"-Wl,-rpath,${clang.cc.gcc.lib}/lib" "-L${clang.cc.gcc.lib}/lib" "-latomic"|' swift/cmake/modules/AddSwift.cmake
+
     substituteInPlace clang/lib/Driver/ToolChains.cpp \
       --replace '  addPathIfExists(D, SysRoot + "/usr/lib", Paths);' \
                 '  addPathIfExists(D, SysRoot + "/usr/lib", Paths); addPathIfExists(D, "${glibc}/lib", Paths);'
@@ -239,16 +254,11 @@ stdenv.mkDerivation rec {
 
     # Workaround hardcoded dep on "libcurses" (vs "libncurses"):
     sed -i 's,curses,ncurses,' llbuild/*/*/CMakeLists.txt
-    substituteInPlace llbuild/tests/BuildSystem/Build/basic.llbuild \
-      --replace /usr/bin/env $(type -p env)
 
     # This test fails on one of my machines, not sure why.
     # Disabling for now. 
     rm llbuild/tests/Examples/buildsystem-capi.llbuild
 
-    substituteInPlace swift-corelibs-foundation/lib/script.py \
-      --replace /bin/cp $(type -p cp)
-
     PREFIX=''${out/#\/}
     substituteInPlace swift-corelibs-xctest/build_script.py \
       --replace usr "$PREFIX"
diff --git a/pkgs/development/compilers/swift/patches/0002-build-presets-linux-allow-custom-install-prefix.patch b/pkgs/development/compilers/swift/patches/0002-build-presets-linux-allow-custom-install-prefix.patch
index 0e18e8812a8..66723f1cdf3 100644
--- a/pkgs/development/compilers/swift/patches/0002-build-presets-linux-allow-custom-install-prefix.patch
+++ b/pkgs/development/compilers/swift/patches/0002-build-presets-linux-allow-custom-install-prefix.patch
@@ -11,13 +11,13 @@ diff --git a/utils/build-presets.ini b/utils/build-presets.ini
 index e6b0af3581..1095cbaab7 100644
 --- a/utils/build-presets.ini
 +++ b/utils/build-presets.ini
-@@ -692,7 +692,7 @@ install-lldb
+@@ -708,7 +708,7 @@ install-lldb
  install-llbuild
  install-swiftpm
  install-xctest
 -install-prefix=/usr
 +install-prefix=%(install_prefix)s
- swift-install-components=autolink-driver;compiler;clang-builtin-headers;stdlib;swift-remote-mirror;sdk-overlay;license
+ swift-install-components=autolink-driver;compiler;clang-builtin-headers;stdlib;swift-remote-mirror;sdk-overlay;license;sourcekit-inproc
  build-swift-static-stdlib
  build-swift-static-sdk-overlay
 -- 
diff --git a/pkgs/development/compilers/swift/patches/icu59.patch b/pkgs/development/compilers/swift/patches/icu59.patch
index 83d7e62636a..26337814caf 100644
--- a/pkgs/development/compilers/swift/patches/icu59.patch
+++ b/pkgs/development/compilers/swift/patches/icu59.patch
@@ -99,3 +99,15 @@
    if (U_FAILURE(ErrorCode) && ErrorCode != U_BUFFER_OVERFLOW_ERROR) {
      swift::crash("u_strToLower: Unexpected error lowercasing unicode string.");
    }
+@@ -300,9 +300,9 @@
+ 
+ swift::__swift_stdlib_UBreakIterator *swift::__swift_stdlib_ubrk_open(
+     swift::__swift_stdlib_UBreakIteratorType type, const char *locale,
+-    const UChar *text, int32_t textLength, __swift_stdlib_UErrorCode *status) {
++    const __swift_stdlib_UChar * text, __swift_int32_t textLength, __swift_stdlib_UErrorCode *status) {
+   return ptr_cast<swift::__swift_stdlib_UBreakIterator>(
+-      ubrk_open(static_cast<UBreakIteratorType>(type), locale, text, textLength,
++      ubrk_open(static_cast<UBreakIteratorType>(type), locale, reinterpret_cast<const UChar *>(text), textLength,
+                 ptr_cast<UErrorCode>(status)));
+ }
+ 
diff --git a/pkgs/development/compilers/swift/patches/sigunused.patch b/pkgs/development/compilers/swift/patches/sigunused.patch
index 42e6e297e0a..2701d1a3ae2 100644
--- a/pkgs/development/compilers/swift/patches/sigunused.patch
+++ b/pkgs/development/compilers/swift/patches/sigunused.patch
@@ -1,22 +1,9 @@
---- a/swift-corelibs-libdispatch/libpwq/src/posix/manager.c
-+++ b/swift-corelibs-libdispatch/libpwq/src/posix/manager.c
-@@ -273,9 +273,6 @@ static void sigmask_init(void)
-     sigdelset(&sigmask, SIGFPE);
-     sigdelset(&sigmask, SIGBUS);
-     sigdelset(&sigmask, SIGSEGV);
--#if SIGSYS != SIGUNUSED
--    sigdelset(&sigmask, SIGSYS);
--#endif
-     sigdelset(&sigmask, SIGPIPE);
-     sigdelset(&sigmask, SIGPROF);
- 
-
---- a/swiftpm/Sources/Utility/Process.swift
-+++ b/swiftpm/Sources/Utility/Process.swift
-@@ -140,7 +140,7 @@ public final class Process: ObjectIdentifierProtocol {
+--- a/swiftpm/Sources/Basic/Process.swift
++++ b/swiftpm/Sources/Basic/Process.swift
+@@ -258,7 +258,7 @@ public func launch() throws {
          // modify, so we have to take care about the set we use.
          var mostSignals = sigset_t()
-         sigemptyset(&mostSignals);
+         sigemptyset(&mostSignals)
 -        for i in 1 ..< SIGUNUSED {
 +        for i in 1 ..< SIGSYS {
              if i == SIGKILL || i == SIGSTOP {