git.iko.soy/typeable/nixpkgs
on master help sign in
Merge pull request #60744 from mroi/master

swift: 4.3.2 -> 5.0.1

commit9ebc6ad944c9e53f58536ef50c64b6f057e5fa4c authorWill Dietz <w@wdtz.org> dateTue 7 May 2019, 10:57 (8 years ago) parent84ebd408cba1c7
9 files changed+93−46
pkgs/development/compilers/swift/default.nix+41−30 pkgs/development/compilers/swift/patches/0001-build-presets-linux-don-t-require-using-Ninja.patch+2−2 pkgs/development/compilers/swift/patches/0002-build-presets-linux-allow-custom-install-prefix.patch+7−7 pkgs/development/compilers/swift/patches/0003-build-presets-linux-don-t-build-extra-libs.patch+23 pkgs/development/compilers/swift/patches/0004-build-presets-linux-plumb-extra-cmake-options.patch+1−1 pkgs/development/compilers/swift/patches/glibc-arch-headers.patch+4−4 pkgs/development/compilers/swift/patches/libdispatch-fortify-fix.patch+13 pkgs/development/compilers/swift/patches/llvm-include-dirs.patch+1−1 pkgs/development/compilers/swift/purity.patch+1−1
pkgs/development/compilers/swift/default.nix+41−30
@@ -34,7 +34,7 @@
3434}:
3535
3636let
37− v_base = "4.2.3";
37+ v_base = "5.0.1";
3838 version = "${v_base}-RELEASE";
3939 version_friendly = "${v_base}";
4040
@@ -52,48 +52,48 @@ let
5252 # For more inforation, see: https://github.com/apple/swift/pull/3594#issuecomment-234169759
5353 clang = fetch {
5454 repo = "swift-clang";
55− sha256 = "0l6w4xzpl3w2nax9a0b885nfzhfj38p2g99158nb5bzfd4s0man7";
55+ sha256 = "1ap26425zhn2sdw3m9snyrqhi4phv2fgblyv9wp8xppjlnjkax9k";
5656 };
5757 llvm = fetch {
5858 repo = "swift-llvm";
59− sha256 = "1664zwxbq0a1cmxr9n5a0vw6vdk6ygr7rpglpdsfc7ki857vpsyv";
59+ sha256 = "1bnscqsiljiclij60f44h2fyx5c84pzry0lz1jbwknphwmqd6f84";
6060 };
6161 compilerrt = fetch {
6262 repo = "swift-compiler-rt";
63− sha256 = "19s6qxn4i0kxpf39xjp2i7zg427iinbmaxqkbb1p91g616y367sf";
63+ sha256 = "0bba54xa7z0wj6k7a24q74gc4yajc6s64g1m894i3yd6swdk7f6r";
6464 };
6565 cmark = fetch {
6666 repo = "swift-cmark";
67− sha256 = "1nmxp0fj749sgar682c5nsj7zxxigqwg973baxj2r656a7ybh325";
67+ sha256 = "079smm79hbwr06bvghd2sb86b8gpkprnzlyj9kh95jy38xhlhdnj";
6868 };
6969 lldb = fetch {
7070 repo = "swift-lldb";
71− sha256 = "00kz0xhj1p6ckyandj2gs1yfl29kxv84x9pfph00r8crbkd2jz7b";
71+ sha256 = "01yrhc1ggv89qii03fdjdvb2aq9v4hd1wk83n8ygrwwc75p44qmi";
7272 };
7373 llbuild = fetch {
7474 repo = "swift-llbuild";
75− sha256 = "1mkkhydshhxr28igbldzr0hhqvb6ql43cpf3ba5vglfkbcz6wh6q";
75+ sha256 = "0ipwryzpqxpk3rzkxilfahlkz06k39j91q2lv7fprf0slqknrdms";
7676 };
7777 pm = fetch {
7878 repo = "swift-package-manager";
79− sha256 = "1aqvmgq9g5zs4k2qnkvw3h3mar66d690hqq6g2dmrapsyb321j9l";
79+ sha256 = "1mnywlm7i2mbp16q0rskskvnbx1ap8lchwr8q3gx0xs3b2fs6chh";
8080 };
8181 xctest = fetch {
8282 repo = "swift-corelibs-xctest";
83− sha256 = "1n4w7bfgy73vjzbvbphlwayy0dw73bbrayrpkqq8lbidg0x9lam8";
83+ sha256 = "1vpljkxhfk3yd07ry0xsv3qwbn62pwd2mdn9cw22jhbhvqinc13z";
8484 };
8585 foundation = fetch {
8686 repo = "swift-corelibs-foundation";
87− sha256 = "11kwc5pcq4ibxkyglmqs7h7gka3xkzl9j856x1rq2xdvq756wq2s";
87+ sha256 = "11w0iapccrk13hjbrwylq8g71znrncnc3mrm345gvnjfgz08ffaq";
8888 };
8989 libdispatch = fetch {
9090 repo = "swift-corelibs-libdispatch";
91− sha256 = "09c15mn9s5lf2akzfhik70zk91h97nnm8pq1ppfqry2nn3vmib2i";
91+ sha256 = "1mgzsq3nfzbkssfkswzvvjgsbv2fx36i1r83d4nzw3di8spxmg32";
9292 fetchSubmodules = true;
9393 };
9494 swift = fetch {
9595 repo = "swift";
96− sha256 = "09wksqad0w6pk3xdxc278w4mj300h48rvbvx0m4an7npkj6i7n9q";
96+ sha256 = "02bv47pd0k0xy4k7q6c3flwxwkm2palnzvpr4w3nmvqk0flrbsq6";
9797 };
9898 };
9999
@@ -120,6 +120,9 @@ let
120120 builder = ''
121121 # gcc-6.4.0/include/c++/6.4.0/cstdlib:75:15: fatal error: 'stdlib.h' file not found
122122 NIX_CFLAGS_COMPILE="$( echo ${clang.default_cxx_stdlib_compile} ) $NIX_CFLAGS_COMPILE"
123+ # During the Swift build, a full local LLVM build is performed and the resulting clang is invoked.
124+ # This compiler is not using the Nix wrappers, so it needs some help to find things.
125+ export NIX_LDFLAGS_BEFORE="-rpath ${clang.cc.gcc.lib}/lib -L${clang.cc.gcc.lib}/lib $NIX_LDFLAGS_BEFORE"
123126
124127 $SWIFT_SOURCE_ROOT/swift/utils/build-script \
125128 --preset=buildbot_linux \
@@ -132,23 +135,25 @@ in
132135stdenv.mkDerivation rec {
133136 name = "swift-${version_friendly}";
134137
135− buildInputs = devInputs ++ [
138+ nativeBuildInputs = [
136139 autoconf
137140 automake
138141 bash
139− clang
140142 cmake
141143 coreutils
144+ findutils
145+ gnumake
142146 libtool
147+ makeWrapper
143148 ninja
144149 perl
145150 pkgconfig
146151 python
147152 rsync
148153 which
149− findutils
150− makeWrapper
151− gnumake
154+ ];
155+ buildInputs = devInputs ++ [
156+ clang
152157 ];
153158
154159 # TODO: Revisit what's propagated and how
@@ -212,13 +217,12 @@ stdenv.mkDerivation rec {
212217
213218 substituteInPlace swift/stdlib/public/Platform/CMakeLists.txt \
214219 --replace '/usr/include' "${stdenv.cc.libc.dev}/include"
215− substituteInPlace swift-corelibs-libdispatch/src/CMakeLists.txt \
216− --replace '/usr/include' "${stdenv.cc.libc.dev}/include"
217220 substituteInPlace swift/utils/build-script-impl \
218221 --replace '/usr/include/c++' "${clang.cc.gcc}/include/c++"
219222 patch -p1 -d swift -i ${./patches/glibc-arch-headers.patch}
220223 patch -p1 -d swift -i ${./patches/0001-build-presets-linux-don-t-require-using-Ninja.patch}
221224 patch -p1 -d swift -i ${./patches/0002-build-presets-linux-allow-custom-install-prefix.patch}
225+ patch -p1 -d swift -i ${./patches/0003-build-presets-linux-don-t-build-extra-libs.patch}
222226 patch -p1 -d swift -i ${./patches/0004-build-presets-linux-plumb-extra-cmake-options.patch}
223227
224228 sed -i swift/utils/build-presets.ini \
@@ -227,10 +231,12 @@ stdenv.mkDerivation rec {
227231 -e 's/^validation-test$/# \0/' \
228232 -e 's/^long-test$/# \0/' \
229233 -e 's/^stress-test$/# \0/' \
230− -e 's/^test-optimized$/# \0/'
234+ -e 's/^test-optimized$/# \0/' \
235+ \
236+ -e 's/^swift-install-components=autolink.*$/\0;editor-integration/'
231237
232− # https://bugs.swift.org/browse/SR-5779
233− sed -i -e 's|"-latomic"|"-Wl,-rpath,${clang.cc.gcc.lib}/lib" "-L${clang.cc.gcc.lib}/lib" "-latomic"|' swift/cmake/modules/AddSwift.cmake
238+ # https://bugs.swift.org/browse/SR-10559
239+ patch -p1 -d swift-corelibs-libdispatch -i ${./patches/libdispatch-fortify-fix.patch}
234240
235241 substituteInPlace clang/lib/Driver/ToolChains/Linux.cpp \
236242 --replace 'SysRoot + "/usr/lib' '"${glibc}/lib" "'
@@ -241,8 +247,6 @@ stdenv.mkDerivation rec {
241247 sed -i 's,curses,ncurses,' llbuild/*/*/CMakeLists.txt
242248
243249 PREFIX=''${out/#\/}
244− substituteInPlace swift-corelibs-foundation/build.py \
245− --replace usr/lib "$PREFIX/lib"
246250 substituteInPlace swift-corelibs-xctest/build_script.py \
247251 --replace usr "$PREFIX"
248252 substituteInPlace swiftpm/Utilities/bootstrap \
@@ -250,9 +254,19 @@ stdenv.mkDerivation rec {
250254 --replace usr/lib "$PREFIX/lib"
251255 '';
252256
257+ buildPhase = builder;
258+
253259 doCheck = false;
254260
255− buildPhase = builder;
261+ checkInputs = [ file ];
262+
263+ # TODO: investigate the non-working tests
264+ checkPhase = ''
265+ checkTarget=check-swift-all
266+ ninjaFlags='-C buildbot_linux/swift-${stdenv.hostPlatform.parsed.kernel.name}-${stdenv.hostPlatform.parsed.cpu.name}'
267+
268+ ninjaCheckPhase
269+ '';
256270
257271 installPhase = ''
258272 mkdir -p $out
@@ -262,13 +276,10 @@ stdenv.mkDerivation rec {
262276 tar xf $INSTALLABLE_PACKAGE -C $out --strip-components=3 $PREFIX
263277 find $out -type d -empty -delete
264278
265− # TODO: Use wrappers to get these on the PATH for swift tools, instead
266− ln -s ${clang}/bin/* $out/bin/
267− ln -s ${targetPackages.stdenv.cc.bintools.bintools_bin}/bin/ar $out/bin/ar
268−
269279 wrapProgram $out/bin/swift \
270280 --suffix C_INCLUDE_PATH : $out/lib/swift/clang/include \
271− --suffix CPLUS_INCLUDE_PATH : $out/lib/swift/clang/include
281+ --suffix CPLUS_INCLUDE_PATH : $out/lib/swift/clang/include \
282+ --suffix LIBRARY_PATH : $icu/lib
272283 '';
273284
274285 # Hack to avoid TMPDIR in RPATHs.
pkgs/development/compilers/swift/patches/0001-build-presets-linux-don-t-require-using-Ninja.patch+2−2
@@ -11,8 +11,8 @@ diff --git a/utils/build-presets.ini b/utils/build-presets.ini
1111index 7ee57ad2df..e6b0af3581 100644
1212--- a/utils/build-presets.ini
1313+++ b/utils/build-presets.ini
14−@@ -717,7 +717,7 @@ swiftpm
15− xctest
14+@@ -721,7 +721,7 @@ swiftpm
15+
1616 dash-dash
1717
1818-build-ninja
pkgs/development/compilers/swift/patches/0002-build-presets-linux-allow-custom-install-prefix.patch+7−7
@@ -9,17 +9,17 @@ Subject: [PATCH 2/4] build-presets: (linux) allow custom install prefix
99
1010diff --git a/utils/build-presets.ini b/utils/build-presets.ini
1111index e6b0af3581..1095cbaab7 100644
12−--- a/utils/build-presets.ini
13−+++ b/utils/build-presets.ini
14−@@ -723,7 +723,7 @@ install-lldb
15− install-llbuild
12+--- a/utils/build-presets.ini 2019-04-11 14:51:40.060259462 +0200
13++++ b/utils/build-presets.ini 2019-04-11 15:16:17.471137969 +0200
14+@@ -728,7 +728,7 @@
1615 install-swiftpm
1716 install-xctest
17+ install-libicu
1818-install-prefix=/usr
1919+install-prefix=%(install_prefix)s
20− swift-install-components=autolink-driver;compiler;clang-builtin-headers;stdlib;swift-remote-mirror;sdk-overlay;license;sourcekit-inproc
21− build-swift-static-stdlib
22− build-swift-static-sdk-overlay
20+ swift-install-components=autolink-driver;compiler;clang-resource-dir-symlink;stdlib;swift-remote-mirror;sdk-overlay;license;sourcekit-inproc
21+ llvm-install-components=llvm-cov;llvm-profdata;IndexStore;clang;clang-headers;compiler-rt
22+ install-libcxx
2323--
24242.12.2
2525
pkgs/development/compilers/swift/patches/0003-build-presets-linux-don-t-build-extra-libs.patchnew file+23
@@ -0,0 +1,23 @@
1+--- a/utils/build-presets.ini 2019-04-11 15:19:57.845178834 +0200
2++++ b/utils/build-presets.ini 2019-04-11 15:27:42.041297057 +0200
3+@@ -716,8 +716,6 @@
4+ llbuild
5+ swiftpm
6+ xctest
7+-libicu
8+-libcxx
9+
10+ dash-dash
11+
12+@@ -727,11 +725,9 @@
13+ install-llbuild
14+ install-swiftpm
15+ install-xctest
16+-install-libicu
17+ install-prefix=%(install_prefix)s
18+ swift-install-components=autolink-driver;compiler;clang-resource-dir-symlink;stdlib;swift-remote-mirror;sdk-overlay;license;sourcekit-inproc
19+ llvm-install-components=llvm-cov;llvm-profdata;IndexStore;clang;clang-headers;compiler-rt
20+-install-libcxx
21+ build-swift-static-stdlib
22+ build-swift-static-sdk-overlay
23+ build-swift-stdlib-unittest-extra
pkgs/development/compilers/swift/patches/0004-build-presets-linux-plumb-extra-cmake-options.patch+1−1
@@ -11,7 +11,7 @@ diff --git a/utils/build-presets.ini b/utils/build-presets.ini
1111index 1739e91dc2..0608fed9c1 100644
1212--- a/utils/build-presets.ini
1313+++ b/utils/build-presets.ini
14−@@ -740,6 +740,8 @@ install-destdir=%(install_destdir)s
14+@@ -743,6 +743,8 @@ install-destdir=%(install_destdir)s
1515 # Path to the .tar.gz package we would create.
1616 installable-package=%(installable_package)s
1717
pkgs/development/compilers/swift/patches/glibc-arch-headers.patch+4−4
@@ -1,13 +1,13 @@
11The Nix glibc headers do not use include/x86_64-linux-gnu subdirectories.
22
3−--- swift/stdlib/public/Platform/CMakeLists.txt 2018-09-30 17:51:51.581766303 +0200
4−+++ swift/stdlib/public/Platform/CMakeLists.txt 2018-09-30 18:40:04.118956708 +0200
5−@@ -65,7 +65,7 @@
3+--- swift/stdlib/public/Platform/CMakeLists.txt 2019-04-09 20:14:44.493801403 +0200
4++++ swift/stdlib/public/Platform/CMakeLists.txt 2019-04-09 20:14:44.577800593 +0200
5+@@ -68,7 +68,7 @@
66 endif()
77
88 set(GLIBC_INCLUDE_PATH "${GLIBC_SYSROOT_RELATIVE_INCLUDE_PATH}")
99- set(GLIBC_ARCH_INCLUDE_PATH "${GLIBC_SYSROOT_RELATIVE_ARCH_INCLUDE_PATH}")
1010+ set(GLIBC_ARCH_INCLUDE_PATH "${GLIBC_SYSROOT_RELATIVE_INCLUDE_PATH}")
1111
12− if(NOT "${SWIFT_SDK_${sdk}_ARCH_${arch}_PATH}" STREQUAL "/")
12+ if(NOT "${SWIFT_SDK_${sdk}_ARCH_${arch}_PATH}" STREQUAL "/" AND NOT "${sdk}" STREQUAL "ANDROID")
1313 set(GLIBC_INCLUDE_PATH "${SWIFT_SDK_${sdk}_ARCH_${arch}_PATH}${GLIBC_INCLUDE_PATH}")
pkgs/development/compilers/swift/patches/libdispatch-fortify-fix.patchnew file+13
@@ -0,0 +1,13 @@
1+Nix compiles with _FORTIFY_SOURCE enabled. Fix error due to -Werror and an unused return value warning.
2+
3+--- swift-corelibs-libdispatch/src/internal.h 2019-04-26 09:33:38.287289099 +0200
4++++ swift-corelibs-libdispatch/src/internal.h 2019-04-26 15:31:10.485334128 +0200
5+@@ -1053,7 +1053,7 @@
6+ #else
7+ #define _dispatch_client_assert_fail(fmt, ...) do { \
8+ char *_msg = NULL; \
9+- asprintf(&_msg, "%s" fmt, DISPATCH_ASSERTION_FAILED_MESSAGE, \
10++ (void)asprintf(&_msg, "%s" fmt, DISPATCH_ASSERTION_FAILED_MESSAGE, \
11+ ##__VA_ARGS__); \
12+ _dispatch_assert_crash(_msg); \
13+ free(_msg); \
pkgs/development/compilers/swift/patches/llvm-include-dirs.patch+1−1
@@ -2,7 +2,7 @@ Only use the Nix include dirs when no sysroot is configured.
22
33--- clang/lib/Driver/ToolChains/Linux.cpp 2018-10-05 18:01:15.731109551 +0200
44+++ clang/lib/Driver/ToolChains/Linux.cpp 2018-10-05 18:00:27.959509924 +0200
5−@@ -565,7 +565,7 @@
5+@@ -641,7 +641,7 @@
66
77 // Check for configure-time C include directories.
88 StringRef CIncludeDirs(C_INCLUDE_DIRS);
pkgs/development/compilers/swift/purity.patch+1−1
@@ -11,7 +11,7 @@ diff --git a/lib/Driver/ToolChains/Gnu.cpp b/lib/Driver/ToolChains/Gnu.cpp
1111index fe3c0191bb..c6a482bece 100644
1212--- a/lib/Driver/ToolChains/Gnu.cpp
1313+++ b/lib/Driver/ToolChains/Gnu.cpp
14−@@ -398,13 +398,6 @@ void tools::gnutools::Linker::ConstructJob(Compilation &C, const JobAction &JA,
14+@@ -380,13 +380,6 @@ void tools::gnutools::Linker::ConstructJob(Compilation &C, const JobAction &JA,
1515 if (!Args.hasArg(options::OPT_static)) {
1616 if (Args.hasArg(options::OPT_rdynamic))
1717 CmdArgs.push_back("-export-dynamic");