tangled
alpha
login
or
join now
tjh.dev
/
nixpkgs
Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
0
fork
atom
overview
issues
pulls
pipelines
swift: 5.0.2 -> 5.1.1
Michael Roitzsch
6 years ago
b472f4a2
29098a81
+53
-44
8 changed files
expand all
collapse all
unified
split
pkgs
development
compilers
swift
default.nix
patches
0001-build-presets-linux-don-t-require-using-Ninja.patch
0002-build-presets-linux-allow-custom-install-prefix.patch
0003-build-presets-linux-don-t-build-extra-libs.patch
0004-build-presets-linux-plumb-extra-cmake-options.patch
glibc-arch-headers.patch
libdispatch-fortify-fix.patch
purity.patch
+43
-19
pkgs/development/compilers/swift/default.nix
···
33
}:
34
35
let
36
-
version = "5.0.2";
37
38
fetch = { repo, sha256, fetchSubmodules ? false }:
39
fetchFromGitHub {
···
44
};
45
46
sources = {
47
-
# FYI: SourceKit probably would work but currently requires building everything twice
48
-
# For more inforation, see: https://github.com/apple/swift/pull/3594#issuecomment-234169759
49
llvm = fetch {
50
repo = "swift-llvm";
51
-
sha256 = "1bnscqsiljiclij60f44h2fyx5c84pzry0lz1jbwknphwmqd6f84";
52
};
53
compilerrt = fetch {
54
repo = "swift-compiler-rt";
55
-
sha256 = "0bba54xa7z0wj6k7a24q74gc4yajc6s64g1m894i3yd6swdk7f6r";
56
};
57
clang = fetch {
58
repo = "swift-clang";
59
-
sha256 = "046p7f4044ls8hhgklsz32md5jvxkaaim1d75n0fmnwap6di3n1q";
0
0
0
0
0
0
0
0
0
0
0
0
60
};
61
cmark = fetch {
62
repo = "swift-cmark";
···
64
};
65
lldb = fetch {
66
repo = "swift-lldb";
67
-
sha256 = "01yrhc1ggv89qii03fdjdvb2aq9v4hd1wk83n8ygrwwc75p44qmi";
68
};
69
llbuild = fetch {
70
repo = "swift-llbuild";
71
-
sha256 = "0ipwryzpqxpk3rzkxilfahlkz06k39j91q2lv7fprf0slqknrdms";
72
};
73
pm = fetch {
74
repo = "swift-package-manager";
75
-
sha256 = "1mnywlm7i2mbp16q0rskskvnbx1ap8lchwr8q3gx0xs3b2fs6chh";
76
};
77
xctest = fetch {
78
repo = "swift-corelibs-xctest";
79
-
sha256 = "1vpljkxhfk3yd07ry0xsv3qwbn62pwd2mdn9cw22jhbhvqinc13z";
80
};
81
foundation = fetch {
82
repo = "swift-corelibs-foundation";
83
-
sha256 = "1wys4xh7f6c7yjf210x41n2krmyi2qj1wpxbv0p48d230va1azj1";
84
};
85
libdispatch = fetch {
86
repo = "swift-corelibs-libdispatch";
87
-
sha256 = "0chnb0d4xjyn9wnc8bgimd5ji5igfyq891flgnqpfwr4y26496c1";
88
fetchSubmodules = true;
89
};
90
swift = fetch {
91
repo = "swift";
92
-
sha256 = "0fsq1y8dz4ssn90akvzj36cqyblalb09bjzy4ikqn67mb5x99wpb";
93
};
94
};
95
···
155
cp -r ${sources.llvm} llvm
156
cp -r ${sources.compilerrt} compiler-rt
157
cp -r ${sources.clang} clang
0
0
0
158
cp -r ${sources.cmark} cmark
159
cp -r ${sources.lldb} lldb
160
cp -r ${sources.llbuild} llbuild
···
199
\
200
-e 's/^swift-install-components=autolink.*$/\0;editor-integration/'
201
202
-
# https://bugs.swift.org/browse/SR-10559
203
-
patch -p1 -d swift-corelibs-libdispatch -i ${./patches/libdispatch-fortify-fix.patch}
204
-
205
substituteInPlace clang/lib/Driver/ToolChains/Linux.cpp \
206
--replace 'SysRoot + "/usr/lib' '"${glibc}/lib" "'
207
patch -p1 -d clang -i ${./patches/llvm-toolchain-dir.patch}
···
211
sed -i 's/curses/ncurses/' llbuild/*/*/CMakeLists.txt
212
213
PREFIX=''${out/#\/}
0
0
0
0
214
substituteInPlace swift-corelibs-xctest/build_script.py \
215
--replace usr "$PREFIX"
216
'';
···
221
mkdir build install
222
export SWIFT_BUILD_ROOT=$PWD/build
223
export SWIFT_INSTALL_DIR=$PWD/install
224
-
225
-
unset CC
226
-
unset CXX
227
228
export INSTALLABLE_PACKAGE=$PWD/swift.tar.gz
229
export NIX_ENFORCE_PURITY=
···
237
# During the Swift build, a full local LLVM build is performed and the resulting clang is invoked.
238
# This compiler is not using the Nix wrappers, so it needs some help to find things.
239
export NIX_LDFLAGS_BEFORE="-rpath ${clang.cc.gcc.lib}/lib -L${clang.cc.gcc.lib}/lib $NIX_LDFLAGS_BEFORE"
0
0
0
0
0
0
240
241
$SWIFT_SOURCE_ROOT/swift/utils/build-script \
242
--preset=buildbot_linux \
···
264
# Extract the generated tarball into the store
265
tar xf $INSTALLABLE_PACKAGE -C $out --strip-components=3 ''${out/#\/}
266
find $out -type d -empty -delete
0
0
0
0
0
267
268
wrapProgram $out/bin/swift \
269
--suffix C_INCLUDE_PATH : $out/lib/swift/clang/include \
···
33
}:
34
35
let
36
+
version = "5.1.1";
37
38
fetch = { repo, sha256, fetchSubmodules ? false }:
39
fetchFromGitHub {
···
44
};
45
46
sources = {
0
0
47
llvm = fetch {
48
repo = "swift-llvm";
49
+
sha256 = "00ldd9dby6fl6nk3z17148fvb7g9x4jkn1afx26y51v8rwgm1i7f";
50
};
51
compilerrt = fetch {
52
repo = "swift-compiler-rt";
53
+
sha256 = "1431f74l0n2dxn728qp65nc6hivx88fax1wzfrnrv19y77br05wj";
54
};
55
clang = fetch {
56
repo = "swift-clang";
57
+
sha256 = "0n7k6nvzgqp6h6bfqcmna484w90db3zv4sh5rdh89wxyhdz6rk4v";
58
+
};
59
+
clangtools = fetch {
60
+
repo = "swift-clang-tools-extra";
61
+
sha256 = "0snp2rpd60z239pr7fxpkj332rkdjhg63adqvqdkjsbrxcqqcgqa";
62
+
};
63
+
indexstore = fetch {
64
+
repo = "indexstore-db";
65
+
sha256 = "1gwkqkdmpd5hn7555dpdkys0z50yh00hjry2886h6rx7avh5p05n";
66
+
};
67
+
sourcekit = fetch {
68
+
repo = "sourcekit-lsp";
69
+
sha256 = "0k84ssr1k7grbvpk81rr21ii8csnixn9dp0cga98h6i1gshn8ml4";
70
};
71
cmark = fetch {
72
repo = "swift-cmark";
···
74
};
75
lldb = fetch {
76
repo = "swift-lldb";
77
+
sha256 = "0j787475f0nlmvxqblkhn3yrvn9qhcb2jcijwijxwq95ar2jdygs";
78
};
79
llbuild = fetch {
80
repo = "swift-llbuild";
81
+
sha256 = "1n2s5isxyl6b6ya617gdzjbw68shbvd52vsfqc1256rk4g448v8b";
82
};
83
pm = fetch {
84
repo = "swift-package-manager";
85
+
sha256 = "1a49jmag5mpld9zr96g8a773334mrz1c4nyw38gf4p6sckf4jp29";
86
};
87
xctest = fetch {
88
repo = "swift-corelibs-xctest";
89
+
sha256 = "0rxy9sq7i0s0kxfkz0hvdp8zyb40h31f7g4m0kry36qk82gzzh89";
90
};
91
foundation = fetch {
92
repo = "swift-corelibs-foundation";
93
+
sha256 = "1iiiijsnys0r3hjcj1jlkn3yszzi7hwb2041cnm5z306nl9sybzp";
94
};
95
libdispatch = fetch {
96
repo = "swift-corelibs-libdispatch";
97
+
sha256 = "0laqsizsikyjhrzn0rghvxd8afg4yav7cbghvnf7ywk9wc6kpkmn";
98
fetchSubmodules = true;
99
};
100
swift = fetch {
101
repo = "swift";
102
+
sha256 = "0m4r1gzrnn0s1c7haqq9dlmvpqxbgbkbdfmq6qaph869wcmvdkvy";
103
};
104
};
105
···
165
cp -r ${sources.llvm} llvm
166
cp -r ${sources.compilerrt} compiler-rt
167
cp -r ${sources.clang} clang
168
+
cp -r ${sources.clangtools} clang-tools-extra
169
+
cp -r ${sources.indexstore} indexstore-db
170
+
cp -r ${sources.sourcekit} sourcekit-lsp
171
cp -r ${sources.cmark} cmark
172
cp -r ${sources.lldb} lldb
173
cp -r ${sources.llbuild} llbuild
···
212
\
213
-e 's/^swift-install-components=autolink.*$/\0;editor-integration/'
214
215
+
substituteInPlace clang/lib/Driver/ToolChains/Linux.cpp \
216
+
--replace 'SysRoot + "/lib' '"${glibc}/lib" "'
0
217
substituteInPlace clang/lib/Driver/ToolChains/Linux.cpp \
218
--replace 'SysRoot + "/usr/lib' '"${glibc}/lib" "'
219
patch -p1 -d clang -i ${./patches/llvm-toolchain-dir.patch}
···
223
sed -i 's/curses/ncurses/' llbuild/*/*/CMakeLists.txt
224
225
PREFIX=''${out/#\/}
226
+
substituteInPlace indexstore-db/Utilities/build-script-helper.py \
227
+
--replace usr "$PREFIX"
228
+
substituteInPlace sourcekit-lsp/Utilities/build-script-helper.py \
229
+
--replace usr "$PREFIX"
230
substituteInPlace swift-corelibs-xctest/build_script.py \
231
--replace usr "$PREFIX"
232
'';
···
237
mkdir build install
238
export SWIFT_BUILD_ROOT=$PWD/build
239
export SWIFT_INSTALL_DIR=$PWD/install
0
0
0
240
241
export INSTALLABLE_PACKAGE=$PWD/swift.tar.gz
242
export NIX_ENFORCE_PURITY=
···
250
# During the Swift build, a full local LLVM build is performed and the resulting clang is invoked.
251
# This compiler is not using the Nix wrappers, so it needs some help to find things.
252
export NIX_LDFLAGS_BEFORE="-rpath ${clang.cc.gcc.lib}/lib -L${clang.cc.gcc.lib}/lib $NIX_LDFLAGS_BEFORE"
253
+
# However, we want to use the wrapped compiler whenever possible.
254
+
export CC="${clang}/bin/clang"
255
+
256
+
# fix for https://bugs.llvm.org/show_bug.cgi?id=39743
257
+
# see also https://forums.swift.org/t/18138/15
258
+
export CCC_OVERRIDE_OPTIONS="#x-fmodules s/-fmodules-cache-path.*//"
259
260
$SWIFT_SOURCE_ROOT/swift/utils/build-script \
261
--preset=buildbot_linux \
···
283
# Extract the generated tarball into the store
284
tar xf $INSTALLABLE_PACKAGE -C $out --strip-components=3 ''${out/#\/}
285
find $out -type d -empty -delete
286
+
287
+
# fix installation weirdness, also present in Apple’s official tarballs
288
+
mv $out/local/include/indexstore $out/include
289
+
rmdir $out/local/include $out/local
290
+
rm -r $out/bin/sdk-module-lists $out/bin/swift-api-checker.py
291
292
wrapProgram $out/bin/swift \
293
--suffix C_INCLUDE_PATH : $out/lib/swift/clang/include \
+1
-1
pkgs/development/compilers/swift/patches/0001-build-presets-linux-don-t-require-using-Ninja.patch
···
2
3
--- a/utils/build-presets.ini
4
+++ b/utils/build-presets.ini
5
-
@@ -721,7 +721,7 @@ swiftpm
6
7
dash-dash
8
···
2
3
--- a/utils/build-presets.ini
4
+++ b/utils/build-presets.ini
5
+
@@ -745,7 +745,7 @@ swiftpm
6
7
dash-dash
8
+3
-3
pkgs/development/compilers/swift/patches/0002-build-presets-linux-allow-custom-install-prefix.patch
···
2
3
--- a/utils/build-presets.ini 2019-04-11 14:51:40.060259462 +0200
4
+++ b/utils/build-presets.ini 2019-04-11 15:16:17.471137969 +0200
5
-
@@ -728,7 +728,7 @@
6
install-swiftpm
7
install-xctest
8
install-libicu
9
-install-prefix=/usr
10
+install-prefix=%(install_prefix)s
11
-
swift-install-components=autolink-driver;compiler;clang-resource-dir-symlink;stdlib;swift-remote-mirror;sdk-overlay;license;sourcekit-inproc
12
-
llvm-install-components=llvm-cov;llvm-profdata;IndexStore;clang;clang-headers;compiler-rt
13
install-libcxx
0
0
···
2
3
--- a/utils/build-presets.ini 2019-04-11 14:51:40.060259462 +0200
4
+++ b/utils/build-presets.ini 2019-04-11 15:16:17.471137969 +0200
5
+
@@ -752,7 +752,7 @@
6
install-swiftpm
7
install-xctest
8
install-libicu
9
-install-prefix=/usr
10
+install-prefix=%(install_prefix)s
0
0
11
install-libcxx
12
+
install-sourcekit-lsp
13
+
build-swift-static-stdlib
+3
-5
pkgs/development/compilers/swift/patches/0003-build-presets-linux-don-t-build-extra-libs.patch
···
2
3
--- a/utils/build-presets.ini 2019-04-11 15:19:57.845178834 +0200
4
+++ b/utils/build-presets.ini 2019-04-11 15:27:42.041297057 +0200
5
-
@@ -716,8 +716,6 @@
6
llbuild
7
swiftpm
8
xctest
···
11
12
dash-dash
13
14
-
@@ -727,11 +725,9 @@
15
install-llbuild
16
install-swiftpm
17
install-xctest
18
-install-libicu
19
install-prefix=%(install_prefix)s
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
0
23
build-swift-static-stdlib
24
build-swift-static-sdk-overlay
25
-
build-swift-stdlib-unittest-extra
···
2
3
--- a/utils/build-presets.ini 2019-04-11 15:19:57.845178834 +0200
4
+++ b/utils/build-presets.ini 2019-04-11 15:27:42.041297057 +0200
5
+
@@ -740,8 +740,6 @@
6
llbuild
7
swiftpm
8
xctest
···
11
12
dash-dash
13
14
+
@@ -751,9 +749,7 @@
15
install-llbuild
16
install-swiftpm
17
install-xctest
18
-install-libicu
19
install-prefix=%(install_prefix)s
0
0
20
-install-libcxx
21
+
install-sourcekit-lsp
22
build-swift-static-stdlib
23
build-swift-static-sdk-overlay
0
+1
-1
pkgs/development/compilers/swift/patches/0004-build-presets-linux-plumb-extra-cmake-options.patch
···
2
3
--- a/utils/build-presets.ini
4
+++ b/utils/build-presets.ini
5
-
@@ -743,6 +743,8 @@ install-destdir=%(install_destdir)s
6
# Path to the .tar.gz package we would create.
7
installable-package=%(installable_package)s
8
···
2
3
--- a/utils/build-presets.ini
4
+++ b/utils/build-presets.ini
5
+
@@ -766,6 +766,8 @@ install-destdir=%(install_destdir)s
6
# Path to the .tar.gz package we would create.
7
installable-package=%(installable_package)s
8
+1
-1
pkgs/development/compilers/swift/patches/glibc-arch-headers.patch
···
2
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 @@
6
endif()
7
8
set(GLIBC_INCLUDE_PATH "${GLIBC_SYSROOT_RELATIVE_INCLUDE_PATH}")
···
2
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
+
@@ -77,7 +77,7 @@
6
endif()
7
8
set(GLIBC_INCLUDE_PATH "${GLIBC_SYSROOT_RELATIVE_INCLUDE_PATH}")
-13
pkgs/development/compilers/swift/patches/libdispatch-fortify-fix.patch
···
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); \
···
0
0
0
0
0
0
0
0
0
0
0
0
0
+1
-1
pkgs/development/compilers/swift/purity.patch
···
2
3
--- a/lib/Driver/ToolChains/Gnu.cpp
4
+++ b/lib/Driver/ToolChains/Gnu.cpp
5
-
@@ -380,13 +380,6 @@ void tools::gnutools::Linker::ConstructJob(Compilation &C, const JobAction &JA,
6
if (!Args.hasArg(options::OPT_static)) {
7
if (Args.hasArg(options::OPT_rdynamic))
8
CmdArgs.push_back("-export-dynamic");
···
2
3
--- a/lib/Driver/ToolChains/Gnu.cpp
4
+++ b/lib/Driver/ToolChains/Gnu.cpp
5
+
@@ -402,13 +402,6 @@ void tools::gnutools::Linker::ConstructJob(Compilation &C, const JobAction &JA,
6
if (!Args.hasArg(options::OPT_static)) {
7
if (Args.hasArg(options::OPT_rdynamic))
8
CmdArgs.push_back("-export-dynamic");