Merge branch 'staging' into staging-next

This commit is contained in:
Vladimír Čunát
2023-01-21 13:29:39 +01:00
217 changed files with 4896 additions and 1173 deletions
+1 -1
View File
@@ -253,7 +253,7 @@ The propagated equivalent of `depsTargetTarget`. This is prefixed for the same r
#### `NIX_DEBUG` {#var-stdenv-NIX_DEBUG}
A natural number indicating how much information to log. If set to 1 or higher, `stdenv` will print moderate debugging information during the build. In particular, the `gcc` and `ld` wrapper scripts will print out the complete command line passed to the wrapped tools. If set to 6 or higher, the `stdenv` setup script will be run with `set -x` tracing. If set to 7 or higher, the `gcc` and `ld` wrapper scripts will also be run with `set -x` tracing.
A number between 0 and 7 indicating how much information to log. If set to 1 or higher, `stdenv` will print moderate debugging information during the build. In particular, the `gcc` and `ld` wrapper scripts will print out the complete command line passed to the wrapped tools. If set to 6 or higher, the `stdenv` setup script will be run with `set -x` tracing. If set to 7 or higher, the `gcc` and `ld` wrapper scripts will also be run with `set -x` tracing.
### Attributes affecting build properties {#attributes-affecting-build-properties}
@@ -296,6 +296,12 @@
relying on this should provide their own implementation.
</para>
</listitem>
<listitem>
<para>
Calling <literal>makeSetupHook</literal> without passing a
<literal>name</literal> argument is deprecated.
</para>
</listitem>
<listitem>
<para>
Qt 5.12 and 5.14 have been removed, as the corresponding
@@ -331,6 +337,17 @@
<literal>freetype</literal> and others.
</para>
</listitem>
<listitem>
<para>
The iputils package, which is installed by default, no longer
provides the <literal>ninfod</literal>,
<literal>rarpd</literal> and <literal>rdisc</literal> tools.
See
<link xlink:href="https://github.com/iputils/iputils/releases/tag/20221126">upstreams
release notes</link> for more details and available
replacements.
</para>
</listitem>
</itemizedlist>
</section>
<section xml:id="sec-release-23.05-notable-changes">
@@ -77,6 +77,8 @@ In addition to numerous new and upgraded packages, this release has the followin
- The EC2 image module previously detected and activated swap-formatted instance store devices and partitions in stage-1 (initramfs). This behaviour has been removed. Users relying on this should provide their own implementation.
- Calling `makeSetupHook` without passing a `name` argument is deprecated.
- Qt 5.12 and 5.14 have been removed, as the corresponding branches have been EOL upstream for a long time. This affected under 10 packages in nixpkgs, largely unmaintained upstream as well, however, out-of-tree package expressions may need to be updated manually.
- In `mastodon` it is now necessary to specify location of file with `PostgreSQL` database password. In `services.mastodon.database.passwordFile` parameter default value `/var/lib/mastodon/secrets/db-password` has been changed to `null`.
@@ -85,6 +87,11 @@ In addition to numerous new and upgraded packages, this release has the followin
- Deprecated `xlibsWrapper` transitional package has been removed in favour of direct use of its constitutents: `xorg.libX11`, `freetype` and others.
- The iputils package, which is installed by default, no longer provides the
`ninfod`, `rarpd` and `rdisc` tools. See
[upstream's release notes](https://github.com/iputils/iputils/releases/tag/20221126)
for more details and available replacements.
## Other Notable Changes {#sec-release-23.05-notable-changes}
<!-- To avoid merge conflicts, consider adding your item at an arbitrary place in the list instead. -->
@@ -71,6 +71,29 @@ in
};
description = lib.mdDoc "Set configuration for system-wide bluetooth (/etc/bluetooth/main.conf).";
};
input = mkOption {
type = cfgFmt.type;
default = { };
example = {
General = {
IdleTimeout = 30;
ClassicBondedOnly = true;
};
};
description = lib.mdDoc "Set configuration for the input service (/etc/bluetooth/input.conf).";
};
network = mkOption {
type = cfgFmt.type;
default = { };
example = {
General = {
DisableSecurity = true;
};
};
description = lib.mdDoc "Set configuration for the network service (/etc/bluetooth/network.conf).";
};
};
};
@@ -80,6 +103,10 @@ in
environment.systemPackages = [ package ]
++ optional cfg.hsphfpd.enable pkgs.hsphfpd;
environment.etc."bluetooth/input.conf".source =
cfgFmt.generate "input.conf" cfg.input;
environment.etc."bluetooth/network.conf".source =
cfgFmt.generate "network.conf" cfg.network;
environment.etc."bluetooth/main.conf".source =
cfgFmt.generate "main.conf" (recursiveUpdate defaults cfg.settings);
services.udev.packages = [ package ];
@@ -5,13 +5,13 @@
stdenv.mkDerivation rec {
pname = "fluidsynth";
version = "2.3.0";
version = "2.3.1";
src = fetchFromGitHub {
owner = "FluidSynth";
repo = "fluidsynth";
rev = "v${version}";
sha256 = "sha256-7SuM7a8IIecAJ83QvJfUba/wArAEXywqL2HwVbeG8H4=";
sha256 = "05lr9f0q4x1kvgfa3xrfmagpwvijv9m1s316aa9figqlkcc5vv4k";
};
nativeBuildInputs = [ buildPackages.stdenv.cc pkg-config cmake ];
@@ -524,7 +524,7 @@ buildStdenv.mkDerivation ({
fi
# Extract the debug info.
header "separating debug info from $i (build ID $id)"
echo "separating debug info from $i (build ID $id)"
mkdir -p "$dst/''${id:0:2}"
$OBJCOPY --only-keep-debug "$i" "$dst/''${id:0:2}/''${id:2}.debug"
@@ -4,14 +4,14 @@
stdenv.mkDerivation rec {
pname = "xterm";
version = "377";
version = "378";
src = fetchurl {
urls = [
"ftp://ftp.invisible-island.net/xterm/${pname}-${version}.tgz"
"https://invisible-mirror.net/archives/xterm/${pname}-${version}.tgz"
];
hash = "sha256-2xCP56Rdjtl+YEchtYRDtHNknmHiY2Mb+HWfhhipkLI=";
hash = "sha256-ZJ37/V7dDtnkfPjk2VO0sNPDC8KAFm38T/0Ulz/sPpI=";
};
strictDeps = true;
@@ -28,7 +28,7 @@ assert sendEmailSupport -> perlSupport;
assert svnSupport -> perlSupport;
let
version = "2.39.0";
version = "2.39.1";
svn = subversionClient.override { perlBindings = perlSupport; };
gitwebPerlLibs = with perlPackages; [ CGI HTMLParser CGIFast FCGI FCGIProcManager HTMLTagCloud ];
in
@@ -41,7 +41,7 @@ stdenv.mkDerivation (finalAttrs: {
src = fetchurl {
url = "https://www.kernel.org/pub/software/scm/git/git-${version}.tar.xz";
sha256 = "sha256-uhmbE/tamco97JF7C9c2vA61qd+Hc31DXt398Q1pJls=";
sha256 = "sha256-QKOKCEezDDcbNYc7OvzxI4hd1B6j7Lv1EO+pfzzlwWE=";
};
outputs = [ "out" ] ++ lib.optional withManual "doc";
@@ -338,11 +338,18 @@ stdenv.mkDerivation {
# compile, because it uses "#include_next <limits.h>" to find the
# limits.h file in ../includes-fixed. To remedy the problem,
# another -idirafter is necessary to add that directory again.
#
# We use --sysroot=/nix/store/does/not/exist to drop embedded default
# path to glibc headers gcc was built against. Without it -idirafter
# only appends to the list and outdated glibc headers end up being
# used. 'cc-cflags-before' is used to allow user's --sysroot= option
# to override our default.
+ optionalString (libc != null) (''
touch "$out/nix-support/libc-cflags"
touch "$out/nix-support/libc-ldflags"
echo "-B${libc_lib}${libc.libdir or "/lib/"}" >> $out/nix-support/libc-crt1-cflags
'' + optionalString (!(cc.langD or false)) ''
echo "--sysroot=/nix/store/does/not/exist" >> $out/nix-support/cc-cflags-before
echo "-idirafter ${libc_dev}${libc.incdir or "/include"}" >> $out/nix-support/libc-cflags
'' + optionalString (isGNU && (!(cc.langD or false))) ''
for dir in "${cc}"/lib/gcc/*/*/include-fixed; do
+1 -3
View File
@@ -1,10 +1,8 @@
if [ -e .attrs.sh ]; then source .attrs.sh; fi
source "$stdenv/setup"
header "exporting \`$url' (revision $rev) into \`$out'"
echo "exporting \`$url' (revision $rev) into \`$out'"
# Perform a lightweight checkout so that we don't end up importing
# all the repository's history.
BZR_LOG=/dev/null bzr -Ossl.cert_reqs=none export -r "$rev" --format=dir "$out" "$url"
stopNest
-2
View File
@@ -24,5 +24,3 @@ else
fi
(cd export && cvs -f -z0 -d "$cvsRoot" export $tag "$module")
mv export/* $out
stopNest
+1 -3
View File
@@ -11,10 +11,8 @@ elif test -n "$context"; then
tagflags="--context=$context"
fi
header "getting $url $partial ${tagtext} into $out"
echo "getting $url $partial ${tagtext} into $out"
darcs get --lazy $tagflags "$url" "$out"
# remove metadata, because it can change
rm -rf "$out/_darcs"
stopNest
@@ -1,6 +1,6 @@
if [ -e .attrs.sh ]; then source .attrs.sh; fi
source "${stdenv}/setup"
header "exporting ${repository}/${imageName} (tag: ${tag}) into ${out}"
echo "exporting ${repository}/${imageName} (tag: ${tag}) into ${out}"
mkdir -p "${out}"
cat <<EOF > "${out}/compositeImage.sh"
@@ -26,4 +26,3 @@ ${gnutar}/bin/tar \
-c "${manifest}" "${repositories}" -T "${imageFileStorePaths}"
EOF
chmod +x "${out}/compositeImage.sh"
stopNest
@@ -36,7 +36,7 @@ stdenv.mkDerivation {
inherit name;
builder = writeText "${fetcher}-builder.sh" ''
source "$stdenv/setup"
header "${fetcher} exporting to $out"
echo "${fetcher} exporting to $out"
declare -A creds
@@ -49,7 +49,7 @@ stdenv.mkDerivation {
fi
if [ -f "$dockerCredentialsFile" ]; then
header "using credentials from $dockerCredentialsFile"
echo "using credentials from $dockerCredentialsFile"
CREDSFILE=$(cat "$dockerCredentialsFile")
creds[token]=$(${awk} -F'=' '/DOCKER_TOKEN/ {print $2}' <<< "$CREDSFILE" | head -n1)
@@ -77,8 +77,6 @@ stdenv.mkDerivation {
${layerDigestFlag} \
"${repository}/${imageName}" \
"${tag}"
stopNest
'';
buildInputs = [ haskellPackages.hocker ];
@@ -29,7 +29,7 @@ stdenv.mkDerivation {
builder = writeScript "xpibuilder" ''
source $stdenv/setup
header "firefox addon $name into $out"
echo "firefox addon $name into $out"
UUID="${extid}"
mkdir -p "$out/$UUID"
+1 -3
View File
@@ -1,6 +1,6 @@
if [ -e .attrs.sh ]; then source .attrs.sh; fi
source $stdenv/setup
header "Cloning Fossil $url [$rev] into $out"
echo "Cloning Fossil $url [$rev] into $out"
# Fossil, bless its adorable little heart, wants to write global configuration
# to $HOME/.fossil. AFAICT, there is no way to disable this functionality.
@@ -19,5 +19,3 @@ popd
# Just nuke the checkout file.
rm $out/.fslckout
stopNest
+1 -2
View File
@@ -6,7 +6,7 @@
if [ -e .attrs.sh ]; then source .attrs.sh; fi
source $stdenv/setup
header "exporting $url (rev $rev) into $out"
echo "exporting $url (rev $rev) into $out"
$SHELL $fetcher --builder --url "$url" --out "$out" --rev "$rev" \
${leaveDotGit:+--leave-dotGit} \
@@ -18,4 +18,3 @@ $SHELL $fetcher --builder --url "$url" --out "$out" --rev "$rev" \
${branchName:+--branch-name "$branchName"}
runHook postFetch
stopNest
+1 -3
View File
@@ -1,10 +1,8 @@
if [ -e .attrs.sh ]; then source .attrs.sh; fi
source $stdenv/setup
header "getting $url${rev:+ ($rev)} into $out"
echo "getting $url${rev:+ ($rev)} into $out"
hg clone --insecure "$url" hg-clone
hg archive -q$subrepoClause -y ${rev:+-r "$rev"} --cwd hg-clone $out
rm -f $out/.hg_archival.txt
stopNest
+3 -9
View File
@@ -8,7 +8,7 @@ if ! [ -f "$cacheDB" ]; then
mtn --db "$cacheDB" db init
fi
header "getting revision $selector";
echo "getting revision $selector";
done=;
for source in $dbs; do
@@ -32,9 +32,7 @@ for source in $dbs; do
fi;
done;
stopNest;
header "checking out the revision $revision";
echo "checking out the revision $revision";
if test -n "$done"; then
mtn checkout --db "$cacheDB" -r "$revision" "$out" -b "${branch}"
@@ -43,10 +41,6 @@ else
exit 1;
fi;
stopNest
header "clearing _MTN in the output"
echo "clearing _MTN in the output"
rm -rf "$out/_MTN"
stopNest
+1 -3
View File
@@ -1,7 +1,7 @@
if [ -e .attrs.sh ]; then source .attrs.sh; fi
source $stdenv/setup
header "exporting $url (r$rev) into $out"
echo "exporting $url (r$rev) into $out"
if test -n "$http_proxy"; then
# Configure proxy
@@ -22,5 +22,3 @@ fi;
svn export --trust-server-cert --non-interactive \
${ignoreExternals:+--ignore-externals} ${ignoreKeywords:+--ignore-keywords} \
-r "$rev" "$url" "$out"
stopNest
+1 -3
View File
@@ -1,7 +1,7 @@
if [ -e .attrs.sh ]; then source .attrs.sh; fi
source $stdenv/setup
header "exporting $url (r$rev) into $out"
echo "exporting $url (r$rev) into $out"
if test "$sshSupport"; then
export SVN_SSH="$openssh/bin/ssh"
@@ -12,5 +12,3 @@ fi
# whether the server is being spoofed --- only the cryptographic
# hash of the output matters.
expect -f $sshSubversion "$username" "$password" "$rev" "$url" $out
stopNest
+1 -1
View File
@@ -37,7 +37,7 @@ if [ -n "$downloadToTemp" ]; then downloadedFile="$TMPDIR/file"; fi
tryDownload() {
local url="$1"
echo
header "trying $url"
echo "trying $url"
local curlexit=18;
success=
@@ -46,14 +46,11 @@ stdenv.mkDerivation {
strictDeps = true;
dontBuild = true;
dontConfigure = true;
dontUnpack = true;
# Additional flags passed to pkg-config.
addFlags = lib.optional stdenv.targetPlatform.isStatic "--static";
unpackPhase = ''
src=$PWD
'';
installPhase =
''
mkdir -p $out/bin $out/nix-support
+2 -4
View File
@@ -43,9 +43,8 @@ vmTools.runInLinuxImage (stdenv.mkDerivation (
[ ! -f /etc/lsb-release ] || (source /etc/lsb-release; echo "OS release: $DISTRIB_DESCRIPTION")
echo "System/kernel: $(uname -a)"
if test -e /etc/debian_version; then echo "Debian release: $(cat /etc/debian_version)"; fi
header "installed Debian packages"
echo "installed Debian packages"
dpkg-query --list
stopNest
'';
installPhase = ''
@@ -73,11 +72,10 @@ vmTools.runInLinuxImage (stdenv.mkDerivation (
[ "$(echo $out/debs/*.deb)" != "" ]
for i in $out/debs/*.deb; do
header "Generated DEB package: $i"
echo "Generated DEB package: $i"
dpkg-deb --info "$i"
pkgName=$(dpkg-deb -W "$i" | awk '{print $1}')
echo "file deb $i" >> $out/nix-support/hydra-build-products
stopNest
done
dpkg -i $out/debs/*.deb
+1 -2
View File
@@ -74,10 +74,9 @@ stdenv.mkDerivation (
if test -n "$succeedOnFailure"; then
if test -n "$keepBuildDirectory"; then
KEEPBUILDDIR="$out/`basename $TMPDIR`"
header "Copying build directory to $KEEPBUILDDIR"
echo "Copying build directory to $KEEPBUILDDIR"
mkdir -p $KEEPBUILDDIR
cp -R "$TMPDIR/"* $KEEPBUILDDIR
stopNest
fi
fi
'';
@@ -64,10 +64,9 @@ stdenv.mkDerivation (
if test -n "$succeedOnFailure"; then
if test -n "$keepBuildDirectory"; then
KEEPBUILDDIR="$out/`basename $TMPDIR`"
header "Copying build directory to $KEEPBUILDDIR"
echo "Copying build directory to $KEEPBUILDDIR"
mkdir -p $KEEPBUILDDIR
cp -R "$TMPDIR/"* $KEEPBUILDDIR
stopNest
fi
fi
'';
@@ -13,7 +13,7 @@ auditTmpdir() {
local dir="$1"
[ -e "$dir" ] || return 0
header "checking for references to $TMPDIR/ in $dir..."
echo "checking for references to $TMPDIR/ in $dir..."
local i
find "$dir" -type f -print0 | while IFS= read -r -d $'\0' i; do
@@ -36,6 +36,4 @@ auditTmpdir() {
fi
done
stopNest
}
@@ -131,7 +131,14 @@ def populate_cache(initial: List[Path], recursive: bool =False) -> None:
if not path.is_file():
continue
# As an optimisation, resolve the symlinks here, as the target is unique
# XXX: (layus, 2022-07-25) is this really an optimisation in all cases ?
# It could make the rpath bigger or break the fragile precedence of $out.
resolved = path.resolve()
# Do not use resolved paths when names do not match
if resolved.name != path.name:
resolved = path
try:
with open_elf(path) as elf:
osabi = get_osabi(elf)
@@ -6,12 +6,11 @@ fixupOutputHooks+=('if [ -z "$dontCanonicalizeJars" -a -e "$prefix" ]; then cano
canonicalizeJarsIn() {
local dir="$1"
header "canonicalizing jars in $dir"
echo "canonicalizing jars in $dir"
dir="$(realpath -sm -- "$dir")"
while IFS= read -rd '' f; do
canonicalizeJar "$f"
done < <(find -- "$dir" -type f -name '*.jar' -print0)
stopNest
}
source @canonicalize_jar@
@@ -10,6 +10,8 @@
}:
makeSetupHook {
name = "make-binary-wrapper-hook";
deps = [ dieHook ]
# https://github.com/NixOS/nixpkgs/issues/148189
++ lib.optional (stdenv.isDarwin && stdenv.isAarch64) cc;
@@ -6,8 +6,8 @@ postFixupHooks+=(_makeSymlinksRelative)
_makeSymlinksRelative() {
local symlinkTarget
if [ -n "${dontRewriteSymlinks-}" ]; then
return 0
if [ "${dontRewriteSymlinks-}" ] || [ ! -e "$prefix" ]; then
return
fi
while IFS= read -r -d $'\0' f; do
@@ -4,16 +4,32 @@ preFixupHooks+=(_multioutDocs)
preFixupHooks+=(_multioutDevs)
postFixupHooks+=(_multioutPropagateDev)
# Assign the first string containing nonempty variable to the variable named $1
# _assignFirst varName otherVarNames*
#
# Set the value of the variable named $varName to the first of otherVarNames
# that refers to a non-empty variable name.
#
# If none of otherVarNames refers to a non-empty variable, the error message is
# specific to this function's use case, which is setting up the output variables.
_assignFirst() {
local varName="$1"
local REMOVE=REMOVE # slightly hacky - we allow REMOVE (i.e. not a variable name)
shift
while (( $# )); do
if [ -n "${!1-}" ]; then eval "${varName}"="$1"; return; fi
shift
for var in "$@"; do
if [ -n "${!var-}" ]; then eval "${varName}"="${var}"; return; fi
done
echo "Error: _assignFirst found no valid variant!"
echo
echo "error: _assignFirst: could not find a non-empty variable to assign to ${varName}."
echo " The following variables were all unset or empty:"
echo " $*"
if [ -z "${out:-}" ]; then
echo ' If you do not want an "out" output in your derivation, make sure to define'
echo ' the other specific required outputs. This can be achieved by picking one'
echo " of the above as an output."
echo ' You do not have to remove "out" if you want to have a different default'
echo ' output, because the first output is taken as a default.'
echo
fi
return 1 # none found
}
@@ -100,8 +100,6 @@ patchShebangs() {
fi
fi
done < <(find "$@" -type f -perm -0100 -print0)
stopNest
}
patchShebangsAuto () {
@@ -53,7 +53,7 @@ EOF
echo >&2 'initdb not found. Did you add postgresql to the checkInputs?'
false
fi
header 'initializing postgresql'
echo 'initializing postgresql'
initdb -U postgres
# Move the socket
@@ -65,15 +65,15 @@ EOF
echo "listen_addresses = ''" >>"$PGDATA/postgresql.conf"
fi
header 'starting postgresql'
echo 'starting postgresql'
eval "${postgresqlStartCommands:-pg_ctl start}"
header 'setting up postgresql'
echo 'setting up postgresql'
eval "$postgresqlTestSetupCommands"
}
postgresqlStop() {
header 'stopping postgresql'
echo 'stopping postgresql'
pg_ctl stop
}
@@ -26,7 +26,7 @@ _separateDebugInfo() {
fi
# Extract the debug info.
header "separating debug info from $i (build ID $id)"
echo "separating debug info from $i (build ID $id)"
mkdir -p "$dst/${id:0:2}"
# This may fail, e.g. if the binary is for a different
+1 -1
View File
@@ -36,7 +36,7 @@ _doStrip() {
local -n ranlibCmd="${ranlibCmds[$i]}"
# `dontStrip` disables them all
if [[ "${dontStrip-}" || "${flag-}" ]] || ! type -f "${stripCmd-}" 2>/dev/null
if [[ "${dontStrip-}" || "${flag-}" ]] || ! type -f "${stripCmd-}" 2>/dev/null 1>&2
then continue; fi
stripDirs "$stripCmd" "$ranlibCmd" "$debugDirList" "${stripDebugFlags[*]:--S}"
+10 -1
View File
@@ -546,6 +546,7 @@ rec {
* # writes a Linux-exclusive setup hook where @bash@ myscript.sh is substituted for the
* # bash interpreter.
* myhellohookSub = makeSetupHook {
* name = "myscript-hook";
* deps = [ hello ];
* substitutions = { bash = "${pkgs.bash}/bin/bash"; };
* meta.platforms = lib.platforms.linux;
@@ -553,13 +554,21 @@ rec {
*
* # setup hook with a package test
* myhellohookTested = makeSetupHook {
* name = "myscript-hook";
* deps = [ hello ];
* substitutions = { bash = "${pkgs.bash}/bin/bash"; };
* meta.platforms = lib.platforms.linux;
* passthru.tests.greeting = callPackage ./test { };
* } ./myscript.sh;
*/
makeSetupHook = { name ? "hook", deps ? [], substitutions ? {}, meta ? {}, passthru ? {} }: script:
makeSetupHook =
{ name ? lib.warn "calling makeSetupHook without passing a name is deprecated." "hook"
, deps ? []
, substitutions ? {}
, meta ? {}
, passthru ? {}
}:
script:
runCommand name
(substitutions // {
inherit meta;
+2 -4
View File
@@ -527,9 +527,8 @@ rec {
echo "System/kernel: $(uname -a)"
if test -e /etc/fedora-release; then echo "Fedora release: $(cat /etc/fedora-release)"; fi
if test -e /etc/SuSE-release; then echo "SUSE release: $(cat /etc/SuSE-release)"; fi
header "installed RPM packages"
echo "installed RPM packages"
rpm -qa --qf "%{Name}-%{Version}-%{Release} (%{Arch}; %{Distribution}; %{Vendor})\n"
stopNest
'';
buildPhase = ''
@@ -559,9 +558,8 @@ rec {
find $rpmout -name "*.rpm" -exec cp {} $out/$outDir \;
for i in $out/$outDir/*.rpm; do
header "Generated RPM/SRPM: $i"
echo "Generated RPM/SRPM: $i"
rpm -qip $i
stopNest
done
eval "$postInstall"
+3 -1
View File
@@ -25,7 +25,9 @@ makeScopeWithSplicing
mkXfceDerivation = callPackage ./mkXfceDerivation.nix { };
automakeAddFlags = pkgs.makeSetupHook { } ./automakeAddFlags.sh;
automakeAddFlags = pkgs.makeSetupHook {
name = "xfce-automake-add-flags-hook";
} ./automakeAddFlags.sh;
#### CORE
@@ -1,10 +1,8 @@
if [ -e .attrs.sh ]; then source .attrs.sh; fi
source $stdenv/setup
header "exporting egg ${eggName} (version $version) into $out"
echo "exporting egg ${eggName} (version $version) into $out"
mkdir -p $out
chicken-install -r "${eggName}:${version}"
cp -r ${eggName}/* $out/
stopNest
@@ -1,11 +1,9 @@
if [ -e .attrs.sh ]; then source .attrs.sh; fi
source $stdenv/setup
header "exporting egg ${eggName} (version $version) into $out"
echo "exporting egg ${eggName} (version $version) into $out"
mkdir -p $out
CHICKEN_EGG_CACHE=. chicken-install -r "${eggName}:${version}"
rm ${eggName}/{STATUS,TIMESTAMP}
cp -r ${eggName}/* $out/
stopNest
@@ -51,8 +51,14 @@ let majorVersion = "10";
inherit (stdenv) buildPlatform hostPlatform targetPlatform;
patches = [ ]
++ optional (targetPlatform != hostPlatform) ../libstdc++-target.patch
patches = [
# Fix https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80431
(fetchurl {
name = "fix-bug-80431.patch";
url = "https://gcc.gnu.org/git/?p=gcc.git;a=patch;h=de31f5445b12fd9ab9969dc536d821fe6f0edad0";
sha256 = "0sd52c898msqg7m316zp0ryyj7l326cjcn2y19dcxqp15r74qj0g";
})
] ++ optional (targetPlatform != hostPlatform) ../libstdc++-target.patch
++ optional noSysDirs ../no-sys-dirs.patch
++ optional (noSysDirs && hostPlatform.isRiscV) ../no-sys-dirs-riscv.patch
/* ++ optional (hostPlatform != buildPlatform) (fetchpatch { # XXX: Refine when this should be applied
@@ -222,6 +228,7 @@ stdenv.mkDerivation ({
};
targetConfig = if targetPlatform != hostPlatform then targetPlatform.config else null;
targetPlatformConfig = targetPlatform.config;
buildFlags = optional
(targetPlatform == hostPlatform && hostPlatform == buildPlatform)
@@ -51,8 +51,14 @@ let majorVersion = "11";
inherit (stdenv) buildPlatform hostPlatform targetPlatform;
patches =
optional (targetPlatform != hostPlatform) ../libstdc++-target.patch
patches = [
# Fix https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80431
(fetchurl {
name = "fix-bug-80431.patch";
url = "https://gcc.gnu.org/git/?p=gcc.git;a=patch;h=de31f5445b12fd9ab9969dc536d821fe6f0edad0";
sha256 = "0sd52c898msqg7m316zp0ryyj7l326cjcn2y19dcxqp15r74qj0g";
})
] ++ optional (targetPlatform != hostPlatform) ../libstdc++-target.patch
++ optional noSysDirs ../no-sys-dirs.patch
++ optional (noSysDirs && hostPlatform.isRiscV) ../no-sys-dirs-riscv.patch
/* ++ optional (hostPlatform != buildPlatform) (fetchpatch { # XXX: Refine when this should be applied
@@ -226,6 +232,7 @@ stdenv.mkDerivation ({
};
targetConfig = if targetPlatform != hostPlatform then targetPlatform.config else null;
targetPlatformConfig = targetPlatform.config;
buildFlags = optional
(targetPlatform == hostPlatform && hostPlatform == buildPlatform)
@@ -270,6 +270,7 @@ stdenv.mkDerivation ({
};
targetConfig = if targetPlatform != hostPlatform then targetPlatform.config else null;
targetPlatformConfig = targetPlatform.config;
buildFlags = optional
(targetPlatform == hostPlatform && hostPlatform == buildPlatform)
@@ -227,6 +227,7 @@ stdenv.mkDerivation ({
};
targetConfig = if targetPlatform != hostPlatform then targetPlatform.config else null;
targetPlatformConfig = targetPlatform.config;
buildFlags = optional
(targetPlatform == hostPlatform && hostPlatform == buildPlatform)
@@ -247,6 +247,7 @@ stdenv.mkDerivation ({
};
targetConfig = if targetPlatform != hostPlatform then targetPlatform.config else null;
targetPlatformConfig = targetPlatform.config;
buildFlags = optional
(targetPlatform == hostPlatform && hostPlatform == buildPlatform)
@@ -64,6 +64,13 @@ let majorVersion = "6";
patches = optionals (!stdenv.targetPlatform.isRedox) [
../use-source-date-epoch.patch ./0001-Fix-build-for-glibc-2.31.patch
# Fix https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80431
(fetchurl {
name = "fix-bug-80431.patch";
url = "https://gcc.gnu.org/git/?p=gcc.git;a=patch;h=de31f5445b12fd9ab9969dc536d821fe6f0edad0";
sha256 = "0sd52c898msqg7m316zp0ryyj7l326cjcn2y19dcxqp15r74qj0g";
})
] ++ optional (targetPlatform != hostPlatform) ../libstdc++-target.patch
++ optional noSysDirs ../no-sys-dirs.patch
++ optional langAda ../gnat-cflags.patch
@@ -258,6 +265,7 @@ stdenv.mkDerivation ({
};
targetConfig = if targetPlatform != hostPlatform then targetPlatform.config else null;
targetPlatformConfig = targetPlatform.config;
buildFlags = optional
(targetPlatform == hostPlatform && hostPlatform == buildPlatform)
@@ -56,6 +56,13 @@ let majorVersion = "7";
./gcc8-asan-glibc-2.34.patch
./0001-Fix-build-for-glibc-2.31.patch
# Fix https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80431
(fetchurl {
name = "fix-bug-80431.patch";
url = "https://gcc.gnu.org/git/?p=gcc.git;a=patch;h=de31f5445b12fd9ab9969dc536d821fe6f0edad0";
sha256 = "0sd52c898msqg7m316zp0ryyj7l326cjcn2y19dcxqp15r74qj0g";
})
]
++ optional (targetPlatform != hostPlatform) ../libstdc++-target.patch
++ optionals targetPlatform.isNetBSD [
@@ -226,6 +233,7 @@ stdenv.mkDerivation ({
;
targetConfig = if targetPlatform != hostPlatform then targetPlatform.config else null;
targetPlatformConfig = targetPlatform.config;
buildFlags = optional
(targetPlatform == hostPlatform && hostPlatform == buildPlatform)
+9 -2
View File
@@ -46,8 +46,14 @@ let majorVersion = "8";
inherit (stdenv) buildPlatform hostPlatform targetPlatform;
patches =
optional (targetPlatform != hostPlatform) ../libstdc++-target.patch
patches = [
# Fix https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80431
(fetchurl {
name = "fix-bug-80431.patch";
url = "https://gcc.gnu.org/git/?p=gcc.git;a=patch;h=de31f5445b12fd9ab9969dc536d821fe6f0edad0";
sha256 = "0sd52c898msqg7m316zp0ryyj7l326cjcn2y19dcxqp15r74qj0g";
})
] ++ optional (targetPlatform != hostPlatform) ../libstdc++-target.patch
++ optional targetPlatform.isNetBSD ../libstdc++-netbsd-ctypes.patch
++ optional noSysDirs ../no-sys-dirs.patch
/* ++ optional (hostPlatform != buildPlatform) (fetchpatch { # XXX: Refine when this should be applied
@@ -206,6 +212,7 @@ stdenv.mkDerivation ({
};
targetConfig = if targetPlatform != hostPlatform then targetPlatform.config else null;
targetPlatformConfig = targetPlatform.config;
buildFlags = optional
(targetPlatform == hostPlatform && hostPlatform == buildPlatform)
+9 -3
View File
@@ -55,9 +55,14 @@ let majorVersion = "9";
inherit (stdenv) buildPlatform hostPlatform targetPlatform;
patches =
[ ]
++ optional (targetPlatform != hostPlatform) ../libstdc++-target.patch
patches = [
# Fix https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80431
(fetchurl {
name = "fix-bug-80431.patch";
url = "https://gcc.gnu.org/git/?p=gcc.git;a=patch;h=de31f5445b12fd9ab9969dc536d821fe6f0edad0";
sha256 = "0sd52c898msqg7m316zp0ryyj7l326cjcn2y19dcxqp15r74qj0g";
})
] ++ optional (targetPlatform != hostPlatform) ../libstdc++-target.patch
++ optional targetPlatform.isNetBSD ../libstdc++-netbsd-ctypes.patch
++ optional noSysDirs ../no-sys-dirs.patch
++ optional (noSysDirs && hostPlatform.isRiscV) ../no-sys-dirs-riscv-gcc9.patch
@@ -221,6 +226,7 @@ stdenv.mkDerivation ({
};
targetConfig = if targetPlatform != hostPlatform then targetPlatform.config else null;
targetPlatformConfig = targetPlatform.config;
buildFlags = optional
(targetPlatform == hostPlatform && hostPlatform == buildPlatform)
+11 -19
View File
@@ -203,6 +203,17 @@ preInstall() {
ln -s lib "$out/${targetConfig}/lib32"
ln -s lib "${!outputLib}/${targetConfig}/lib32"
fi
# cc-wrappers uses --sysroot=/nix/store/does/not/exist as a way to
# drop default sysheaders search path. Unfortunately that switches
# clang++ into searching libraries in gcc in cross-compiler paths:
# from ${!outputLib}/lib (native)
# to ${!outputLib}/${targetPlatformConfig}/lib
# We create the symlink to make both native and cross paths
# available even if the toolchain is not the cross-compiler.
if [ ! -e ${!outputLib}/${targetPlatformConfig} ] ; then
ln -s . ${!outputLib}/${targetPlatformConfig}
fi
}
@@ -240,25 +251,6 @@ postInstall() {
# More dependencies with the previous gcc or some libs (gccbug stores the build command line)
rm -rf $out/bin/gccbug
if [[ buildConfig == *"linux"* ]]; then
# Take out the bootstrap-tools from the rpath, as it's not needed at all having $out
for i in $(find "$out"/libexec/gcc/*/*/* -type f -a \! -name '*.la'); do
PREV_RPATH=`patchelf --print-rpath "$i"`
NEW_RPATH=`echo "$PREV_RPATH" | sed 's,:[^:]*bootstrap-tools/lib,,g'`
patchelf --set-rpath "$NEW_RPATH" "$i" && echo OK
done
fi
if [[ targetConfig == *"linux"* ]]; then
# For some reason, when building for linux on darwin, the libs retain
# RPATH to $out.
for i in "$lib"/"$targetConfig"/lib/{libtsan,libasan,libubsan}.so.*.*.*; do
PREV_RPATH=`patchelf --print-rpath "$i"`
NEW_RPATH=`echo "$PREV_RPATH" | sed "s,:${out}[^:]*,,g"`
patchelf --set-rpath "$NEW_RPATH" "$i" && echo OK
done
fi
if type "install_name_tool"; then
for i in "${!outputLib}"/lib/*.*.dylib "${!outputLib}"/lib/*.so.[0-9]; do
install_name_tool -id "$i" "$i" || true
+2 -2
View File
@@ -45,11 +45,11 @@ let
in
stdenv.mkDerivation rec {
pname = "go";
version = "1.19.4";
version = "1.19.5";
src = fetchurl {
url = "https://go.dev/dl/go${version}.src.tar.gz";
sha256 = "sha256-7adNtKxJSACj5m7nhOSVv7ubjlNd+SSosBsagCi382g=";
sha256 = "sha256-jkhujoWigfxc4/C+3FudLb9idtfbCyXT7ANPMT2gN18=";
};
strictDeps = true;
@@ -1,12 +1,9 @@
{ lib, writeShellApplication, cargo, cargo-auditable }:
{ lib, writeShellScriptBin, cargo, cargo-auditable }:
(writeShellApplication {
name = "cargo";
runtimeInputs = [ cargo cargo-auditable ];
text = ''
CARGO_AUDITABLE_IGNORE_UNSUPPORTED=1 cargo auditable "$@"
'';
}) // {
(writeShellScriptBin "cargo" ''
export PATH="${lib.makeBinPath [ cargo cargo-auditable ]}:$PATH"
CARGO_AUDITABLE_IGNORE_UNSUPPORTED=1 exec cargo auditable "$@"
'') // {
meta = cargo-auditable.meta // {
mainProgram = "cargo";
};
@@ -0,0 +1,651 @@
{ lib
, stdenv
, callPackage
, cmake
, coreutils
, gnugrep
, perl
, ninja
, pkg-config
, clang
, bintools
, python3
, git
, fetchpatch
, makeWrapper
, gnumake
, file
, runCommand
, writeShellScriptBin
# For lldb
, libedit
, ncurses
, swig
, libxml2
# Linux-specific
, glibc
, libuuid
# Darwin-specific
, substituteAll
, fixDarwinDylibNames
, runCommandLocal
, xcbuild
, cctools # libtool
, sigtool
, DarwinTools
, CoreServices
, Foundation
, Combine
, CLTools_Executables
}:
let
inherit (stdenv) hostPlatform targetPlatform;
sources = callPackage ../sources.nix { };
# Tools invoked by swift at run-time.
runtimeDeps = lib.optionals stdenv.isDarwin [
# libtool is used for static linking. This is part of cctools, but adding
# that as a build input puts an unwrapped linker in PATH, and breaks
# builds. This small derivation exposes just libtool.
# NOTE: The same applies to swift-driver, but that is currently always
# invoked via the old `swift` / `swiftc`. May change in the future.
(runCommandLocal "libtool" { } ''
mkdir -p $out/bin
ln -s ${cctools}/bin/libtool $out/bin/libtool
'')
];
# There are apparently multiple naming conventions on Darwin. Swift uses the
# xcrun naming convention. See `configure_sdk_darwin` calls in CMake files.
swiftOs = if targetPlatform.isDarwin
then {
"macos" = "macosx";
"ios" = "iphoneos";
#iphonesimulator
#appletvos
#appletvsimulator
#watchos
#watchsimulator
}.${targetPlatform.darwinPlatform}
or (throw "Cannot build Swift for target Darwin platform '${targetPlatform.darwinPlatform}'")
else targetPlatform.parsed.kernel.name;
# Apple Silicon uses a different CPU name in the target triple.
swiftArch = if stdenv.isDarwin && stdenv.isAarch64 then "arm64"
else targetPlatform.parsed.cpu.name;
# On Darwin, a `.swiftmodule` is a subdirectory in `lib/swift/<OS>`,
# containing binaries for supported archs. On other platforms, binaries are
# installed to `lib/swift/<OS>/<ARCH>`. Note that our setup-hook also adds
# `lib/swift` for convenience.
swiftLibSubdir = "lib/swift/${swiftOs}";
swiftModuleSubdir = if hostPlatform.isDarwin
then "lib/swift/${swiftOs}"
else "lib/swift/${swiftOs}/${swiftArch}";
# And then there's also a separate subtree for statically linked modules.
toStaticSubdir = lib.replaceStrings [ "/swift/" ] [ "/swift_static/" ];
swiftStaticLibSubdir = toStaticSubdir swiftLibSubdir;
swiftStaticModuleSubdir = toStaticSubdir swiftModuleSubdir;
# This matches _SWIFT_DEFAULT_COMPONENTS, with specific components disabled.
swiftInstallComponents = [
"autolink-driver"
"compiler"
# "clang-builtin-headers"
"stdlib"
"sdk-overlay"
"parser-lib"
"static-mirror-lib"
"editor-integration"
# "tools"
# "testsuite-tools"
"toolchain-tools"
"toolchain-dev-tools"
"license"
(if stdenv.isDarwin then "sourcekit-xpc-service" else "sourcekit-inproc")
"swift-remote-mirror"
"swift-remote-mirror-headers"
];
# Build a tool used during the build to create a custom clang wrapper, with
# which we wrap the clang produced by the swift build.
#
# This is used in a `POST_BUILD` for the CMake target, so we rename the
# actual clang to clang-unwrapped, then put the wrapper in place.
#
# We replace the `exec ...` command with `exec -a "$0"` in order to
# preserve $0 for clang. This is because, unlike Nix, we don't have
# separate wrappers for clang/clang++, and clang uses $0 to detect C++.
#
# Similarly, the C++ detection in the wrapper itself also won't work for us,
# so we base it on $0 as well.
makeClangWrapper = writeShellScriptBin "nix-swift-make-clang-wrapper" ''
set -euo pipefail
targetFile="$1"
unwrappedClang="$targetFile-unwrapped"
mv "$targetFile" "$unwrappedClang"
sed < '${clang}/bin/clang' > "$targetFile" \
-e 's|^\s*exec|exec -a "$0"|g' \
-e 's|^\[\[ "${clang.cc}/bin/clang" = \*++ ]]|[[ "$0" = *++ ]]|' \
-e "s|${clang.cc}/bin/clang|$unwrappedClang|g"
chmod a+x "$targetFile"
'';
# Create a tool used during the build to create a custom swift wrapper for
# each of the swift executables produced by the build.
#
# The build produces several `swift-frontend` executables during
# bootstrapping. Each of these has numerous aliases via symlinks, and the
# executable uses $0 to detect what tool is called.
wrapperParams = {
inherit bintools;
default_cc_wrapper = clang; # Instead of `@out@` in the original.
coreutils_bin = lib.getBin coreutils;
gnugrep_bin = gnugrep;
suffixSalt = lib.replaceStrings ["-" "."] ["_" "_"] targetPlatform.config;
use_response_file_by_default = 1;
swiftDriver = "";
# NOTE: @prog@ needs to be filled elsewhere.
};
swiftWrapper = runCommand "swift-wrapper.sh" wrapperParams ''
substituteAll '${../wrapper/wrapper.sh}' "$out"
'';
makeSwiftcWrapper = writeShellScriptBin "nix-swift-make-swift-wrapper" ''
set -euo pipefail
targetFile="$1"
unwrappedSwift="$targetFile-unwrapped"
mv "$targetFile" "$unwrappedSwift"
sed < '${swiftWrapper}' > "$targetFile" \
-e "s|@prog@|'$unwrappedSwift'|g" \
-e 's|exec "$prog"|exec -a "$0" "$prog"|g'
chmod a+x "$targetFile"
'';
in stdenv.mkDerivation {
pname = "swift";
inherit (sources) version;
outputs = [ "out" "lib" "dev" "doc" "man" ];
nativeBuildInputs = [
cmake
git
ninja
perl # pod2man
pkg-config
python3
makeWrapper
makeClangWrapper
makeSwiftcWrapper
]
++ lib.optionals stdenv.isDarwin [
xcbuild
sigtool # codesign
DarwinTools # sw_vers
fixDarwinDylibNames
];
buildInputs = [
# For lldb
python3
swig
libxml2
]
++ lib.optionals stdenv.isLinux [
libuuid
]
++ lib.optionals stdenv.isDarwin [
CoreServices
Foundation
Combine
];
# This is a partial reimplementation of our setup hook. Because we reuse
# the Swift wrapper for the Swift build itself, we need to do some of the
# same preparation.
postHook = ''
for pkg in "''${pkgsHostTarget[@]}" '${clang.libc}'; do
for subdir in ${swiftModuleSubdir} ${swiftStaticModuleSubdir} lib/swift; do
if [[ -d "$pkg/$subdir" ]]; then
export NIX_SWIFTFLAGS_COMPILE+=" -I $pkg/$subdir"
fi
done
for subdir in ${swiftLibSubdir} ${swiftStaticLibSubdir} lib/swift; do
if [[ -d "$pkg/$subdir" ]]; then
export NIX_LDFLAGS+=" -L $pkg/$subdir"
fi
done
done
'';
# We invoke cmakeConfigurePhase multiple times, but only need this once.
dontFixCmake = true;
# We setup custom build directories.
dontUseCmakeBuildDir = true;
unpackPhase = let
copySource = repo: "cp -r ${sources.${repo}} ${repo}";
in ''
mkdir src
cd src
${copySource "swift-cmark"}
${copySource "llvm-project"}
${copySource "swift"}
${copySource "swift-experimental-string-processing"}
${lib.optionalString
(!stdenv.isDarwin)
(copySource "swift-corelibs-libdispatch")}
chmod -R u+w .
'';
patchPhase = ''
# Just patch all the things for now, we can focus this later.
# TODO: eliminate use of env.
find -type f -print0 | xargs -0 sed -i \
${lib.optionalString stdenv.isDarwin
"-e 's|/usr/libexec/PlistBuddy|${xcbuild}/bin/PlistBuddy|g'"} \
-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'
patch -p1 -d swift -i ${./patches/swift-wrap.patch}
patch -p1 -d swift -i ${./patches/swift-nix-resource-root.patch}
patch -p1 -d swift -i ${./patches/swift-linux-fix-linking.patch}
patch -p1 -d swift -i ${./patches/swift-darwin-fix-bootstrap.patch}
patch -p1 -d swift -i ${substituteAll {
src = ./patches/swift-darwin-plistbuddy-workaround.patch;
inherit swiftArch;
}}
patch -p1 -d swift -i ${substituteAll {
src = ./patches/swift-prevent-sdk-dirs-warning.patch;
inherit (builtins) storeDir;
}}
substituteInPlace swift/cmake/modules/SwiftConfigureSDK.cmake \
--replace '/usr/include' "${stdenv.cc.libc_dev}/include"
# This patch needs to know the lib output location, so must be substituted
# in the same derivation as the compiler.
storeDir="${builtins.storeDir}" \
substituteAll ${./patches/swift-separate-lib.patch} $TMPDIR/swift-separate-lib.patch
patch -p1 -d swift -i $TMPDIR/swift-separate-lib.patch
patch -p1 -d llvm-project/llvm -i ${./patches/llvm-module-cache.patch}
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 ${../../llvm/14/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";
}}
${lib.optionalString stdenv.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";'
# 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
''}
# Remove tests for cross compilation, which we don't currently support.
rm swift/test/Interop/Cxx/class/constructors-copy-irgen.swift
rm swift/test/Interop/Cxx/class/constructors-irgen.swift
# TODO: consider fixing and re-adding. This test fails due to a non-standard "install_prefix".
rm swift/validation-test/Python/build_swift.swift
# We cannot handle the SDK location being in "Weird Location" due to Nix isolation.
rm swift/test/DebugInfo/compiler-flags.swift
# TODO: Fix issue with ld.gold invoked from script finding crtbeginS.o and crtendS.o.
rm swift/test/IRGen/ELF-remove-autolink-section.swift
# The following two tests fail because we use don't use the bundled libicu:
# [SOURCE_DIR/utils/build-script] ERROR: can't find source directory for libicu (tried /build/src/icu)
rm swift/validation-test/BuildSystem/default_build_still_performs_epilogue_opts_after_split.test
rm swift/validation-test/BuildSystem/test_early_swift_driver_and_infer.swift
# TODO: This test fails for some unknown reason
rm swift/test/Serialization/restrict-swiftmodule-to-revision.swift
# This test was flaky in ofborg, see #186476
rm swift/test/AutoDiff/compiler_crashers_fixed/sr14290-missing-debug-scopes-in-pullback-trampoline.swift
patchShebangs .
${lib.optionalString (!stdenv.isDarwin) ''
# NOTE: This interferes with ABI stability on Darwin, which uses the system
# libraries in the hardcoded path /usr/lib/swift.
fixCmakeFiles .
''}
'';
configurePhase = ''
export SWIFT_SOURCE_ROOT="$PWD"
mkdir -p ../build
cd ../build
export SWIFT_BUILD_ROOT="$PWD"
# Most builds set a target, but LLDB doesn't. Harmless on non-Darwin.
export MACOSX_DEPLOYMENT_TARGET=10.15
'';
# These steps are derived from doing a normal build with.
#
# ./swift/utils/build-toolchain test --dry-run
#
# But dealing with the custom Python build system is far more trouble than
# simply invoking CMake directly. Few variables it passes to CMake are
# actually required or non-default.
#
# Using CMake directly also allows us to split up the already large build,
# and package Swift components separately.
#
# Besides `--dry-run`, another good way to compare build changes between
# Swift releases is to diff the scripts:
#
# git diff swift-5.6.3-RELEASE..swift-5.7-RELEASE -- utils/build*
#
buildPhase = ''
# Helper to build a subdirectory.
#
# Always reset cmakeFlags before calling this. The cmakeConfigurePhase
# amends flags and would otherwise keep expanding it.
function buildProject() {
mkdir -p $SWIFT_BUILD_ROOT/$1
cd $SWIFT_BUILD_ROOT/$1
cmakeDir=$SWIFT_SOURCE_ROOT/''${2-$1}
cmakeConfigurePhase
ninjaBuildPhase
}
cmakeFlags="-GNinja"
buildProject swift-cmark
# Some notes:
# - The Swift build just needs Clang.
# - We can further reduce targets to just our targetPlatform.
cmakeFlags="
-GNinja
-DLLVM_ENABLE_PROJECTS=clang
-DLLVM_TARGETS_TO_BUILD=${{
"x86_64" = "X86";
"aarch64" = "AArch64";
}.${targetPlatform.parsed.cpu.name}}
"
buildProject llvm llvm-project/llvm
# Some notes:
# - Building with libswift defaults to OFF in CMake, but is enabled in
# standard builds, so we enable it as well.
# - Experimental features are OFF by default in CMake, but some are
# required to build the stdlib.
# - SWIFT_STDLIB_ENABLE_OBJC_INTEROP is set explicitely because its check
# is buggy. (Uses SWIFT_HOST_VARIANT_SDK before initialized.)
# Fixed in: https://github.com/apple/swift/commit/84083afef1de5931904d5c815d53856cdb3fb232
cmakeFlags="
-GNinja
-DBOOTSTRAPPING_MODE=BOOTSTRAPPING
-DSWIFT_ENABLE_EXPERIMENTAL_CONCURRENCY=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
-DSWIFT_PATH_TO_CMARK_BUILD=$SWIFT_BUILD_ROOT/swift-cmark
-DSWIFT_PATH_TO_LIBDISPATCH_SOURCE=$SWIFT_SOURCE_ROOT/swift-corelibs-libdispatch
-DEXPERIMENTAL_STRING_PROCESSING_SOURCE_DIR=$SWIFT_SOURCE_ROOT/swift-experimental-string-processing
-DSWIFT_INSTALL_COMPONENTS=${lib.concatStringsSep ";" swiftInstallComponents}
-DSWIFT_STDLIB_ENABLE_OBJC_INTEROP=${if stdenv.isDarwin then "ON" else "OFF"}
"
buildProject swift
# These are based on flags in `utils/build-script-impl`.
#
# LLDB_USE_SYSTEM_DEBUGSERVER=ON disables the debugserver build on Darwin,
# which requires a special signature.
#
# CMAKE_BUILD_WITH_INSTALL_NAME_DIR ensures we don't use rpath on Darwin.
#
# NOTE: On Darwin, we only want ncurses in the linker search path, because
# headers are part of libsystem. Adding its headers to the search path
# causes strange mixing and errors. Note that libedit propagates ncurses,
# so we add both manually here, instead of relying on setup hooks.
# TODO: Find a better way to prevent this conflict.
cmakeFlags="
-GNinja
-DLLDB_SWIFTC=$SWIFT_BUILD_ROOT/swift/bin/swiftc
-DLLDB_SWIFT_LIBS=$SWIFT_BUILD_ROOT/swift/lib/swift
-DLLVM_DIR=$SWIFT_BUILD_ROOT/llvm/lib/cmake/llvm
-DClang_DIR=$SWIFT_BUILD_ROOT/llvm/lib/cmake/clang
-DSwift_DIR=$SWIFT_BUILD_ROOT/swift/lib/cmake/swift
-DLLDB_ENABLE_CURSES=ON
-DLLDB_ENABLE_LIBEDIT=ON
-DLLDB_ENABLE_PYTHON=ON
-DLLDB_ENABLE_LZMA=OFF
-DLLDB_ENABLE_LUA=OFF
-DLLDB_INCLUDE_TESTS=OFF
-DCMAKE_BUILD_WITH_INSTALL_NAME_DIR=ON
${lib.optionalString stdenv.isDarwin ''
-DLLDB_USE_SYSTEM_DEBUGSERVER=ON
''}
-DLibEdit_INCLUDE_DIRS=${libedit.dev}/include
-DLibEdit_LIBRARIES=${libedit}/lib/libedit${stdenv.hostPlatform.extensions.sharedLibrary}
-DCURSES_INCLUDE_DIRS=${if stdenv.isDarwin then "/var/empty" else ncurses.dev}/include
-DCURSES_LIBRARIES=${ncurses}/lib/libncurses${stdenv.hostPlatform.extensions.sharedLibrary}
-DPANEL_LIBRARIES=${ncurses}/lib/libpanel${stdenv.hostPlatform.extensions.sharedLibrary}
";
buildProject lldb llvm-project/lldb
${lib.optionalString stdenv.isDarwin ''
# Need to do a standalone build of concurrency for Darwin back deployment.
# Based on: utils/swift_build_support/swift_build_support/products/backdeployconcurrency.py
cmakeFlags="
-GNinja
-DCMAKE_Swift_COMPILER=$SWIFT_BUILD_ROOT/swift/bin/swiftc
-DTOOLCHAIN_DIR=/var/empty
-DSWIFT_NATIVE_LLVM_TOOLS_PATH=${stdenv.cc}/bin
-DSWIFT_NATIVE_CLANG_TOOLS_PATH=${stdenv.cc}/bin
-DSWIFT_NATIVE_SWIFT_TOOLS_PATH=$SWIFT_BUILD_ROOT/swift/bin
-DCMAKE_CROSSCOMPILING=ON
-DBUILD_SWIFT_CONCURRENCY_BACK_DEPLOYMENT_LIBRARIES=ON
-DSWIFT_INCLUDE_TOOLS=OFF
-DSWIFT_BUILD_STDLIB_EXTRA_TOOLCHAIN_CONTENT=OFF
-DSWIFT_BUILD_TEST_SUPPORT_MODULES=OFF
-DSWIFT_BUILD_STDLIB=OFF
-DSWIFT_BUILD_DYNAMIC_STDLIB=OFF
-DSWIFT_BUILD_STATIC_STDLIB=OFF
-DSWIFT_BUILD_REMOTE_MIRROR=OFF
-DSWIFT_BUILD_SDK_OVERLAY=OFF
-DSWIFT_BUILD_DYNAMIC_SDK_OVERLAY=OFF
-DSWIFT_BUILD_STATIC_SDK_OVERLAY=OFF
-DSWIFT_INCLUDE_TESTS=OFF
-DSWIFT_BUILD_PERF_TESTSUITE=OFF
-DSWIFT_HOST_VARIANT_ARCH=${swiftArch}
-DBUILD_STANDALONE=ON
-DSWIFT_INSTALL_COMPONENTS=back-deployment
-DSWIFT_SDKS=${{
"macos" = "OSX";
"ios" = "IOS";
#IOS_SIMULATOR
#TVOS
#TVOS_SIMULATOR
#WATCHOS
#WATCHOS_SIMULATOR
}.${targetPlatform.darwinPlatform}}
-DLLVM_DIR=$SWIFT_BUILD_ROOT/llvm/lib/cmake/llvm
-DSWIFT_DEST_ROOT=$out
-DSWIFT_HOST_VARIANT_SDK=OSX
-DSWIFT_DARWIN_DEPLOYMENT_VERSION_OSX=10.15
-DSWIFT_DARWIN_DEPLOYMENT_VERSION_IOS=13.0
-DSWIFT_DARWIN_DEPLOYMENT_VERSION_MACCATALYST=13.0
-DSWIFT_DARWIN_DEPLOYMENT_VERSION_TVOS=13.0
-DSWIFT_DARWIN_DEPLOYMENT_VERSION_WATCHOS=6.0
"
# This depends on the special Clang build specific to the Swift branch.
# We also need to call a specific Ninja target.
export CC=$SWIFT_BUILD_ROOT/llvm/bin/clang
export CXX=$SWIFT_BUILD_ROOT/llvm/bin/clang++
ninjaFlags="back-deployment"
buildProject swift-concurrency-backdeploy swift
export CC=$NIX_CC/bin/clang
export CXX=$NIX_CC/bin/clang++
unset ninjaFlags
''}
'';
# TODO: ~50 failing tests on x86_64-linux. Other platforms not checked.
doCheck = false;
checkInputs = [ file ];
# TODO: consider using stress-tester and integration-test.
checkPhase = ''
cd $SWIFT_BUILD_ROOT/swift
checkTarget=check-swift-all
ninjaCheckPhase
unset checkTarget
'';
installPhase = ''
# 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-14{-unwrapped,}
mv swift/bin/swift-frontend{-unwrapped,}
mkdir $out $lib
# Install clang binaries only. We hide these with the wrapper, so they are
# for private use by Swift only.
cd $SWIFT_BUILD_ROOT/llvm
installTargets=install-clang
ninjaInstallPhase
unset installTargets
# LLDB is also a private install.
cd $SWIFT_BUILD_ROOT/lldb
ninjaInstallPhase
cd $SWIFT_BUILD_ROOT/swift
ninjaInstallPhase
${lib.optionalString stdenv.isDarwin ''
cd $SWIFT_BUILD_ROOT/swift-concurrency-backdeploy
installTargets=install-back-deployment
ninjaInstallPhase
unset installTargets
''}
# Separate $lib output here, because specific logic follows.
# Only move the dynamic run-time parts, to keep $lib small. Every Swift
# build will depend on it.
moveToOutput "lib/swift" "$lib"
moveToOutput "lib/libswiftDemangle.*" "$lib"
# This link is here because various tools (swiftpm) check for stdlib
# relative to the swift compiler. It's fine if this is for build-time
# stuff, but we should patch all cases were it would end up in an output.
ln -s $lib/lib/swift $out/lib/swift
# Swift has a separate resource root from Clang, but locates the Clang
# resource root via subdir or symlink. Provide a default here, but we also
# patch Swift to prefer NIX_CC if set.
ln -s ${clang}/resource-root $lib/lib/swift/clang
${lib.optionalString stdenv.isDarwin ''
# Install required library for ObjC interop.
# TODO: Is there no source code for this available?
cp -r ${CLTools_Executables}/usr/lib/arc $out/lib/arc
''}
'';
preFixup = lib.optionalString stdenv.isLinux ''
# This is cheesy, but helps the patchelf hook remove /build from RPATH.
cd $SWIFT_BUILD_ROOT/..
mv build buildx
'';
postFixup = lib.optionalString stdenv.isDarwin ''
# These libraries need to use the system install name. The official SDK
# does the same (as opposed to using rpath). Presumably, they are part of
# the stable ABI. Not using the system libraries at run-time is known to
# cause ObjC class conflicts and segfaults.
declare -A systemLibs=(
[libswiftCore.dylib]=1
[libswiftDarwin.dylib]=1
[libswiftSwiftOnoneSupport.dylib]=1
[libswift_Concurrency.dylib]=1
)
for systemLib in "''${!systemLibs[@]}"; do
install_name_tool -id /usr/lib/swift/$systemLib $lib/${swiftLibSubdir}/$systemLib
done
for file in $out/bin/swift-frontend $lib/${swiftLibSubdir}/*.dylib; do
changeArgs=""
for dylib in $(otool -L $file | awk '{ print $1 }'); do
if [[ ''${systemLibs["$(basename $dylib)"]} ]]; then
changeArgs+=" -change $dylib /usr/lib/swift/$(basename $dylib)"
elif [[ "$dylib" = */bootstrapping1/* ]]; then
changeArgs+=" -change $dylib $lib/lib/swift/$(basename $dylib)"
fi
done
if [[ -n "$changeArgs" ]]; then
install_name_tool $changeArgs $file
fi
done
wrapProgram $out/bin/swift-frontend \
--prefix PATH : ${lib.makeBinPath runtimeDeps}
'';
passthru = {
inherit
swiftOs swiftArch
swiftModuleSubdir swiftLibSubdir
swiftStaticModuleSubdir swiftStaticLibSubdir;
# Internal attr for the wrapper.
_wrapperParams = wrapperParams;
};
meta = {
description = "The Swift Programming Language";
homepage = "https://github.com/apple/swift";
maintainers = with lib.maintainers; [ dtzWill trepetti dduan trundle stephank ];
license = lib.licenses.asl20;
platforms = with lib.platforms; linux ++ darwin;
# Swift doesn't support 32-bit Linux, unknown on other platforms.
badPlatforms = lib.platforms.i686;
timeout = 86400; # 24 hours.
};
}
@@ -0,0 +1,18 @@
Wrap the clang produced during the build
--- a/tools/driver/CMakeLists.txt
+++ b/tools/driver/CMakeLists.txt
@@ -59,6 +59,13 @@ endif()
add_dependencies(clang clang-resource-headers)
+# Nix: wrap the clang build.
+add_custom_command(
+ TARGET clang POST_BUILD
+ COMMAND nix-swift-make-clang-wrapper $<TARGET_FILE:clang>
+ VERBATIM
+)
+
if(NOT CLANG_LINKS_TO_CREATE)
set(CLANG_LINKS_TO_CREATE clang++ clang-cl clang-cpp)
endif()
@@ -0,0 +1,30 @@
The compiler fails if LLVM modules are enabled and it cannot write its module
cache. This patch detects and rejects the fake, non-existant $HOME used in Nix
builds.
We could simply return false in `cache_directory`, but that completely disables
module caching, and may unnecessarily slow down builds. Instead, let it use
'/tmp/.cache'.
--- a/lib/Support/Unix/Path.inc
+++ b/lib/Support/Unix/Path.inc
@@ -1380,6 +1380,9 @@ bool user_config_directory(SmallVectorImpl<char> &result) {
if (!home_directory(result)) {
return false;
}
+ if (std::equal(result.begin(), result.end(), "/homeless-shelter")) {
+ return false;
+ }
append(result, ".config");
return true;
}
@@ -1401,6 +1404,9 @@ bool cache_directory(SmallVectorImpl<char> &result) {
if (!home_directory(result)) {
return false;
}
+ if (std::equal(result.begin(), result.end(), "/homeless-shelter")) {
+ system_temp_directory(true/*ErasedOnReboot*/, result);
+ }
append(result, ".cache");
return true;
}
@@ -0,0 +1,20 @@
This patch fixes dylib references during bootstrapping. It's possible
`LIBSWIFT_BUILD_MODE=BOOTSTRAPPING` is not really well tested on Darwin,
because official builds don't use it.
In the near future, Swift will require an existing Swift toolchain to
bootstrap, and we will likely have to replace this any way.
--- a/stdlib/cmake/modules/AddSwiftStdlib.cmake
+++ b/stdlib/cmake/modules/AddSwiftStdlib.cmake
@@ -1035,6 +1035,10 @@ function(add_swift_target_library_single target name)
set(install_name_dir "${SWIFTLIB_SINGLE_DARWIN_INSTALL_NAME_DIR}")
endif()
+ if(DEFINED SWIFTLIB_SINGLE_BOOTSTRAPPING)
+ set(install_name_dir "${lib_dir}/${output_sub_dir}")
+ endif()
+
set_target_properties("${target}"
PROPERTIES
INSTALL_NAME_DIR "${install_name_dir}")
@@ -0,0 +1,17 @@
CMake tries to read a list field from SDKSettings.plist, but the output of
facebook/xcbuild PlistBuddy is incompatible with Apple's.
Simply set the supported architectures to the one target architecture we're
building for.
--- a/cmake/modules/SwiftConfigureSDK.cmake
+++ b/cmake/modules/SwiftConfigureSDK.cmake
@@ -189,7 +189,7 @@ macro(configure_sdk_darwin
endif()
# Remove any architectures not supported by the SDK.
- remove_sdk_unsupported_archs(${name} ${xcrun_name} ${SWIFT_SDK_${prefix}_PATH} SWIFT_SDK_${prefix}_ARCHITECTURES)
+ set(SWIFT_SDK_${prefix}_ARCHITECTURES "@swiftArch@")
list_intersect(
"${SWIFT_DARWIN_MODULE_ARCHS}" # lhs
@@ -0,0 +1,21 @@
--- a/lib/Driver/ToolChains.cpp
+++ b/lib/Driver/ToolChains.cpp
@@ -1475,7 +1475,17 @@ const char *ToolChain::getClangLinkerDriver(
// If there is a linker driver in the toolchain folder, use that instead.
if (auto tool = llvm::sys::findProgramByName(LinkerDriver, {toolchainPath}))
- LinkerDriver = Args.MakeArgString(tool.get());
+ return Args.MakeArgString(tool.get());
+ }
+
+ // For Nix, prefer linking using the wrapped system clang, instead of using
+ // the unwrapped clang packaged with swift. The latter is unable to link, but
+ // we still want to use it for other purposes (clang importer).
+ if (auto nixCC = llvm::sys::Process::GetEnv("NIX_CC")) {
+ llvm::SmallString<128> binDir(nixCC.getValue());
+ llvm::sys::path::append(binDir, "bin");
+ if (auto tool = llvm::sys::findProgramByName(LinkerDriver, {binDir.str()}))
+ return Args.MakeArgString(tool.get());
}
return LinkerDriver;
@@ -0,0 +1,67 @@
Swift normally looks for the Clang resource dir in a subdir/symlink of its own
resource dir. We provide a symlink to the Swift build-time Clang as a default
there, but we also here patch two checks to try locate it via NIX_CC.
The first (ClangImporter.cpp) happens when Swift code imports C modules. The
second (ToolChains.cpp) happens when Swift is used to link the final product.
--- a/lib/ClangImporter/ClangImporter.cpp
+++ b/lib/ClangImporter/ClangImporter.cpp
@@ -68,6 +68,7 @@
#include "llvm/Support/FileSystem.h"
#include "llvm/Support/Memory.h"
#include "llvm/Support/Path.h"
+#include "llvm/Support/Process.h"
#include "llvm/Support/YAMLParser.h"
#include "llvm/Support/YAMLTraits.h"
#include <algorithm>
@@ -809,6 +810,17 @@ importer::addCommonInvocationArguments(
const std::string &overrideResourceDir = importerOpts.OverrideResourceDir;
if (overrideResourceDir.empty()) {
+ // Prefer the Clang resource directory from NIX_CC, to allow swapping in a
+ // different stdenv.
+ // TODO: Figure out how to provide a user override for this. Probably a
+ // niche use case, though, and for now a user can unset NIX_CC to work
+ // around it if necessary.
+ if (auto nixCC = llvm::sys::Process::GetEnv("NIX_CC")) {
+ llvm::SmallString<128> resourceDir(nixCC.getValue());
+ llvm::sys::path::append(resourceDir, "resource-root");
+ invocationArgStrs.push_back("-resource-dir");
+ invocationArgStrs.push_back(std::string(resourceDir.str()));
+ } else {
llvm::SmallString<128> resourceDir(searchPathOpts.RuntimeResourcePath);
// Adjust the path to refer to our copy of the Clang resource directory
@@ -824,6 +836,7 @@ importer::addCommonInvocationArguments(
// Set the Clang resource directory to the path we computed.
invocationArgStrs.push_back("-resource-dir");
invocationArgStrs.push_back(std::string(resourceDir.str()));
+ } // nixCC
} else {
invocationArgStrs.push_back("-resource-dir");
invocationArgStrs.push_back(overrideResourceDir);
--- a/lib/Driver/ToolChains.cpp
+++ b/lib/Driver/ToolChains.cpp
@@ -1372,10 +1372,20 @@ void ToolChain::getClangLibraryPath(const ArgList &Args,
SmallString<128> &LibPath) const {
const llvm::Triple &T = getTriple();
+ // Nix: We provide a `clang` symlink in the default Swift resource root, but
+ // prefer detecting the Clang resource root via NIX_CC, to allow swapping in
+ // a different stdenv. However, always honor a user-provided `-resource-dir`.
+ auto nixCC = llvm::sys::Process::GetEnv("NIX_CC");
+ if (nixCC && !Args.hasArgNoClaim(options::OPT_resource_dir)) {
+ LibPath.assign(nixCC.getValue());
+ llvm::sys::path::append(LibPath, "resource-root");
+ } else {
getResourceDirPath(LibPath, Args, /*Shared=*/true);
// Remove platform name.
llvm::sys::path::remove_filename(LibPath);
- llvm::sys::path::append(LibPath, "clang", "lib",
+ llvm::sys::path::append(LibPath, "clang");
+ } // nixCC
+ llvm::sys::path::append(LibPath, "lib",
T.isOSDarwin() ? "darwin"
: getPlatformNameForTriple(T));
}
@@ -0,0 +1,39 @@
Prevents a user-visible warning on every compilation:
ld: warning: directory not found for option '-L.../MacOSX11.0.sdk/usr/lib/swift'
--- a/lib/Driver/ToolChains.cpp
+++ b/lib/Driver/ToolChains.cpp
@@ -1455,9 +1455,11 @@ void ToolChain::getRuntimeLibraryPaths(SmallVectorImpl<std::string> &runtimeLibP
runtimeLibPaths.push_back(std::string(scratchPath.str()));
}
+ if (!SDKPath.startswith("@storeDir@")) {
scratchPath = SDKPath;
llvm::sys::path::append(scratchPath, "usr", "lib", "swift");
runtimeLibPaths.push_back(std::string(scratchPath.str()));
+ }
}
}
--- a/lib/Frontend/CompilerInvocation.cpp
+++ b/lib/Frontend/CompilerInvocation.cpp
@@ -185,7 +185,9 @@ static void updateRuntimeLibraryPaths(SearchPathOptions &SearchPathOpts,
RuntimeLibraryImportPaths.push_back(std::string(LibPath.str()));
}
- LibPath = SearchPathOpts.getSDKPath();
+ auto SDKPath = SearchPathOpts.getSDKPath();
+ if (!SDKPath.startswith("@storeDir@")) {
+ LibPath = SDKPath;
llvm::sys::path::append(LibPath, "usr", "lib", "swift");
if (!Triple.isOSDarwin()) {
// Use the non-architecture suffixed form with directory-layout
@@ -200,6 +202,7 @@ static void updateRuntimeLibraryPaths(SearchPathOptions &SearchPathOpts,
llvm::sys::path::append(LibPath, swift::getMajorArchitectureName(Triple));
}
RuntimeLibraryImportPaths.push_back(std::string(LibPath.str()));
+ }
}
SearchPathOpts.setRuntimeLibraryImportPaths(RuntimeLibraryImportPaths);
}
@@ -0,0 +1,26 @@
Patch paths to use the separate 'lib' output. One of the things this patch
fixes is the output of `swift -frontend -print-target-info`, which swiftpm uses
to set rpath on Linux.
The check if the executable path starts with 'out' is necessary for
bootstrapping, or the compiler will fail when run from the build directory.
--- a/lib/Frontend/CompilerInvocation.cpp
+++ b/lib/Frontend/CompilerInvocation.cpp
@@ -49,11 +49,16 @@ swift::CompilerInvocation::CompilerInvocation() {
void CompilerInvocation::computeRuntimeResourcePathFromExecutablePath(
StringRef mainExecutablePath, bool shared,
llvm::SmallVectorImpl<char> &runtimeResourcePath) {
+ if (mainExecutablePath.startswith("@storeDir@")) {
+ auto libPath = StringRef("@lib@");
+ runtimeResourcePath.append(libPath.begin(), libPath.end());
+ } else {
runtimeResourcePath.append(mainExecutablePath.begin(),
mainExecutablePath.end());
llvm::sys::path::remove_filename(runtimeResourcePath); // Remove /swift
llvm::sys::path::remove_filename(runtimeResourcePath); // Remove /bin
+ }
appendSwiftLibDir(runtimeResourcePath, shared);
}
@@ -0,0 +1,46 @@
Wrap the swift compiler produced during the build
--- a/tools/driver/CMakeLists.txt
+++ b/tools/driver/CMakeLists.txt
@@ -16,6 +16,13 @@ if(${LIBSWIFT_BUILD_MODE} MATCHES "BOOTSTRAPPING.*")
swiftDriverTool
libswiftStub)
+ # Nix: wrap the swift build.
+ add_custom_command(
+ TARGET swift-frontend-bootstrapping0 POST_BUILD
+ COMMAND nix-swift-make-swift-wrapper $<TARGET_FILE:swift-frontend-bootstrapping0>
+ VERBATIM
+ )
+
swift_create_post_build_symlink(swift-frontend-bootstrapping0
SOURCE "swift-frontend${CMAKE_EXECUTABLE_SUFFIX}"
DESTINATION "swiftc${CMAKE_EXECUTABLE_SUFFIX}"
@@ -34,6 +41,13 @@ if(${LIBSWIFT_BUILD_MODE} MATCHES "BOOTSTRAPPING.*")
swiftDriverTool
libswift-bootstrapping1)
+ # Nix: wrap the swift build.
+ add_custom_command(
+ TARGET swift-frontend-bootstrapping1 POST_BUILD
+ COMMAND nix-swift-make-swift-wrapper $<TARGET_FILE:swift-frontend-bootstrapping1>
+ VERBATIM
+ )
+
swift_create_post_build_symlink(swift-frontend-bootstrapping1
SOURCE "swift-frontend${CMAKE_EXECUTABLE_SUFFIX}"
DESTINATION "swiftc${CMAKE_EXECUTABLE_SUFFIX}"
@@ -50,6 +64,13 @@ target_link_libraries(swift-frontend
swiftDriverTool
libswift)
+# Nix: wrap the swift build.
+add_custom_command(
+ TARGET swift-frontend POST_BUILD
+ COMMAND nix-swift-make-swift-wrapper $<TARGET_FILE:swift-frontend>
+ VERBATIM
+)
+
# Create a `swift-driver` executable adjacent to the `swift-frontend` executable
# to ensure that `swiftc` forwards to the standalone driver when invoked.
swift_create_early_driver_copies(swift-frontend)
+95 -469
View File
@@ -1,475 +1,101 @@
{ lib, stdenv
, cmake
, coreutils
, glibc
, gccForLibs
, which
, perl
, libedit
, ninja
, pkg-config
, sqlite
, libxml2
, clang_13
, python3
, ncurses
, libuuid
, libxcrypt
, icu
, libgcc
, libblocksruntime
, curl
, rsync
, git
, libgit2
, fetchFromGitHub
, makeWrapper
, gnumake
, file
{ lib
, pkgs
, newScope
, darwin
, llvmPackages_latest
, overrideCC
}:
let
# The Swift toolchain script builds projects with separate repos. By convention, some of them share
# the same version with the main Swift compiler project per release. We fetch these with
# `fetchSwiftRelease`. The rest have their own versions locked to each Swift release, as defined in the
# Swift compiler repo:
# utils/update_checkout/update_checkout-config.json.
#
# ... among projects listed in that file, we provide our own:
# - CMake
# - ninja
# - icu
#
# ... we'd like to include the following in the future:
# - stress-tester
# - integration-tests
self = rec {
callPackage = newScope self;
# Current versions of Swift on Darwin require macOS SDK 10.15 at least.
# Re-export this so we can rely on the minimum Swift SDK elsewhere.
apple_sdk = pkgs.darwin.apple_sdk_11_0;
# Our current Clang on Darwin is v11, but we need at least v12. The
# following applies the newer Clang with the same libc overrides as
# `apple_sdk.stdenv`.
#
# If 'latest' becomes an issue, recommend replacing it with v14, which is
# currently closest to the official Swift builds.
clang = if pkgs.stdenv.isDarwin
then
llvmPackages_latest.clang.override rec {
libc = apple_sdk.Libsystem;
bintools = pkgs.bintools.override { inherit libc; };
}
else
llvmPackages_latest.clang;
# Overrides that create a useful environment for swift packages, allowing
# packaging with `swiftPackages.callPackage`. These are similar to
# `apple_sdk_11_0.callPackage`, with our clang on top.
inherit (clang) bintools;
stdenv = overrideCC pkgs.stdenv clang;
darwin = pkgs.darwin.overrideScope (_: prev: {
inherit apple_sdk;
inherit (apple_sdk) Libsystem LibsystemCross libcharset libunwind objc4 configd IOKit Security;
CF = apple_sdk.CoreFoundation;
});
xcodebuild = pkgs.xcbuild.override {
inherit (apple_sdk.frameworks) CoreServices CoreGraphics ImageIO;
inherit stdenv;
sdkVer = "10.15";
};
xcbuild = xcodebuild;
swift-unwrapped = callPackage ./compiler {
inherit (darwin) DarwinTools cctools sigtool;
inherit (apple_sdk) CLTools_Executables;
inherit (apple_sdk.frameworks) CoreServices Foundation Combine;
};
swiftNoSwiftDriver = callPackage ./wrapper {
swift = swift-unwrapped;
useSwiftDriver = false;
};
Dispatch = if stdenv.isDarwin
then null # part of libsystem
else callPackage ./libdispatch { swift = swiftNoSwiftDriver; };
Foundation = if stdenv.isDarwin
then apple_sdk.frameworks.Foundation
else callPackage ./foundation { swift = swiftNoSwiftDriver; };
# TODO: Apple distributes a binary XCTest with Xcode, but it is not part of
# CLTools (or SUS), so would have to figure out how to fetch it. The binary
# version has several extra features, like a test runner and ObjC support.
XCTest = callPackage ./xctest {
inherit (darwin) DarwinTools;
swift = swiftNoSwiftDriver;
};
swiftpm = callPackage ./swiftpm {
inherit (darwin) DarwinTools cctools;
inherit (apple_sdk.frameworks) CryptoKit LocalAuthentication;
swift = swiftNoSwiftDriver;
};
swift-driver = callPackage ./swift-driver {
swift = swiftNoSwiftDriver;
};
swift = callPackage ./wrapper {
swift = swift-unwrapped;
};
sourcekit-lsp = callPackage ./sourcekit-lsp {
inherit (apple_sdk.frameworks) CryptoKit LocalAuthentication;
};
swift-docc = callPackage ./swift-docc {
inherit (apple_sdk.frameworks) CryptoKit LocalAuthentication;
};
versions = {
swift = "5.6.2";
yams = "4.0.2";
argumentParser = "1.0.3";
format = "release/5.6";
crypto = "1.1.5";
nio = "2.31.2";
nio-ssl = "2.15.0";
};
fetchAppleRepo = { repo, rev, sha256 }:
fetchFromGitHub {
owner = "apple";
inherit repo rev sha256;
name = "${repo}-${rev}-src";
};
fetchSwiftRelease = { repo, sha256, fetchSubmodules ? false }:
fetchFromGitHub {
owner = "apple";
inherit repo sha256 fetchSubmodules;
rev = "swift-${versions.swift}-RELEASE";
name = "${repo}-${versions.swift}-src";
};
sources = {
# Projects that share `versions.swift` for each release.
swift = fetchSwiftRelease {
repo = "swift";
sha256 = "sha256-wiRXAXWEksJuy+YQQ+B7tzr2iLkSVkgV6o+wIz7yKJA=";
};
cmark = fetchSwiftRelease {
repo = "swift-cmark";
sha256 = "sha256-f0BoTs4HYdx/aJ9HIGCWMalhl8PvClWD6R4QK3qSgAw=";
};
llbuild = fetchSwiftRelease {
repo = "swift-llbuild";
sha256 = "sha256-SQ6V0zVshIYMjayx+ZpYuLijgQ89tqRnPlXBPf2FYqM=";
};
driver = fetchSwiftRelease {
repo = "swift-driver";
sha256 = "sha256-D5/C4Rbv5KIsKpy6YbuMxGIGaQkn80PD4Cp0l6bPKzY=";
};
toolsSupportCore = fetchSwiftRelease {
repo = "swift-tools-support-core";
sha256 = "sha256-FbtQCq1sSlzrskCrgzD4iYuo5eGaXrAUUxoNX/BiOfg=";
};
swiftpm = fetchSwiftRelease {
repo = "swift-package-manager";
sha256 = "sha256-esO4Swz3UYngbVgxoV+fkhSC0AU3IaxVjWkgK/s3x68=";
};
syntax = fetchSwiftRelease {
repo = "swift-syntax";
sha256 = "sha256-C9FPCtq49BvKXtTWWeReYWNrU70pHzT2DhAv3NiTbPU=";
};
corelibsXctest = fetchSwiftRelease {
repo = "swift-corelibs-xctest";
sha256 = "sha256-0hizfnKJaUUA+jXuXzXWk72FmlSyc+UGEf7BTLdJrx4=";
};
corelibsFoundation = fetchSwiftRelease {
repo = "swift-corelibs-foundation";
sha256 = "sha256-8sCL8Ia6yb6bRsJZ52gUJH0jN3lwClM573G8jgUdEhw=";
};
corelibsLibdispatch = fetchSwiftRelease {
repo = "swift-corelibs-libdispatch";
sha256 = "sha256-1tIskUMnfblnvZaFDQPUMBfWTmBYG98s7rEww7PwZO8=";
fetchSubmodules = true;
};
indexstoreDb = fetchSwiftRelease {
repo = "indexstore-db";
sha256 = "sha256-/PO4eMiASZN3pjFjBQ1r8vYwGRn6xm3SWaB2HDZlkPs=";
};
sourcekitLsp = fetchSwiftRelease {
repo = "sourcekit-lsp";
sha256 = "sha256-ttgUC4ZHD3P/xLHllEbACtHVrJ6HXqeVWccXcoPMkts=";
};
llvmProject = fetchSwiftRelease {
repo = "llvm-project";
sha256 = "sha256-YVs3lKV2RlaovpYkdGO+vzypolrmXmbKBBP4+osNMYw=";
};
docc = fetchSwiftRelease {
repo = "swift-docc";
sha256 = "sha256-rWiaNamZoHTO1bKpubxuT7m1IBOl7amT5M71mNauilY=";
};
docc-render-artifact = fetchSwiftRelease {
repo = "swift-docc-render-artifact";
sha256 = "sha256-AX+rtDLhq8drk7N6/hoH3fQioudmmTCnEhR45bME8uU=";
};
docc-symbolkit = fetchSwiftRelease {
repo = "swift-docc-symbolkit";
sha256 = "sha256-Xy1TQ5ucDW+MnkeOvVznsATBmwcQ3p1x+ofQ22ofk+o=";
};
lmdb = fetchSwiftRelease {
repo = "swift-lmdb";
sha256 = "sha256-i2GkWRWq1W5j8rF4PiHwWgT4Dur5FCY2o44HvUU3vtQ=";
};
markdown = fetchSwiftRelease {
repo = "swift-markdown";
sha256 = "sha256-XtFSBiNHhmULjS4OqSpMgUetLu3peRg7l6HpjwVsTj8=";
};
cmark-gfm = fetchAppleRepo {
repo = "swift-cmark";
rev = "swift-${versions.swift}-RELEASE-gfm";
sha256 = "sha256-g28iKmMR2W0r1urf8Fk1HBxAp5OlonNYSVN3Ril66tQ=";
};
# Projects that have their own versions during each release
argumentParser = fetchAppleRepo {
repo = "swift-argument-parser";
rev = "${versions.argumentParser}";
sha256 = "sha256-vNqkuAwSZNCWvwe6E5BqbXQdIbmIia0dENmmSQ9P8Mo=";
};
format = fetchAppleRepo {
repo = "swift-format";
rev = "${versions.format}";
sha256 = "sha256-1f5sIrv9IbPB7Vnahq1VwH8gT41dcjWldRwvVEaMdto=";
};
crypto = fetchAppleRepo {
repo = "swift-crypto";
rev = "${versions.crypto}";
sha256 = "sha256-jwxXQuOF+CnpLMwTZ2z52Fgx2b97yWzXiPTx0Ye8KCQ=";
};
nio = fetchAppleRepo {
repo = "swift-nio";
rev = versions.nio;
sha256 = "sha256-FscOA/S7on31QCR/MZFjg4ZB3FGJ+rdptZ6MRZJXexE=";
};
nio-ssl = fetchAppleRepo {
repo = "swift-nio-ssl";
rev = versions.nio-ssl;
sha256 = "sha256-5QGkmkCOXhG3uOdf0bd3Fo1MFekB8/WcveBXGhtVZKo=";
};
yams = fetchFromGitHub {
owner = "jpsim";
repo = "Yams";
rev = versions.yams;
sha256 = "sha256-cTkCAwxxLc35laOon1ZXXV8eAxX02oDolJyPauhZado=";
name = "Yams-${versions.yams}-src";
};
};
devInputs = [
curl
glibc
icu
libblocksruntime
libedit
libgcc
libuuid
libxcrypt
libxml2
ncurses
sqlite
];
python = (python3.withPackages (ps: [ps.six]));
cmakeFlags = [
"-DGLIBC_INCLUDE_PATH=${stdenv.cc.libc.dev}/include"
"-DC_INCLUDE_DIRS=${lib.makeSearchPathOutput "dev" "include" devInputs}:${libxml2.dev}/include/libxml2"
"-DGCC_INSTALL_PREFIX=${gccForLibs}"
];
in
stdenv.mkDerivation {
pname = "swift";
version = versions.swift;
nativeBuildInputs = [
cmake
git
makeWrapper
ninja
perl
pkg-config
python
rsync
which
];
buildInputs = devInputs ++ [
clang_13
];
# TODO: Revisit what needs to be propagated and how.
propagatedBuildInputs = [
libgcc
libgit2
python
];
propagatedUserEnvPkgs = [ git pkg-config ];
hardeningDisable = [ "format" ]; # for LLDB
unpackPhase = ''
mkdir src
cd src
export SWIFT_SOURCE_ROOT=$PWD
cp -r ${sources.swift} swift
cp -r ${sources.cmark} cmark
cp -r ${sources.llbuild} llbuild
cp -r ${sources.argumentParser} swift-argument-parser
cp -r ${sources.driver} swift-driver
cp -r ${sources.toolsSupportCore} swift-tools-support-core
cp -r ${sources.swiftpm} swiftpm
cp -r ${sources.syntax} swift-syntax
cp -r ${sources.corelibsXctest} swift-corelibs-xctest
cp -r ${sources.corelibsFoundation} swift-corelibs-foundation
cp -r ${sources.corelibsLibdispatch} swift-corelibs-libdispatch
cp -r ${sources.yams} yams
cp -r ${sources.indexstoreDb} indexstore-db
cp -r ${sources.sourcekitLsp} sourcekit-lsp
cp -r ${sources.format} swift-format
cp -r ${sources.crypto} swift-crypto
cp -r ${sources.llvmProject} llvm-project
cp -r ${sources.cmark-gfm} swift-cmark-gfm
cp -r ${sources.docc} swift-docc
cp -r ${sources.docc-render-artifact} swift-docc-render-artifact
cp -r ${sources.docc-symbolkit} swift-docc-symbolkit
cp -r ${sources.lmdb} swift-lmdb
cp -r ${sources.markdown} swift-markdown
cp -r ${sources.nio} swift-nio
cp -r ${sources.nio-ssl} swift-nio-ssl
chmod -R u+w .
'';
patchPhase = ''
# 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'
# Build configuration patches.
patch -p1 -d swift -i ${./patches/0001-build-presets-linux-don-t-require-using-Ninja.patch}
patch -p1 -d swift -i ${./patches/0002-build-presets-linux-allow-custom-install-prefix.patch}
patch -p1 -d swift -i ${./patches/0003-build-presets-linux-don-t-build-extra-libs.patch}
patch -p1 -d swift -i ${./patches/0004-build-presets-linux-plumb-extra-cmake-options.patch}
patch -p1 -d swift -i ${./patches/0007-build-presets-linux-os-stdlib.patch}
substituteInPlace swift/cmake/modules/SwiftConfigureSDK.cmake \
--replace '/usr/include' "${stdenv.cc.libc.dev}/include"
sed -i swift/utils/build-presets.ini \
-e 's/^test-installable-package$/# \0/' \
-e 's/^test$/# \0/' \
-e 's/^validation-test$/# \0/' \
-e 's/^long-test$/# \0/' \
-e 's/^stress-test$/# \0/' \
-e 's/^test-optimized$/# \0/' \
-e 's/^swift-install-components=autolink.*$/\0;editor-integration/'
# LLVM toolchain patches.
patch -p1 -d llvm-project/clang -i ${./patches/0005-clang-toolchain-dir.patch}
patch -p1 -d llvm-project/clang -i ${./patches/0006-clang-purity.patch}
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";'
# Substitute ncurses for curses in llbuild.
sed -i 's/curses/ncurses/' llbuild/*/*/CMakeLists.txt
sed -i 's/curses/ncurses/' llbuild/*/*/*/CMakeLists.txt
# 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
# Support library build script patches.
PREFIX=''${out/#\/}
substituteInPlace swift/utils/swift_build_support/swift_build_support/products/benchmarks.py \
--replace \
"'--toolchain', toolchain_path," \
"'--toolchain', '/build/install/$PREFIX',"
substituteInPlace swift/benchmark/scripts/build_script_helper.py \
--replace \
"swiftbuild_path = os.path.join(args.toolchain, \"usr\", \"bin\", \"swift-build\")" \
"swiftbuild_path = os.path.join(args.toolchain, \"bin\", \"swift-build\")"
substituteInPlace swift-corelibs-xctest/build_script.py \
--replace usr "$PREFIX"
# Can be removed in later swift-docc versions, see
# https://github.com/apple/swift-docc/commit/bff70b847008f91ac729cfd299a85481eef3f581
substituteInPlace swift-docc/build-script-helper.py \
--replace \
"subprocess.check_output(cmd, env=env).strip(), 'docc')" \
"subprocess.check_output(cmd, env=env).strip().decode(), 'docc')"
# Can be removed in later Swift versions, see
# https://github.com/apple/swift/pull/58755
substituteInPlace swift/utils/process-stats-dir.py \
--replace \
"type=argparse.FileType('wb', 0)," \
"type=argparse.FileType('w', 0),"
# Apply Python 3 fix, see
# https://github.com/apple/swift/commit/ec6bc595092974628b27b114a472e84162261bbd
substituteInPlace swift/utils/swift_build_support/swift_build_support/productpipeline_list_builder.py \
--replace \
"filter(lambda x: x is not None, pipeline)" \
"[p for p in pipeline if p is not None]"
'';
configurePhase = ''
cd ..
mkdir build install
export SWIFT_BUILD_ROOT=$PWD/build
export SWIFT_INSTALL_DIR=$PWD/install
export INSTALLABLE_PACKAGE=$PWD/swift.tar.gz
export NIX_ENFORCE_PURITY=
cd $SWIFT_BUILD_ROOT
'';
buildPhase = ''
# Explicitly include C++ headers to prevent errors where stdlib.h is not found from cstdlib.
export NIX_CFLAGS_COMPILE="$(< ${clang_13}/nix-support/libcxx-cxxflags) $NIX_CFLAGS_COMPILE"
# During the Swift build, a full local LLVM build is performed and the resulting clang is
# invoked. This compiler is not using the Nix wrappers, so it needs some help to find things.
export NIX_LDFLAGS_BEFORE="-rpath ${gccForLibs.lib}/lib -L${gccForLibs.lib}/lib $NIX_LDFLAGS_BEFORE"
# However, we want to use the wrapped compiler whenever possible.
export CC="${clang_13}/bin/clang"
$SWIFT_SOURCE_ROOT/swift/utils/build-script \
--preset=buildbot_linux \
installable_package=$INSTALLABLE_PACKAGE \
install_prefix=$out \
install_destdir=$SWIFT_INSTALL_DIR \
extra_cmake_options="${lib.concatStringsSep "," cmakeFlags}"
'';
doCheck = true;
checkInputs = [ file ];
checkPhase = ''
# Remove compiler build system tests which fail due to our modified default build profile and
# nixpkgs-provided version of CMake.
rm $SWIFT_SOURCE_ROOT/swift/validation-test/BuildSystem/infer_implies_install_all.test
rm $SWIFT_SOURCE_ROOT/swift/validation-test/BuildSystem/infer_dumps_deps_if_verbose_build.test
# This test apparently requires Python 2 (strings are assumed to be bytes-like), but the build
# process overall now otherwise requires Python 3 (which is what we have updated to). A fix PR
# has been submitted upstream.
rm $SWIFT_SOURCE_ROOT/swift/validation-test/SIL/verify_all_overlays.py
# TODO: consider fixing and re-adding. This test fails due to a non-standard "install_prefix".
rm $SWIFT_SOURCE_ROOT/swift/validation-test/Python/build_swift.swift
# We cannot handle the SDK location being in "Weird Location" due to Nix isolation.
rm $SWIFT_SOURCE_ROOT/swift/test/DebugInfo/compiler-flags.swift
# TODO: Fix issue with ld.gold invoked from script finding crtbeginS.o and crtendS.o.
rm $SWIFT_SOURCE_ROOT/swift/test/IRGen/ELF-remove-autolink-section.swift
# The following two tests fail because we use don't use the bundled libicu:
# [SOURCE_DIR/utils/build-script] ERROR: can't find source directory for libicu (tried /build/src/icu)
rm $SWIFT_SOURCE_ROOT/swift/validation-test/BuildSystem/default_build_still_performs_epilogue_opts_after_split.test
rm $SWIFT_SOURCE_ROOT/swift/validation-test/BuildSystem/test_early_swift_driver_and_infer.swift
# TODO: This test fails for some unknown reason
rm $SWIFT_SOURCE_ROOT/swift/test/Serialization/restrict-swiftmodule-to-revision.swift
# This test was flaky in ofborg, see #186476
rm $SWIFT_SOURCE_ROOT/swift/test/AutoDiff/compiler_crashers_fixed/sr14290-missing-debug-scopes-in-pullback-trampoline.swift
# TODO: consider using stress-tester and integration-test.
# Match the wrapped version of Swift to be installed.
export LIBRARY_PATH=${lib.makeLibraryPath [icu libgcc libuuid]}:$l
checkTarget=check-swift-all-${stdenv.hostPlatform.parsed.kernel.name}-${stdenv.hostPlatform.parsed.cpu.name}
ninjaFlags='-C buildbot_linux/swift-${stdenv.hostPlatform.parsed.kernel.name}-${stdenv.hostPlatform.parsed.cpu.name}'
ninjaCheckPhase
'';
installPhase = ''
mkdir -p $out
# Extract the generated tarball into the store.
tar xf $INSTALLABLE_PACKAGE -C $out --strip-components=3 ''${out/#\/}
find $out -type d -empty -delete
# Fix installation weirdness, also present in Apples official tarballs.
mv $out/local/include/indexstore $out/include
rmdir $out/local/include $out/local
rm -r $out/bin/sdk-module-lists $out/bin/swift-api-checker.py
wrapProgram $out/bin/swift \
--set CC $out/bin/clang \
--suffix C_INCLUDE_PATH : $out/lib/swift/clang/include \
--suffix CPLUS_INCLUDE_PATH : $out/lib/swift/clang/include \
--suffix LIBRARY_PATH : ${lib.makeLibraryPath [icu libgcc libuuid]} \
--suffix PATH : ${lib.makeBinPath [ stdenv.cc.bintools ]}
wrapProgram $out/bin/swiftc \
--set CC $out/bin/clang \
--suffix C_INCLUDE_PATH : $out/lib/swift/clang/include \
--suffix CPLUS_INCLUDE_PATH : $out/lib/swift/clang/include \
--suffix LIBRARY_PATH : ${lib.makeLibraryPath [icu libgcc libuuid]} \
--suffix PATH : ${lib.makeBinPath [ stdenv.cc.bintools ]}
'';
# Hack to avoid build and install directories in RPATHs.
preFixup = "rm -rf $SWIFT_BUILD_ROOT $SWIFT_INSTALL_DIR";
meta = with lib; {
description = "The Swift Programming Language";
homepage = "https://github.com/apple/swift";
maintainers = with maintainers; [ dtzWill trepetti dduan trundle ];
license = licenses.asl20;
# Swift doesn't support 32-bit Linux, unknown on other platforms.
platforms = platforms.linux;
badPlatforms = platforms.i686;
timeout = 86400; # 24 hours.
};
}
in self
@@ -0,0 +1,61 @@
# TODO: We already package the CoreFoundation component of Foundation in:
# pkgs/os-specific/darwin/swift-corelibs/corefoundation.nix
# This is separate because the CF build is completely different and part of
# stdenv. Merging the two was kept outside of the scope of Swift work.
{ lib
, stdenv
, callPackage
, cmake
, ninja
, swift
, Dispatch
, icu
, libxml2
, curl
}:
let
sources = callPackage ../sources.nix { };
in stdenv.mkDerivation {
pname = "swift-corelibs-foundation";
inherit (sources) version;
src = sources.swift-corelibs-foundation;
outputs = [ "out" "dev" ];
nativeBuildInputs = [ cmake ninja swift ];
buildInputs = [ icu libxml2 curl ];
propagatedBuildInputs = [ Dispatch ];
preConfigure = ''
# Fails to build with -D_FORTIFY_SOURCE.
NIX_HARDENING_ENABLE=''${NIX_HARDENING_ENABLE/fortify/}
'';
postInstall = ''
# Split up the output.
mkdir $dev
mv $out/lib/swift/${swift.swiftOs} $out/swiftlibs
mv $out/lib/swift $dev/include
mkdir $out/lib/swift
mv $out/swiftlibs $out/lib/swift/${swift.swiftOs}
# Provide a CMake module. This is primarily used to glue together parts of
# the Swift toolchain. Modifying the CMake config to do this for us is
# otherwise more trouble.
mkdir -p $dev/lib/cmake/Foundation
export dylibExt="${stdenv.hostPlatform.extensions.sharedLibrary}"
export swiftOs="${swift.swiftOs}"
substituteAll ${./glue.cmake} $dev/lib/cmake/Foundation/FoundationConfig.cmake
'';
meta = {
description = "Core utilities, internationalization, and OS independence for Swift";
homepage = "https://github.com/apple/swift-corelibs-foundation";
platforms = lib.platforms.linux;
license = lib.licenses.asl20;
maintainers = with lib.maintainers; [ dtzWill trepetti dduan trundle stephank ];
};
}
@@ -0,0 +1,8 @@
add_library(Foundation SHARED IMPORTED)
set_property(TARGET Foundation PROPERTY IMPORTED_LOCATION "@out@/lib/swift/@swiftOs@/libFoundation@dylibExt@")
add_library(FoundationNetworking SHARED IMPORTED)
set_property(TARGET FoundationNetworking PROPERTY IMPORTED_LOCATION "@out@/lib/swift/@swiftOs@/libFoundationNetworking@dylibExt@")
add_library(FoundationXML SHARED IMPORTED)
set_property(TARGET FoundationXML PROPERTY IMPORTED_LOCATION "@out@/lib/swift/@swiftOs@/libFoundationXML@dylibExt@")
@@ -0,0 +1,42 @@
{ lib
, stdenv
, callPackage
, cmake
, ninja
, useSwift ? true, swift
}:
let
sources = callPackage ../sources.nix { };
in stdenv.mkDerivation {
pname = "swift-corelibs-libdispatch";
inherit (sources) version;
src = sources.swift-corelibs-libdispatch;
outputs = [ "out" "dev" "man" ];
nativeBuildInputs = [ cmake ]
++ lib.optionals useSwift [ ninja swift ];
patches = [ ./disable-swift-overlay.patch ];
cmakeFlags = lib.optional useSwift "-DENABLE_SWIFT=ON";
postInstall = ''
# Provide a CMake module. This is primarily used to glue together parts of
# the Swift toolchain. Modifying the CMake config to do this for us is
# otherwise more trouble.
mkdir -p $dev/lib/cmake/dispatch
export dylibExt="${stdenv.hostPlatform.extensions.sharedLibrary}"
substituteAll ${./glue.cmake} $dev/lib/cmake/dispatch/dispatchConfig.cmake
'';
meta = {
description = "Grand Central Dispatch";
homepage = "https://github.com/apple/swift-corelibs-libdispatch";
platforms = lib.platforms.linux;
license = lib.licenses.asl20;
maintainers = with lib.maintainers; [ cmm dtzWill trepetti dduan trundle stephank ];
};
}
@@ -0,0 +1,35 @@
Enabling Swift support is normally intended for building an overlay for a
Swift SDK, which changes the installation layout. Prevent this.
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -287,7 +287,7 @@ configure_file("${PROJECT_SOURCE_DIR}/cmake/config.h.in"
add_compile_definitions($<$<OR:$<COMPILE_LANGUAGE:C>,$<COMPILE_LANGUAGE:CXX>>:HAVE_CONFIG_H>)
-if(ENABLE_SWIFT)
+if(0)
set(INSTALL_TARGET_DIR "${CMAKE_INSTALL_LIBDIR}/swift$<$<NOT:$<BOOL:${BUILD_SHARED_LIBS}>>:_static>/$<LOWER_CASE:${CMAKE_SYSTEM_NAME}>" CACHE PATH "Path where the libraries will be installed")
set(INSTALL_DISPATCH_HEADERS_DIR "${CMAKE_INSTALL_LIBDIR}/swift$<$<NOT:$<BOOL:${BUILD_SHARED_LIBS}>>:_static>/dispatch" CACHE PATH "Path where the headers will be installed for libdispatch")
set(INSTALL_BLOCK_HEADERS_DIR "${CMAKE_INSTALL_LIBDIR}/swift$<$<NOT:$<BOOL:${BUILD_SHARED_LIBS}>>:_static>/Block" CACHE PATH "Path where the headers will be installed for the blocks runtime")
--- a/man/CMakeLists.txt
+++ b/man/CMakeLists.txt
@@ -1,6 +1,6 @@
# TODO(compnerd) add symlinks
-if(NOT ENABLE_SWIFT)
+if(1)
install(FILES
dispatch.3
dispatch_after.3
--- a/src/swift/CMakeLists.txt
+++ b/src/swift/CMakeLists.txt
@@ -47,7 +47,7 @@ get_swift_host_arch(swift_arch)
install(FILES
${CMAKE_CURRENT_BINARY_DIR}/swift/Dispatch.swiftmodule
${CMAKE_CURRENT_BINARY_DIR}/swift/Dispatch.swiftdoc
- DESTINATION ${INSTALL_TARGET_DIR}/${swift_arch})
+ DESTINATION ${INSTALL_TARGET_DIR}/swift)
set_property(GLOBAL APPEND PROPERTY DISPATCH_EXPORTS swiftDispatch)
install(TARGETS swiftDispatch
EXPORT dispatchExports
@@ -0,0 +1,5 @@
add_library(dispatch SHARED IMPORTED)
set_property(TARGET dispatch PROPERTY IMPORTED_LOCATION "@out@/lib/libdispatch@dylibExt@")
add_library(swiftDispatch SHARED IMPORTED)
set_property(TARGET swiftDispatch PROPERTY IMPORTED_LOCATION "@out@/lib/libswiftDispatch@dylibExt@")
@@ -1,13 +0,0 @@
Don't build Ninja, we use our own.
--- a/utils/build-presets.ini
+++ b/utils/build-presets.ini
@@ -779,7 +779,7 @@ swiftpm
dash-dash
-build-ninja
+# build-ninja
install-llvm
install-swift
install-lldb
@@ -1,13 +0,0 @@
Use custom install prefix.
--- a/utils/build-presets.ini
+++ b/utils/build-presets.ini
@@ -788,7 +788,7 @@
install-swiftpm
install-xctest
install-libicu
-install-prefix=/usr
+install-prefix=%(install_prefix)s
install-libcxx
install-sourcekit-lsp
build-swift-static-stdlib
@@ -1,23 +0,0 @@
Disable targets, where we use Nix packages.
--- a/utils/build-presets.ini
+++ b/utils/build-presets.ini
@@ -818,8 +818,6 @@
swiftpm
swift-driver
xctest
-libicu
-libcxx
swiftdocc
# build-ninja
@@ -830,9 +828,7 @@
install-swiftpm
install-swift-driver
install-xctest
-install-libicu
install-prefix=%(install_prefix)s
-install-libcxx
install-sourcekit-lsp
install-swiftdocc
build-swift-static-stdlib
@@ -1,13 +0,0 @@
Plumb extra-cmake-options.
--- a/utils/build-presets.ini
+++ b/utils/build-presets.ini
@@ -812,6 +812,8 @@
# Path to the .tar.gz package we would create.
installable-package=%(installable_package)s
+extra-cmake-options=%(extra_cmake_options)s
+
[preset: buildbot_linux]
mixin-preset=mixin_linux_installation
build-subdir=buildbot_linux
@@ -1,16 +0,0 @@
Apply the "purity" patch (updated for 5.4.2).
--- a/lib/Driver/ToolChains/Gnu.cpp
+++ b/lib/Driver/ToolChains/Gnu.cpp
@@ -488,11 +488,5 @@
if (Args.hasArg(options::OPT_rdynamic))
CmdArgs.push_back("-export-dynamic");
-
- if (!Args.hasArg(options::OPT_shared) && !IsStaticPIE) {
- CmdArgs.push_back("-dynamic-linker");
- CmdArgs.push_back(Args.MakeArgString(Twine(D.DyldPrefix) +
- ToolChain.getDynamicLinker(Args)));
- }
}
CmdArgs.push_back("-o");
@@ -1,13 +0,0 @@
Use os-stdlib in tests.
--- a/utils/build-presets.ini
+++ b/utils/build-presets.ini
@@ -872,7 +872,7 @@
indexstore-db
sourcekit-lsp
swiftdocc
-lit-args=-v --time-tests
+lit-args=-v --time-tests --param use_os_stdlib
# rdar://problem/31454823
lldb-test-swift-only
@@ -0,0 +1,72 @@
{ lib
, stdenv
, callPackage
, swift
, swiftpm
, swiftpm2nix
, Foundation
, XCTest
, sqlite
, ncurses
, CryptoKit
, LocalAuthentication
}:
let
sources = callPackage ../sources.nix { };
generated = swiftpm2nix.helpers ./generated;
# On Darwin, we only want ncurses in the linker search path, because headers
# are part of libsystem. Adding its headers to the search path causes strange
# mixing and errors.
# TODO: Find a better way to prevent this conflict.
ncursesInput = if stdenv.isDarwin then ncurses.out else ncurses;
in
stdenv.mkDerivation {
pname = "sourcekit-lsp";
inherit (sources) version;
src = sources.sourcekit-lsp;
nativeBuildInputs = [ swift swiftpm ];
buildInputs = [
Foundation
XCTest
sqlite
ncursesInput
]
++ lib.optionals stdenv.isDarwin [ CryptoKit LocalAuthentication ];
configurePhase = generated.configure + ''
swiftpmMakeMutable indexstore-db
patch -p1 -d .build/checkouts/indexstore-db -i ${./patches/indexstore-db-macos-target.patch}
# This toggles a section specific to Xcode XCTest, which doesn't work on
# Darwin, where we also use swift-corelibs-xctest.
substituteInPlace Sources/LSPTestSupport/PerfTestCase.swift \
--replace '#if os(macOS)' '#if false'
# Required to link with swift-corelibs-xctest on Darwin.
export SWIFTTSC_MACOS_DEPLOYMENT_TARGET=10.12
'';
# TODO: BuildServerBuildSystemTests fails
#doCheck = true;
installPhase = ''
binPath="$(swiftpmBinPath)"
mkdir -p $out/bin
cp $binPath/sourcekit-lsp $out/bin/
'';
# Canary to verify output of our Swift toolchain does not depend on the Swift
# compiler itself. (Only its 'lib' output.)
disallowedRequisites = [ swift.swift ];
meta = {
description = "Language Server Protocol implementation for Swift and C-based languages";
homepage = "https://github.com/apple/sourcekit-lsp";
platforms = with lib.platforms; linux ++ darwin;
license = lib.licenses.asl20;
maintainers = with lib.maintainers; [ dtzWill trepetti dduan trundle stephank ];
};
}
@@ -0,0 +1,16 @@
# This file was generated by swiftpm2nix.
{
workspaceStateFile = ./workspace-state.json;
hashes = {
"indexstore-db" = "005vvkrncgpryzrn0hzgsapflpyga0n7152b2b565wislpx90cwl";
"swift-argument-parser" = "1jph9w7lk9nr20fsv2c8p4hisx3dda817fh7pybd0r0j1jwa9nmw";
"swift-collections" = "0l0pv16zil3n7fac7mdf5qxklxr5rwiig5bixgca1ybq7arlnv7i";
"swift-crypto" = "020b8q4ss2k7a65r5dgh59z40i6sn7ij1allxkh8c8a9d0jzn313";
"swift-driver" = "0nblvs47kh2hl1l70rmrbablx4m5i27w8l3dfrv2h7zccqr8jl0a";
"swift-llbuild" = "1bvqbj8ji72ilh3ah2mw411jwzbbjxjyasa6sg4b8da0kqia4021";
"swift-package-manager" = "16qvk14f1l0hf5bphx6qk51nn9d36a2iw5v3sgkvmqi8h7l4kqg5";
"swift-system" = "0402hkx2q2dv27gccnn8ma79ngvwiwzkhcv4zlcdldmy6cgi0px7";
"swift-tools-support-core" = "1ryd5iyx5mfv8bhyq3bf08z7nv886chzzqnmwaj16r2cry9yml7c";
"Yams" = "11abhcfkmqm3cmh7vp7rqzvxd1zj02j2866a2pp6v9m89456xb76";
};
}
@@ -0,0 +1,178 @@
{
"object": {
"artifacts": [],
"dependencies": [
{
"basedOn": null,
"packageRef": {
"identity": "indexstore-db",
"kind": "remoteSourceControl",
"location": "https://github.com/apple/indexstore-db.git",
"name": "IndexStoreDB"
},
"state": {
"checkoutState": {
"branch": "main",
"revision": "2ff1c0491248cd958a2ac05da9aa613eb27a8eeb"
},
"name": "sourceControlCheckout"
},
"subpath": "indexstore-db"
},
{
"basedOn": null,
"packageRef": {
"identity": "swift-argument-parser",
"kind": "remoteSourceControl",
"location": "https://github.com/apple/swift-argument-parser.git",
"name": "swift-argument-parser"
},
"state": {
"checkoutState": {
"revision": "e394bf350e38cb100b6bc4172834770ede1b7232",
"version": "1.0.3"
},
"name": "sourceControlCheckout"
},
"subpath": "swift-argument-parser"
},
{
"basedOn": null,
"packageRef": {
"identity": "swift-collections",
"kind": "remoteSourceControl",
"location": "https://github.com/apple/swift-collections.git",
"name": "swift-collections"
},
"state": {
"checkoutState": {
"revision": "f504716c27d2e5d4144fa4794b12129301d17729",
"version": "1.0.3"
},
"name": "sourceControlCheckout"
},
"subpath": "swift-collections"
},
{
"basedOn": null,
"packageRef": {
"identity": "swift-crypto",
"kind": "remoteSourceControl",
"location": "https://github.com/apple/swift-crypto.git",
"name": "swift-crypto"
},
"state": {
"checkoutState": {
"revision": "ddb07e896a2a8af79512543b1c7eb9797f8898a5",
"version": "1.1.7"
},
"name": "sourceControlCheckout"
},
"subpath": "swift-crypto"
},
{
"basedOn": null,
"packageRef": {
"identity": "swift-driver",
"kind": "remoteSourceControl",
"location": "https://github.com/apple/swift-driver.git",
"name": "swift-driver"
},
"state": {
"checkoutState": {
"branch": "main",
"revision": "6c71f58f89d65eb79f1f6b32a707ddc39cec5ad6"
},
"name": "sourceControlCheckout"
},
"subpath": "swift-driver"
},
{
"basedOn": null,
"packageRef": {
"identity": "swift-llbuild",
"kind": "remoteSourceControl",
"location": "https://github.com/apple/swift-llbuild.git",
"name": "llbuild"
},
"state": {
"checkoutState": {
"branch": "main",
"revision": "d99c31577c60a247b065d29289a44fbdd141e2be"
},
"name": "sourceControlCheckout"
},
"subpath": "swift-llbuild"
},
{
"basedOn": null,
"packageRef": {
"identity": "swift-package-manager",
"kind": "remoteSourceControl",
"location": "https://github.com/apple/swift-package-manager.git",
"name": "SwiftPM"
},
"state": {
"checkoutState": {
"branch": "main",
"revision": "f04ad469a6053d713c2fb854fbeb27ee3e6c9dee"
},
"name": "sourceControlCheckout"
},
"subpath": "swift-package-manager"
},
{
"basedOn": null,
"packageRef": {
"identity": "swift-system",
"kind": "remoteSourceControl",
"location": "https://github.com/apple/swift-system.git",
"name": "swift-system"
},
"state": {
"checkoutState": {
"revision": "836bc4557b74fe6d2660218d56e3ce96aff76574",
"version": "1.1.1"
},
"name": "sourceControlCheckout"
},
"subpath": "swift-system"
},
{
"basedOn": null,
"packageRef": {
"identity": "swift-tools-support-core",
"kind": "remoteSourceControl",
"location": "https://github.com/apple/swift-tools-support-core.git",
"name": "swift-tools-support-core"
},
"state": {
"checkoutState": {
"branch": "main",
"revision": "0220fc394f2ae820eeacd754fb2c7ce211e9979e"
},
"name": "sourceControlCheckout"
},
"subpath": "swift-tools-support-core"
},
{
"basedOn": null,
"packageRef": {
"identity": "yams",
"kind": "remoteSourceControl",
"location": "https://github.com/jpsim/Yams.git",
"name": "Yams"
},
"state": {
"checkoutState": {
"revision": "01835dc202670b5bb90d07f3eae41867e9ed29f6",
"version": "5.0.1"
},
"name": "sourceControlCheckout"
},
"subpath": "Yams"
}
]
},
"version": 5
}
@@ -0,0 +1,12 @@
Raise the deployment target of IndexStoreDB so it can link against our XCTest.
--- a/Package.swift
+++ b/Package.swift
@@ -4,6 +4,7 @@ import PackageDescription
let package = Package(
name: "IndexStoreDB",
+ platforms: [.macOS("10.12")],
products: [
.library(
name: "IndexStoreDB",
@@ -0,0 +1,33 @@
{ lib, fetchFromGitHub }:
let
# These packages are all part of the Swift toolchain, and have a single
# upstream version that should match. We also list the hashes here so a basic
# version upgrade touches only this file.
version = "5.7";
hashes = {
llvm-project = "sha256-uW6dEAFaDOlHXnq8lFYxrKNLRPEukauZJxX4UCpWpIY=";
sourcekit-lsp = "sha256-uA3a+kAqI+XFzkDFEJ8XuRTgfYqacEuTsOU289Im+0Y=";
swift = "sha256-n8WVQYinAyIj4wmQnDhvPsH+t8ydANkGbjFJ6blfHOY=";
swift-cmark = "sha256-f0BoTs4HYdx/aJ9HIGCWMalhl8PvClWD6R4QK3qSgAw=";
swift-corelibs-foundation = "sha256-6XUSC6759dcG24YapWicjRzUnmVVe0QPSsLEw4sQNjI=";
swift-corelibs-libdispatch = "sha256-1qbXiC1k9+T+L6liqXKg6EZXqem6KEEx8OctuL4Kb2o=";
swift-corelibs-xctest = "sha256-qLUO9/3tkJWorDMEHgHd8VC3ovLLq/UWXJWMtb6CMN0=";
swift-docc = "sha256-WlXJMAnrlVPCM+iCIhG0Gyho76BsC2yVBEpX3m/WiIQ=";
swift-docc-render-artifact = "sha256-ttdurN/K7OX+I4577jG3YGeRs+GLUTc7BiiEZGmFD+s=";
swift-driver = "sha256-sk7XWXYR1MGPEeVxA6eA/vxhN6Gq16iD1RHpVstL3zE=";
swift-experimental-string-processing = "sha256-Ar9fQWi8bYSvGErrS0SWrxIxwEwCjsYIZcWweZ8bV28=";
swift-package-manager = "sha256-MZah+/XfeK46YamxwuE3Kiv+u5bj7VmjEh6ztDF+0j4=";
};
# Create fetch derivations.
sources = lib.mapAttrs (repo: hash: fetchFromGitHub {
owner = "apple";
inherit repo;
rev = "swift-${version}-RELEASE";
name = "${repo}-${version}-src";
hash = hashes.${repo};
}) hashes;
in sources // { inherit version; }
@@ -0,0 +1,53 @@
{ lib
, stdenv
, callPackage
, swift
, swiftpm
, swiftpm2nix
, Foundation
, XCTest
, CryptoKit
, LocalAuthentication
}:
let
sources = callPackage ../sources.nix { };
generated = swiftpm2nix.helpers ./generated;
in
stdenv.mkDerivation {
pname = "swift-docc";
inherit (sources) version;
src = sources.swift-docc;
# TODO: We could build this from `apple/swift-docc-render` source, but that
# repository is not tagged.
renderArtifact = sources.swift-docc-render-artifact;
nativeBuildInputs = [ swift swiftpm ];
buildInputs = [ Foundation XCTest ]
++ lib.optionals stdenv.isDarwin [ CryptoKit LocalAuthentication ];
configurePhase = generated.configure;
# TODO: Tests depend on indexstore-db being provided by an existing Swift
# toolchain. (ie. looks for `../lib/libIndexStore.so` relative to swiftc.
#doCheck = true;
installPhase = ''
binPath="$(swiftpmBinPath)"
mkdir -p $out/bin $out/share/docc
cp $binPath/docc $out/bin/
ln -s $renderArtifact/dist $out/share/docc/render
'';
# Canary to verify output of our Swift toolchain does not depend on the Swift
# compiler itself. (Only its 'lib' output.)
disallowedRequisites = [ swift.swift ];
meta = {
description = "Documentation compiler for Swift";
homepage = "https://github.com/apple/swift-docc";
platforms = with lib.platforms; linux ++ darwin;
license = lib.licenses.asl20;
maintainers = with lib.maintainers; [ dtzWill trepetti dduan trundle stephank ];
};
}
@@ -0,0 +1,15 @@
# This file was generated by swiftpm2nix.
{
workspaceStateFile = ./workspace-state.json;
hashes = {
"swift-argument-parser" = "070gip241dgn3d0nxgwxva4vp6kbnf11g01q5yaq6kmflcmz58f2";
"swift-cmark" = "0xfchdgls3070z16in8ks69y8fpiajmyk7lmp5h7ym7164isa6bb";
"swift-crypto" = "0h054rq14jyg94aiymmp37vqz60a13dlczp5g09pln724j4ypv92";
"swift-docc-plugin" = "11d6nhi139yzk1lxxrixsbgyj1bnvmh40wj30y725q83nqq49ljh";
"swift-docc-symbolkit" = "14hb2wc09hisf2r2yny17z28z0m58cf4lnqaczad2x2hk4s1iayi";
"swift-lmdb" = "1m5y6x2vs1wflcv2c57rx87gh12sy0hkwy5iy9inxmda2mcs8qcb";
"swift-markdown" = "09270bfrwlp904cma29hsbhr1p25v8kwgvhcfi7lg2av7aaknd97";
"swift-nio" = "04bvay94b34ynmlvgyl9a7f431l3cf8k2zr483spv8mvyh1hxiqn";
"swift-nio-ssl" = "1ak4aldilmz0pnfgbwq1x4alr38nfyvx2pz7p2vi2plf82da80g5";
};
}
@@ -0,0 +1,161 @@
{
"object": {
"artifacts": [],
"dependencies": [
{
"basedOn": null,
"packageRef": {
"identity": "swift-argument-parser",
"kind": "remoteSourceControl",
"location": "https://github.com/apple/swift-argument-parser",
"name": "swift-argument-parser"
},
"state": {
"checkoutState": {
"revision": "d2930e8fcf9c33162b9fcc1d522bc975e2d4179b",
"version": "1.0.1"
},
"name": "sourceControlCheckout"
},
"subpath": "swift-argument-parser"
},
{
"basedOn": null,
"packageRef": {
"identity": "swift-cmark",
"kind": "remoteSourceControl",
"location": "https://github.com/apple/swift-cmark.git",
"name": "cmark-gfm"
},
"state": {
"checkoutState": {
"branch": "release/5.7-gfm",
"revision": "792c1c3326327515ce9bf64c44196b7f4daab9a6"
},
"name": "sourceControlCheckout"
},
"subpath": "swift-cmark"
},
{
"basedOn": null,
"packageRef": {
"identity": "swift-crypto",
"kind": "remoteSourceControl",
"location": "https://github.com/apple/swift-crypto.git",
"name": "swift-crypto"
},
"state": {
"checkoutState": {
"revision": "9680b7251cd2be22caaed8f1468bd9e8915a62fb",
"version": "1.1.2"
},
"name": "sourceControlCheckout"
},
"subpath": "swift-crypto"
},
{
"basedOn": null,
"packageRef": {
"identity": "swift-docc-plugin",
"kind": "remoteSourceControl",
"location": "https://github.com/apple/swift-docc-plugin",
"name": "SwiftDocCPlugin"
},
"state": {
"checkoutState": {
"revision": "3303b164430d9a7055ba484c8ead67a52f7b74f6",
"version": "1.0.0"
},
"name": "sourceControlCheckout"
},
"subpath": "swift-docc-plugin"
},
{
"basedOn": null,
"packageRef": {
"identity": "swift-docc-symbolkit",
"kind": "remoteSourceControl",
"location": "https://github.com/apple/swift-docc-symbolkit",
"name": "SymbolKit"
},
"state": {
"checkoutState": {
"branch": "release/5.7",
"revision": "8682202025906dce29a8b04f9263f40ba87b89d8"
},
"name": "sourceControlCheckout"
},
"subpath": "swift-docc-symbolkit"
},
{
"basedOn": null,
"packageRef": {
"identity": "swift-lmdb",
"kind": "remoteSourceControl",
"location": "https://github.com/apple/swift-lmdb.git",
"name": "CLMDB"
},
"state": {
"checkoutState": {
"branch": "release/5.7",
"revision": "6ea45a7ebf6d8f72bd299dfcc3299e284bbb92ee"
},
"name": "sourceControlCheckout"
},
"subpath": "swift-lmdb"
},
{
"basedOn": null,
"packageRef": {
"identity": "swift-markdown",
"kind": "remoteSourceControl",
"location": "https://github.com/apple/swift-markdown.git",
"name": "swift-markdown"
},
"state": {
"checkoutState": {
"branch": "release/5.7",
"revision": "d6cd065a7e4b6c3fad615dcd39890e095a2f63a2"
},
"name": "sourceControlCheckout"
},
"subpath": "swift-markdown"
},
{
"basedOn": null,
"packageRef": {
"identity": "swift-nio",
"kind": "remoteSourceControl",
"location": "https://github.com/apple/swift-nio.git",
"name": "swift-nio"
},
"state": {
"checkoutState": {
"revision": "1d425b0851ffa2695d488cce1d68df2539f42500",
"version": "2.31.2"
},
"name": "sourceControlCheckout"
},
"subpath": "swift-nio"
},
{
"basedOn": null,
"packageRef": {
"identity": "swift-nio-ssl",
"kind": "remoteSourceControl",
"location": "https://github.com/apple/swift-nio-ssl.git",
"name": "swift-nio-ssl"
},
"state": {
"checkoutState": {
"revision": "2e74773972bd6254c41ceeda827f229bccbf1c0f",
"version": "2.15.0"
},
"name": "sourceControlCheckout"
},
"subpath": "swift-nio-ssl"
}
]
},
"version": 5
}
@@ -0,0 +1,77 @@
{ lib
, stdenv
, callPackage
, fetchpatch
, swift
, swiftpm
, swiftpm2nix
, Foundation
, XCTest
, sqlite
, ncurses
, substituteAll
}:
let
sources = callPackage ../sources.nix { };
generated = swiftpm2nix.helpers ./generated;
# On Darwin, we only want ncurses in the linker search path, because headers
# are part of libsystem. Adding its headers to the search path causes strange
# mixing and errors.
# TODO: Find a better way to prevent this conflict.
ncursesInput = if stdenv.isDarwin then ncurses.out else ncurses;
in
stdenv.mkDerivation {
pname = "swift-driver";
inherit (sources) version;
src = sources.swift-driver;
nativeBuildInputs = [ swift swiftpm ];
buildInputs = [
Foundation
XCTest
sqlite
ncursesInput
];
patches = [
./patches/nix-resource-root.patch
./patches/disable-catalyst.patch
./patches/linux-fix-linking.patch
# TODO: Replace with branch patch once merged:
# https://github.com/apple/swift-driver/pull/1197
(fetchpatch {
url = "https://github.com/apple/swift-driver/commit/d3ef9cdf4871a58eddec7ff0e28fe611130da3f9.patch";
hash = "sha256-eVBaKN6uzj48ZnHtwGV0k5ChKjak1tDCyE+wTdyGq2c=";
})
# Prevent a warning about SDK directories we don't have.
(substituteAll {
src = ./patches/prevent-sdk-dirs-warnings.patch;
inherit (builtins) storeDir;
})
];
configurePhase = generated.configure;
# TODO: Tests depend on indexstore-db being provided by an existing Swift
# toolchain. (ie. looks for `../lib/libIndexStore.so` relative to swiftc.
#doCheck = true;
# TODO: Darwin-specific installation includes more, but not sure why.
installPhase = ''
binPath="$(swiftpmBinPath)"
mkdir -p $out/bin
for executable in swift-driver swift-help swift-build-sdk-interfaces; do
cp $binPath/$executable $out/bin/
done
'';
meta = {
description = "Swift compiler driver";
homepage = "https://github.com/apple/swift-driver";
platforms = with lib.platforms; linux ++ darwin;
license = lib.licenses.asl20;
maintainers = with lib.maintainers; [ dtzWill trepetti dduan trundle stephank ];
};
}
@@ -0,0 +1,11 @@
# This file was generated by swiftpm2nix.
{
workspaceStateFile = ./workspace-state.json;
hashes = {
"swift-argument-parser" = "11did5snqj8chcbdbiyx84mpif940ls2pr1iikwivvfp63i248hm";
"swift-llbuild" = "07zbp2dyfqd1bnyg7snpr9brn40jf22ivly5v10mql3hrg76a18h";
"swift-system" = "0402hkx2q2dv27gccnn8ma79ngvwiwzkhcv4zlcdldmy6cgi0px7";
"swift-tools-support-core" = "1vabl1z5sm2lrd75f5c781rkrq0liinpjvnrjr6i6r8cqrp0q5jb";
"Yams" = "1893y13sis2aimi1a5kgkczbf06z4yig054xb565yg2xm13srb45";
};
}
@@ -0,0 +1,93 @@
{
"object": {
"artifacts": [],
"dependencies": [
{
"basedOn": null,
"packageRef": {
"identity": "swift-argument-parser",
"kind": "remoteSourceControl",
"location": "https://github.com/apple/swift-argument-parser.git",
"name": "swift-argument-parser"
},
"state": {
"checkoutState": {
"revision": "e1465042f195f374b94f915ba8ca49de24300a0d",
"version": "1.0.2"
},
"name": "sourceControlCheckout"
},
"subpath": "swift-argument-parser"
},
{
"basedOn": null,
"packageRef": {
"identity": "swift-llbuild",
"kind": "remoteSourceControl",
"location": "https://github.com/apple/swift-llbuild.git",
"name": "llbuild"
},
"state": {
"checkoutState": {
"branch": "release/5.7",
"revision": "564424db5fdb62dcb5d863bdf7212500ef03a87b"
},
"name": "sourceControlCheckout"
},
"subpath": "swift-llbuild"
},
{
"basedOn": null,
"packageRef": {
"identity": "swift-system",
"kind": "remoteSourceControl",
"location": "https://github.com/apple/swift-system.git",
"name": "swift-system"
},
"state": {
"checkoutState": {
"revision": "836bc4557b74fe6d2660218d56e3ce96aff76574",
"version": "1.1.1"
},
"name": "sourceControlCheckout"
},
"subpath": "swift-system"
},
{
"basedOn": null,
"packageRef": {
"identity": "swift-tools-support-core",
"kind": "remoteSourceControl",
"location": "https://github.com/apple/swift-tools-support-core.git",
"name": "swift-tools-support-core"
},
"state": {
"checkoutState": {
"branch": "release/5.7",
"revision": "afc0938503bac012f76ceb619d031f63edc4c5f7"
},
"name": "sourceControlCheckout"
},
"subpath": "swift-tools-support-core"
},
{
"basedOn": null,
"packageRef": {
"identity": "yams",
"kind": "remoteSourceControl",
"location": "https://github.com/jpsim/Yams.git",
"name": "Yams"
},
"state": {
"checkoutState": {
"revision": "9ff1cc9327586db4e0c8f46f064b6a82ec1566fa",
"version": "4.0.6"
},
"name": "sourceControlCheckout"
},
"subpath": "Yams"
}
]
},
"version": 5
}
@@ -0,0 +1,17 @@
Tries to parse SDKSettings.plist looking for a Catalyst version map, but we
don't currently support this.
--- a/Sources/SwiftDriver/Toolchains/DarwinToolchain.swift
+++ b/Sources/SwiftDriver/Toolchains/DarwinToolchain.swift
@@ -297,11 +297,7 @@ public final class DarwinToolchain: Toolchain {
debugDescription: "Malformed version string")
}
self.version = version
- if self.canonicalName.hasPrefix("macosx") {
- self.versionMap = try keyedContainer.decode(VersionMap.self, forKey: .versionMap)
- } else {
self.versionMap = VersionMap()
- }
}
@@ -0,0 +1,40 @@
--- a/Sources/SwiftDriver/Jobs/GenericUnixToolchain+LinkerSupport.swift
+++ b/Sources/SwiftDriver/Jobs/GenericUnixToolchain+LinkerSupport.swift
@@ -9,6 +9,7 @@
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
//
//===----------------------------------------------------------------------===//
+import Foundation
import TSCBasic
import SwiftOptions
@@ -116,7 +117,20 @@ extension GenericUnixToolchain {
// just using `clang` and avoid a dependency on the C++ runtime.
let clangTool: Tool =
parsedOptions.hasArgument(.enableExperimentalCxxInterop) ? .clangxx : .clang
- var clangPath = try getToolPath(clangTool)
+
+ // For Nix, prefer linking using the wrapped system clang, instead of using
+ // the unwrapped clang packaged with swift. The latter is unable to link, but
+ // we still want to use it for other purposes (clang importer).
+ var clangPath: AbsolutePath
+ let env = ProcessInfo.processInfo.environment
+ if let nixCC = env["NIX_CC"],
+ let binPath = try? AbsolutePath(validating: "\(nixCC)/bin"),
+ let tool = lookupExecutablePath(filename: parsedOptions.hasArgument(.enableExperimentalCxxInterop)
+ ? "clang++" : "clang",
+ searchPaths: [binPath]) {
+ clangPath = tool
+ } else {
+ clangPath = try getToolPath(clangTool)
if let toolsDirPath = parsedOptions.getLastArgument(.toolsDirectory) {
// FIXME: What if this isn't an absolute path?
let toolsDir = try AbsolutePath(validating: toolsDirPath.asSingle)
@@ -132,6 +146,7 @@ extension GenericUnixToolchain {
commandLine.appendFlag("-B")
commandLine.appendPath(toolsDir)
}
+ } // nixCC
// Executables on Linux get -pie
if targetTriple.os == .linux && linkerOutputType == .executable {
@@ -0,0 +1,28 @@
Swift normally looks for the Clang resource dir in a subdir/symlink of its own
resource dir. We provide a symlink to the Swift build-time Clang as a default
there, but we also here patch a check to try locate it via NIX_CC.
--- a/Sources/SwiftDriver/Jobs/Toolchain+LinkerSupport.swift
+++ b/Sources/SwiftDriver/Jobs/Toolchain+LinkerSupport.swift
@@ -9,6 +9,7 @@
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
//
//===----------------------------------------------------------------------===//
+import Foundation
import TSCBasic
import SwiftOptions
@@ -24,6 +25,13 @@ extension Toolchain {
for targetInfo: FrontendTargetInfo,
parsedOptions: inout ParsedOptions
) throws -> VirtualPath {
+ let env = ProcessInfo.processInfo.environment
+ if let nixCC = env["NIX_CC"] {
+ return try VirtualPath(path: nixCC)
+ .appending(components: "resource-root", "lib",
+ targetInfo.target.triple.platformName(conflatingDarwin: true)!)
+ }
+
return VirtualPath.lookup(targetInfo.runtimeResourcePath.path)
.appending(components: "clang", "lib",
targetInfo.target.triple.platformName(conflatingDarwin: true)!)
@@ -0,0 +1,16 @@
Prevents a user-visible warning on every compilation:
ld: warning: directory not found for option '-L.../MacOSX11.0.sdk/usr/lib/swift'
--- a/Sources/SwiftDriver/Jobs/Toolchain+LinkerSupport.swift
+++ b/Sources/SwiftDriver/Jobs/Toolchain+LinkerSupport.swift
@@ -50,7 +50,9 @@ extension Toolchain {
result.append(sdkPath.appending(components: "System", "iOSSupport", "usr", "lib", "swift"))
}
+ if sdkPath.absolutePath?.pathString.starts(with: "@storeDir@") == false {
result.append(sdkPath.appending(components: "usr", "lib", "swift"))
+ }
}
return result
@@ -0,0 +1,90 @@
# SwiftPM dependencies are normally not installed using CMake, and only provide
# CMake modules to link them together in a build tree. We have separate
# derivations, so need a real install step. Here we provide our own minimal
# CMake modules to install along with the build products.
{ lib, stdenv, swift }:
let
inherit (stdenv.hostPlatform) extensions;
# This file exports shell snippets for use in postInstall.
mkInstallScript = module: template: ''
mkdir -p $out/lib/cmake/${module}
(
export staticLibExt="${extensions.staticLibrary}"
export sharedLibExt="${extensions.sharedLibrary}"
export swiftOs="${swift.swiftOs}"
substituteAll \
${builtins.toFile "${module}Config.cmake" template} \
$out/lib/cmake/${module}/${module}Config.cmake
)
'';
in lib.mapAttrs mkInstallScript {
SwiftSystem = ''
add_library(SwiftSystem::SystemPackage STATIC IMPORTED)
set_property(TARGET SwiftSystem::SystemPackage PROPERTY IMPORTED_LOCATION "@out@/lib/swift_static/@swiftOs@/libSystemPackage@staticLibExt@")
'';
SwiftCollections = ''
add_library(SwiftCollections::Collections STATIC IMPORTED)
set_property(TARGET SwiftCollections::Collections PROPERTY IMPORTED_LOCATION "@out@/lib/swift_static/@swiftOs@/libCollections@staticLibExt@")
add_library(SwiftCollections::DequeModule STATIC IMPORTED)
set_property(TARGET SwiftCollections::DequeModule PROPERTY IMPORTED_LOCATION "@out@/lib/swift_static/@swiftOs@/libDequeModule@staticLibExt@")
add_library(SwiftCollections::OrderedCollections STATIC IMPORTED)
set_property(TARGET SwiftCollections::OrderedCollections PROPERTY IMPORTED_LOCATION "@out@/lib/swift_static/@swiftOs@/libOrderedCollections@staticLibExt@")
'';
TSC = ''
add_library(TSCLibc SHARED IMPORTED)
set_property(TARGET TSCLibc PROPERTY IMPORTED_LOCATION "@out@/lib/libTSCLibc@sharedLibExt@")
add_library(TSCBasic SHARED IMPORTED)
set_property(TARGET TSCBasic PROPERTY IMPORTED_LOCATION "@out@/lib/libTSCBasic@sharedLibExt@")
add_library(TSCUtility SHARED IMPORTED)
set_property(TARGET TSCUtility PROPERTY IMPORTED_LOCATION "@out@/lib/libTSCUtility@sharedLibExt@")
'';
ArgumentParser = ''
add_library(ArgumentParser SHARED IMPORTED)
set_property(TARGET ArgumentParser PROPERTY IMPORTED_LOCATION "@out@/lib/swift/@swiftOs@/libArgumentParser@sharedLibExt@")
add_library(ArgumentParserToolInfo SHARED IMPORTED)
set_property(TARGET ArgumentParserToolInfo PROPERTY IMPORTED_LOCATION "@out@/lib/swift/@swiftOs@/libArgumentParserToolInfo@sharedLibExt@")
'';
Yams = ''
add_library(CYaml SHARED IMPORTED)
set_property(TARGET CYaml PROPERTY IMPORTED_LOCATION "@out@/lib/libCYaml@sharedLibExt@")
add_library(Yams SHARED IMPORTED)
set_property(TARGET Yams PROPERTY IMPORTED_LOCATION "@out@/lib/swift/@swiftOs@/libYams@sharedLibExt@")
'';
LLBuild = ''
add_library(libllbuild SHARED IMPORTED)
set_property(TARGET libllbuild PROPERTY IMPORTED_LOCATION "@out@/lib/libllbuild@sharedLibExt@")
add_library(llbuildSwift SHARED IMPORTED)
set_property(TARGET llbuildSwift PROPERTY IMPORTED_LOCATION "@out@/lib/swift/pm/llbuild/libllbuildSwift@sharedLibExt@")
'';
SwiftDriver = ''
add_library(SwiftDriver SHARED IMPORTED)
set_property(TARGET SwiftDriver PROPERTY IMPORTED_LOCATION "@out@/lib/libSwiftDriver@sharedLibExt@")
add_library(SwiftDriverExecution SHARED IMPORTED)
set_property(TARGET SwiftDriverExecution PROPERTY IMPORTED_LOCATION "@out@/lib/libSwiftDriverExecution@sharedLibExt@")
add_library(SwiftOptions SHARED IMPORTED)
set_property(TARGET SwiftOptions PROPERTY IMPORTED_LOCATION "@out@/lib/libSwiftOptions@sharedLibExt@")
'';
SwiftCrypto = ''
add_library(Crypto SHARED IMPORTED)
set_property(TARGET Crypto PROPERTY IMPORTED_LOCATION "@out@/lib/swift/@swiftOs@/libCrypto@sharedLibExt@")
'';
}
@@ -0,0 +1,418 @@
{ lib
, stdenv
, callPackage
, cmake
, ninja
, git
, swift
, swiftpm2nix
, Foundation
, XCTest
, sqlite
, ncurses
, substituteAll
, runCommandLocal
, makeWrapper
, DarwinTools # sw_vers
, cctools # vtool
, xcbuild
, CryptoKit
, LocalAuthentication
}:
let
inherit (swift) swiftOs swiftModuleSubdir swiftStaticModuleSubdir;
sharedLibraryExt = stdenv.hostPlatform.extensions.sharedLibrary;
sources = callPackage ../sources.nix { };
generated = swiftpm2nix.helpers ./generated;
cmakeGlue = callPackage ./cmake-glue.nix { };
# Common attributes for the bootstrap swiftpm and the final swiftpm.
commonAttrs = {
inherit (sources) version;
src = sources.swift-package-manager;
nativeBuildInputs = [ makeWrapper ];
# Required at run-time for the host platform to build package manifests.
propagatedBuildInputs = [ Foundation ];
patches = [
./patches/cmake-disable-rpath.patch
./patches/disable-sandbox.patch
./patches/fix-clang-cxx.patch
(substituteAll {
src = ./patches/disable-xctest.patch;
inherit (builtins) storeDir;
})
(substituteAll {
src = ./patches/fix-stdlib-path.patch;
inherit (builtins) storeDir;
swiftLib = swift.swift.lib;
})
];
postPatch = ''
# The location of xcrun is hardcoded. We need PATH lookup instead.
find Sources -name '*.swift' | xargs sed -i -e 's|/usr/bin/xcrun|xcrun|g'
# Patch the location where swiftpm looks for its API modules.
substituteInPlace Sources/PackageModel/UserToolchain.swift \
--replace \
'librariesPath = applicationPath.parentDirectory' \
"librariesPath = AbsolutePath(\"$out\")"
'';
};
# Tools invoked by swiftpm at run-time.
runtimeDeps = [ git ]
++ lib.optionals stdenv.isDarwin [
xcbuild.xcrun
# vtool is used to determine a minimum deployment target. This is part of
# cctools, but adding that as a build input puts an unwrapped linker in
# PATH, and breaks builds. This small derivation exposes just vtool.
(runCommandLocal "vtool" { } ''
mkdir -p $out/bin
ln -s ${cctools}/bin/vtool $out/bin/vtool
'')
];
# Common attributes for the bootstrap derivations.
mkBootstrapDerivation = attrs: stdenv.mkDerivation (attrs // {
nativeBuildInputs = (attrs.nativeBuildInputs or [ ])
++ [ cmake ninja swift ]
++ lib.optionals stdenv.isDarwin [ DarwinTools ];
buildInputs = (attrs.buildInputs or [ ])
++ [ Foundation ];
postPatch = (attrs.postPatch or "")
+ lib.optionalString stdenv.isDarwin ''
# On Darwin only, Swift uses arm64 as cpu arch.
if [ -e cmake/modules/SwiftSupport.cmake ]; then
substituteInPlace cmake/modules/SwiftSupport.cmake \
--replace '"aarch64" PARENT_SCOPE' '"arm64" PARENT_SCOPE'
fi
'';
preConfigure = (attrs.preConfigure or "")
+ ''
# Builds often don't set a target, and our default minimum macOS deployment
# target on x86_64-darwin is too low. Harmless on non-Darwin.
export MACOSX_DEPLOYMENT_TARGET=10.15.4
'';
postInstall = (attrs.postInstall or "")
+ lib.optionalString stdenv.isDarwin ''
# The install name of libraries is incorrectly set to lib/ (via our
# CMake setup hook) instead of lib/swift/. This'd be easily fixed by
# fixDarwinDylibNames, but some builds create libraries that reference
# eachother, and we also have to fix those references.
dylibs="$(find $out/lib/swift* -name '*.dylib')"
changes=""
for dylib in $dylibs; do
changes+=" -change $(otool -D $dylib | tail -n 1) $dylib"
done
for dylib in $dylibs; do
install_name_tool -id $dylib $changes $dylib
done
'';
cmakeFlags = (attrs.cmakeFlags or [ ])
++ [
# Some builds link to libraries within the same build. Make sure these
# create references to $out. None of our builds run their own products,
# so we don't have to account for that scenario.
"-DCMAKE_BUILD_WITH_INSTALL_NAME_DIR=ON"
];
});
# On Darwin, we only want ncurses in the linker search path, because headers
# are part of libsystem. Adding its headers to the search path causes strange
# mixing and errors.
# TODO: Find a better way to prevent this conflict.
ncursesInput = if stdenv.isDarwin then ncurses.out else ncurses;
# Derivations for bootstrapping dependencies using CMake.
# This is based on the `swiftpm/Utilities/bootstrap` script.
#
# Some of the installation steps here are a bit hacky, because it seems like
# these packages were not really meant to be installed using CMake. The
# regular swiftpm bootstrap simply refers to the source and build
# directories. The advantage of separate builds is that we can more easily
# link libs together using existing Nixpkgs infra.
#
# In the end, we don't expose these derivations, and they only exist during
# the bootstrap phase. The final swiftpm derivation does not depend on them.
swift-system = mkBootstrapDerivation {
name = "swift-system";
src = generated.sources.swift-system;
postInstall = cmakeGlue.SwiftSystem
+ lib.optionalString (!stdenv.isDarwin) ''
# The cmake rules apparently only use the Darwin install convention.
# Fix up the installation so the module can be found on non-Darwin.
mkdir -p $out/${swiftStaticModuleSubdir}
mv $out/lib/swift_static/${swiftOs}/*.swiftmodule $out/${swiftStaticModuleSubdir}/
'';
};
swift-collections = mkBootstrapDerivation {
name = "swift-collections";
src = generated.sources.swift-collections;
postPatch = ''
# Only builds static libs on Linux, but this installation difference is a
# hassle. Because this installation is temporary for the bootstrap, may
# as well build static libs everywhere.
sed -i -e '/BUILD_SHARED_LIBS/d' CMakeLists.txt
'';
postInstall = cmakeGlue.SwiftCollections
+ lib.optionalString (!stdenv.isDarwin) ''
# The cmake rules apparently only use the Darwin install convention.
# Fix up the installation so the module can be found on non-Darwin.
mkdir -p $out/${swiftStaticModuleSubdir}
mv $out/lib/swift_static/${swiftOs}/*.swiftmodule $out/${swiftStaticModuleSubdir}/
'';
};
swift-tools-support-core = mkBootstrapDerivation {
name = "swift-tools-support-core";
src = generated.sources.swift-tools-support-core;
buildInputs = [
swift-system
sqlite
];
postInstall = cmakeGlue.TSC + ''
# Swift modules are not installed.
mkdir -p $out/${swiftModuleSubdir}
cp swift/*.swift{module,doc} $out/${swiftModuleSubdir}/
# Static libs are not installed.
cp lib/*.a $out/lib/
# Headers are not installed.
mkdir -p $out/include
cp -r ../Sources/TSCclibc/include $out/include/TSC
'';
};
swift-argument-parser = mkBootstrapDerivation {
name = "swift-argument-parser";
src = generated.sources.swift-argument-parser;
buildInputs = [ ncursesInput sqlite ];
cmakeFlags = [
"-DBUILD_TESTING=NO"
"-DBUILD_EXAMPLES=NO"
];
postInstall = cmakeGlue.ArgumentParser
+ lib.optionalString stdenv.isLinux ''
# Fix rpath so ArgumentParserToolInfo can be found.
patchelf --add-rpath "$out/lib/swift/${swiftOs}" \
$out/lib/swift/${swiftOs}/libArgumentParser.so
'';
};
Yams = mkBootstrapDerivation {
name = "Yams";
src = generated.sources.Yams;
# Conflicts with BUILD file on case-insensitive filesystems.
cmakeBuildDir = "_build";
postInstall = cmakeGlue.Yams;
};
llbuild = mkBootstrapDerivation {
name = "llbuild";
src = generated.sources.swift-llbuild;
nativeBuildInputs = lib.optional stdenv.isDarwin xcbuild;
buildInputs = [ ncursesInput sqlite ];
patches = [
./patches/llbuild-cmake-disable-rpath.patch
];
postPatch = ''
# Substitute ncurses for curses.
find . -name CMakeLists.txt | xargs sed -i -e 's/curses/ncurses/'
# Use absolute install names instead of rpath.
substituteInPlace \
products/libllbuild/CMakeLists.txt \
products/llbuildSwift/CMakeLists.txt \
--replace '@rpath' "$out/lib"
# This subdirectory is enabled for Darwin only, but requires ObjC XCTest
# (and only Swift XCTest is open source).
substituteInPlace perftests/CMakeLists.txt \
--replace 'add_subdirectory(Xcode/' '#add_subdirectory(Xcode/'
'';
cmakeFlags = [
"-DLLBUILD_SUPPORT_BINDINGS=Swift"
];
postInstall = cmakeGlue.LLBuild + ''
# Install module map.
cp ../products/libllbuild/include/module.modulemap $out/include
# Swift modules are not installed.
mkdir -p $out/${swiftModuleSubdir}
cp products/llbuildSwift/*.swift{module,doc} $out/${swiftModuleSubdir}/
'';
};
swift-driver = mkBootstrapDerivation {
name = "swift-driver";
src = generated.sources.swift-driver;
buildInputs = [
Yams
llbuild
swift-system
swift-argument-parser
swift-tools-support-core
];
postInstall = cmakeGlue.SwiftDriver + ''
# Swift modules are not installed.
mkdir -p $out/${swiftModuleSubdir}
cp swift/*.swift{module,doc} $out/${swiftModuleSubdir}/
'';
};
swift-crypto = mkBootstrapDerivation {
name = "swift-crypto";
src = generated.sources.swift-crypto;
postPatch = ''
substituteInPlace CMakeLists.txt \
--replace /usr/bin/ar $NIX_CC/bin/ar
'';
postInstall = cmakeGlue.SwiftCrypto + ''
# Static libs are not installed.
cp lib/*.a $out/lib/
# Headers are not installed.
cp -r ../Sources/CCryptoBoringSSL/include $out/include
'';
};
# Build a bootrapping swiftpm using CMake.
swiftpm-bootstrap = mkBootstrapDerivation (commonAttrs // {
pname = "swiftpm-bootstrap";
buildInputs = [
llbuild
swift-argument-parser
swift-collections
swift-crypto
swift-driver
swift-system
swift-tools-support-core
];
cmakeFlags = [
"-DUSE_CMAKE_INSTALL=ON"
];
postInstall = ''
for program in $out/bin/swift-*; do
wrapProgram $program --prefix PATH : ${lib.makeBinPath runtimeDeps}
done
'';
});
# Build the final swiftpm with the bootstrapping swiftpm.
in stdenv.mkDerivation (commonAttrs // {
pname = "swiftpm";
nativeBuildInputs = commonAttrs.nativeBuildInputs ++ [
swift
swiftpm-bootstrap
];
buildInputs = [
ncursesInput
sqlite
XCTest
]
++ lib.optionals stdenv.isDarwin [
CryptoKit
LocalAuthentication
];
configurePhase = generated.configure + ''
# Functionality provided by Xcode XCTest, but not available in
# swift-corelibs-xctest.
swiftpmMakeMutable swift-tools-support-core
substituteInPlace .build/checkouts/swift-tools-support-core/Sources/TSCTestSupport/XCTestCasePerf.swift \
--replace 'canImport(Darwin)' 'false'
# Prevent a warning about SDK directories we don't have.
swiftpmMakeMutable swift-driver
patch -p1 -d .build/checkouts/swift-driver -i ${substituteAll {
src = ../swift-driver/patches/prevent-sdk-dirs-warnings.patch;
inherit (builtins) storeDir;
}}
'';
buildPhase = ''
# Required to link with swift-corelibs-xctest on Darwin.
export SWIFTTSC_MACOS_DEPLOYMENT_TARGET=10.12
TERM=dumb swift-build -c release
'';
# TODO: Tests depend on indexstore-db being provided by an existing Swift
# toolchain. (ie. looks for `../lib/libIndexStore.so` relative to swiftc.
#doCheck = true;
#checkPhase = ''
# TERM=dumb swift-test -c release
#'';
# The following is dervied from Utilities/bootstrap, see install_swiftpm.
installPhase = ''
binPath="$(swift-build --show-bin-path -c release)"
mkdir -p $out/bin $out/lib/swift
cp $binPath/swift-package $out/bin/
wrapProgram $out/bin/swift-package \
--prefix PATH : ${lib.makeBinPath runtimeDeps}
for tool in swift-build swift-test swift-run swift-package-collection; do
ln -s $out/bin/swift-package $out/bin/$tool
done
installSwiftpmModule() {
mkdir -p $out/lib/swift/pm/$2
cp $binPath/lib$1${sharedLibraryExt} $out/lib/swift/pm/$2/
if [[ -f $binPath/$1.swiftinterface ]]; then
cp $binPath/$1.swiftinterface $out/lib/swift/pm/$2/
else
cp -r $binPath/$1.swiftmodule $out/lib/swift/pm/$2/
fi
cp $binPath/$1.swiftdoc $out/lib/swift/pm/$2/
}
installSwiftpmModule PackageDescription ManifestAPI
installSwiftpmModule PackagePlugin PluginAPI
'';
setupHook = ./setup-hook.sh;
meta = {
description = "The Package Manager for the Swift Programming Language";
homepage = "https://github.com/apple/swift-package-manager";
platforms = with lib.platforms; linux ++ darwin;
license = lib.licenses.asl20;
maintainers = with lib.maintainers; [ dtzWill trepetti dduan trundle stephank ];
};
})
@@ -0,0 +1,14 @@
# This file was generated by swiftpm2nix.
{
workspaceStateFile = ./workspace-state.json;
hashes = {
"swift-argument-parser" = "1jph9w7lk9nr20fsv2c8p4hisx3dda817fh7pybd0r0j1jwa9nmw";
"swift-collections" = "0l0pv16zil3n7fac7mdf5qxklxr5rwiig5bixgca1ybq7arlnv7i";
"swift-crypto" = "020b8q4ss2k7a65r5dgh59z40i6sn7ij1allxkh8c8a9d0jzn313";
"swift-driver" = "1lcb5wqragc74nd0fjnk47lyph9hs0i9cps1mplvp2i91yzjqk05";
"swift-llbuild" = "07zbp2dyfqd1bnyg7snpr9brn40jf22ivly5v10mql3hrg76a18h";
"swift-system" = "0402hkx2q2dv27gccnn8ma79ngvwiwzkhcv4zlcdldmy6cgi0px7";
"swift-tools-support-core" = "1vabl1z5sm2lrd75f5c781rkrq0liinpjvnrjr6i6r8cqrp0q5jb";
"Yams" = "1893y13sis2aimi1a5kgkczbf06z4yig054xb565yg2xm13srb45";
};
}
@@ -0,0 +1,144 @@
{
"object": {
"artifacts": [],
"dependencies": [
{
"basedOn": null,
"packageRef": {
"identity": "swift-argument-parser",
"kind": "remoteSourceControl",
"location": "https://github.com/apple/swift-argument-parser.git",
"name": "swift-argument-parser"
},
"state": {
"checkoutState": {
"revision": "e394bf350e38cb100b6bc4172834770ede1b7232",
"version": "1.0.3"
},
"name": "sourceControlCheckout"
},
"subpath": "swift-argument-parser"
},
{
"basedOn": null,
"packageRef": {
"identity": "swift-collections",
"kind": "remoteSourceControl",
"location": "https://github.com/apple/swift-collections.git",
"name": "swift-collections"
},
"state": {
"checkoutState": {
"revision": "f504716c27d2e5d4144fa4794b12129301d17729",
"version": "1.0.3"
},
"name": "sourceControlCheckout"
},
"subpath": "swift-collections"
},
{
"basedOn": null,
"packageRef": {
"identity": "swift-crypto",
"kind": "remoteSourceControl",
"location": "https://github.com/apple/swift-crypto.git",
"name": "swift-crypto"
},
"state": {
"checkoutState": {
"revision": "ddb07e896a2a8af79512543b1c7eb9797f8898a5",
"version": "1.1.7"
},
"name": "sourceControlCheckout"
},
"subpath": "swift-crypto"
},
{
"basedOn": null,
"packageRef": {
"identity": "swift-driver",
"kind": "remoteSourceControl",
"location": "https://github.com/apple/swift-driver.git",
"name": "swift-driver"
},
"state": {
"checkoutState": {
"branch": "release/5.7",
"revision": "82b274af66cfbb8f3131677676517b34d01e30fd"
},
"name": "sourceControlCheckout"
},
"subpath": "swift-driver"
},
{
"basedOn": null,
"packageRef": {
"identity": "swift-llbuild",
"kind": "remoteSourceControl",
"location": "https://github.com/apple/swift-llbuild.git",
"name": "llbuild"
},
"state": {
"checkoutState": {
"branch": "release/5.7",
"revision": "564424db5fdb62dcb5d863bdf7212500ef03a87b"
},
"name": "sourceControlCheckout"
},
"subpath": "swift-llbuild"
},
{
"basedOn": null,
"packageRef": {
"identity": "swift-system",
"kind": "remoteSourceControl",
"location": "https://github.com/apple/swift-system.git",
"name": "swift-system"
},
"state": {
"checkoutState": {
"revision": "836bc4557b74fe6d2660218d56e3ce96aff76574",
"version": "1.1.1"
},
"name": "sourceControlCheckout"
},
"subpath": "swift-system"
},
{
"basedOn": null,
"packageRef": {
"identity": "swift-tools-support-core",
"kind": "remoteSourceControl",
"location": "https://github.com/apple/swift-tools-support-core.git",
"name": "swift-tools-support-core"
},
"state": {
"checkoutState": {
"branch": "release/5.7",
"revision": "afc0938503bac012f76ceb619d031f63edc4c5f7"
},
"name": "sourceControlCheckout"
},
"subpath": "swift-tools-support-core"
},
{
"basedOn": null,
"packageRef": {
"identity": "yams",
"kind": "remoteSourceControl",
"location": "https://github.com/jpsim/Yams.git",
"name": "Yams"
},
"state": {
"checkoutState": {
"revision": "9ff1cc9327586db4e0c8f46f064b6a82ec1566fa",
"version": "4.0.6"
},
"name": "sourceControlCheckout"
},
"subpath": "Yams"
}
]
},
"version": 5
}
@@ -0,0 +1,36 @@
Disable rpath for the bootstrap build with CMake.
--- a/Sources/PackageDescription/CMakeLists.txt
+++ b/Sources/PackageDescription/CMakeLists.txt
@@ -31,14 +31,11 @@ if(CMAKE_HOST_SYSTEM_NAME STREQUAL Darwin)
set(SWIFT_INTERFACE_PATH ${CMAKE_BINARY_DIR}/pm/ManifestAPI/PackageDescription.swiftinterface)
target_compile_options(PackageDescription PUBLIC
$<$<COMPILE_LANGUAGE:Swift>:-emit-module-interface-path$<SEMICOLON>${SWIFT_INTERFACE_PATH}>)
- target_link_options(PackageDescription PRIVATE
- "SHELL:-Xlinker -install_name -Xlinker @rpath/libPackageDescription.dylib")
endif()
set_target_properties(PackageDescription PROPERTIES
Swift_MODULE_NAME PackageDescription
Swift_MODULE_DIRECTORY ${CMAKE_BINARY_DIR}/pm/ManifestAPI
- INSTALL_NAME_DIR \\@rpath
OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/pm/ManifestAPI
OUTPUT_NAME PackageDescription
ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/pm/ManifestAPI
--- a/Sources/PackagePlugin/CMakeLists.txt
+++ b/Sources/PackagePlugin/CMakeLists.txt
@@ -29,14 +29,11 @@ if(CMAKE_HOST_SYSTEM_NAME STREQUAL Darwin)
set(SWIFT_INTERFACE_PATH ${CMAKE_BINARY_DIR}/pm/PluginAPI/PackagePlugin.swiftinterface)
target_compile_options(PackagePlugin PUBLIC
$<$<COMPILE_LANGUAGE:Swift>:-emit-module-interface-path$<SEMICOLON>${SWIFT_INTERFACE_PATH}>)
- target_link_options(PackagePlugin PRIVATE
- "SHELL:-Xlinker -install_name -Xlinker @rpath/libPackagePlugin.dylib")
endif()
set_target_properties(PackagePlugin PROPERTIES
Swift_MODULE_NAME PackagePlugin
Swift_MODULE_DIRECTORY ${CMAKE_BINARY_DIR}/pm/PluginAPI
- INSTALL_NAME_DIR \\@rpath
OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/pm/PluginAPI
OUTPUT_NAME PackagePlugin
ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/pm/PluginAPI
@@ -0,0 +1,21 @@
Nix may already sandbox the build, in which case sandbox_apply will fail.
--- a/Sources/Basics/Sandbox.swift
+++ b/Sources/Basics/Sandbox.swift
@@ -30,12 +30,14 @@ public enum Sandbox {
readOnlyDirectories: [AbsolutePath] = []
) -> [String] {
#if os(macOS)
+ let env = ProcessInfo.processInfo.environment
+ if env["NIX_BUILD_TOP"] == nil || env["IN_NIX_SHELL"] != nil {
let profile = macOSSandboxProfile(strictness: strictness, writableDirectories: writableDirectories, readOnlyDirectories: readOnlyDirectories)
return ["/usr/bin/sandbox-exec", "-p", profile] + command
- #else
+ }
+ #endif
// rdar://40235432, rdar://75636874 tracks implementing sandboxes for other platforms.
return command
- #endif
}
/// Basic strictness level of a sandbox applied to a command line.
@@ -0,0 +1,48 @@
XCTest is not fully open-source, only the Swift library parts. We don't have a
command-line runner available, so disable support.
--- a/Sources/Commands/TestingSupport.swift
+++ b/Sources/Commands/TestingSupport.swift
@@ -60,7 +60,7 @@ enum TestingSupport {
/// - Returns: Array of TestSuite
static func getTestSuites(fromTestAt path: AbsolutePath, swiftTool: SwiftTool, swiftOptions: SwiftToolOptions) throws -> [TestSuite] {
// Run the correct tool.
- #if os(macOS)
+ #if false
let data: String = try withTemporaryFile { tempFile in
let args = [try TestingSupport.xctestHelperPath(swiftTool: swiftTool).pathString, path.pathString, tempFile.path.pathString]
var env = try TestingSupport.constructTestEnvironment(toolchain: try swiftTool.getToolchain(), options: swiftOptions, buildParameters: swiftTool.buildParametersForTest())
--- a/Sources/swiftpm-xctest-helper/main.swift
+++ b/Sources/swiftpm-xctest-helper/main.swift
@@ -9,8 +9,11 @@
*/
#if os(macOS)
-import XCTest
import func Darwin.C.exit
+print("Not supported in Nix.")
+exit(1)
+#if false
+import XCTest
/// A helper tool to get list of tests from a XCTest Bundle on macOS.
///
@@ -132,6 +135,7 @@ do {
exit(1)
}
+#endif // nix
#else
#if os(Windows)
--- a/Sources/PackageModel/Destination.swift
+++ b/Sources/PackageModel/Destination.swift
@@ -174,7 +174,7 @@ public struct Destination: Encodable, Equatable {
arguments: ["/usr/bin/xcrun", "--sdk", "macosx", "--show-sdk-platform-path"],
environment: environment).spm_chomp()
- if let platformPath = platformPath, !platformPath.isEmpty {
+ if let platformPath = platformPath, !platformPath.isEmpty && !platformPath.starts(with: "@storeDir@") {
// For XCTest framework.
let fwk = AbsolutePath(platformPath).appending(
components: "Developer", "Library", "Frameworks")
@@ -0,0 +1,121 @@
Swiftpm may invoke clang, not clang++, to compile C++. Our cc-wrapper also
doesn't pick up the arguments that enable C++ compilation in this case. Patch
swiftpm to properly invoke clang++.
--- a/Sources/Build/LLBuildManifestBuilder.swift
+++ b/Sources/Build/LLBuildManifestBuilder.swift
@@ -782,7 +782,7 @@ extension LLBuildManifestBuilder {
args += ["-c", path.source.pathString, "-o", path.object.pathString]
- let clangCompiler = try buildParameters.toolchain.getClangCompiler().pathString
+ let clangCompiler = try buildParameters.toolchain.getClangCompiler(isCXX: isCXX).pathString
args.insert(clangCompiler, at: 0)
let objectFileNode: Node = .file(path.object)
--- a/Sources/PackageModel/Destination.swift
+++ b/Sources/PackageModel/Destination.swift
@@ -153,7 +153,7 @@ public struct Destination: Encodable, Equatable {
var extraCPPFlags: [String] = []
#if os(macOS)
- extraCPPFlags += ["-lc++"]
+ extraCPPFlags += ["-lc++", "-lc++abi"]
#elseif os(Windows)
extraCPPFlags += []
#else
--- a/Sources/PackageModel/Toolchain.swift
+++ b/Sources/PackageModel/Toolchain.swift
@@ -20,7 +20,7 @@ public protocol Toolchain {
var macosSwiftStdlib: AbsolutePath { get }
/// Path of the `clang` compiler.
- func getClangCompiler() throws -> AbsolutePath
+ func getClangCompiler(isCXX: Bool) throws -> AbsolutePath
// FIXME: This is a temporary API until index store is widely available in
// the OSS clang compiler. This API should not used for any other purpose.
--- a/Sources/PackageModel/UserToolchain.swift
+++ b/Sources/PackageModel/UserToolchain.swift
@@ -57,7 +57,7 @@ public final class UserToolchain: Toolchain {
/// Only use search paths, do not fall back to `xcrun`.
let useXcrun: Bool
- private var _clangCompiler: AbsolutePath?
+ private var _clangCompiler: [Bool: AbsolutePath] = [:]
private let environment: EnvironmentVariables
@@ -150,29 +150,31 @@ public final class UserToolchain: Toolchain {
}
/// Returns the path to clang compiler tool.
- public func getClangCompiler() throws -> AbsolutePath {
+ public func getClangCompiler(isCXX: Bool) throws -> AbsolutePath {
// Check if we already computed.
- if let clang = self._clangCompiler {
+ if let clang = self._clangCompiler[isCXX] {
return clang
}
// Check in the environment variable first.
- if let toolPath = UserToolchain.lookup(variable: "CC", searchPaths: self.envSearchPaths, environment: environment) {
- self._clangCompiler = toolPath
+ let envVar = isCXX ? "CXX" : "CC";
+ if let toolPath = UserToolchain.lookup(variable: envVar, searchPaths: self.envSearchPaths, environment: environment) {
+ self._clangCompiler[isCXX] = toolPath
return toolPath
}
// Then, check the toolchain.
+ let tool = isCXX ? "clang++" : "clang";
do {
- if let toolPath = try? UserToolchain.getTool("clang", binDir: self.destination.binDir) {
- self._clangCompiler = toolPath
+ if let toolPath = try? UserToolchain.getTool(tool, binDir: self.destination.binDir) {
+ self._clangCompiler[isCXX] = toolPath
return toolPath
}
}
// Otherwise, lookup it up on the system.
- let toolPath = try UserToolchain.findTool("clang", envSearchPaths: self.envSearchPaths, useXcrun: useXcrun)
- self._clangCompiler = toolPath
+ let toolPath = try UserToolchain.findTool(tool, envSearchPaths: self.envSearchPaths, useXcrun: useXcrun)
+ self._clangCompiler[isCXX] = toolPath
return toolPath
}
--- a/Sources/SPMBuildCore/BuildParameters.swift
+++ b/Sources/SPMBuildCore/BuildParameters.swift
@@ -342,7 +342,7 @@ private struct _Toolchain: Encodable {
public func encode(to encoder: Encoder) throws {
var container = encoder.container(keyedBy: CodingKeys.self)
try container.encode(toolchain.swiftCompilerPath, forKey: .swiftCompiler)
- try container.encode(toolchain.getClangCompiler(), forKey: .clangCompiler)
+ try container.encode(toolchain.getClangCompiler(isCXX: false), forKey: .clangCompiler)
try container.encode(toolchain.extraCCFlags, forKey: .extraCCFlags)
try container.encode(toolchain.extraCPPFlags, forKey: .extraCPPFlags)
--- a/Sources/XCBuildSupport/XcodeBuildSystem.swift
+++ b/Sources/XCBuildSupport/XcodeBuildSystem.swift
@@ -172,7 +172,7 @@ public final class XcodeBuildSystem: SPMBuildCore.BuildSystem {
// Generate a table of any overriding build settings.
var settings: [String: String] = [:]
// An error with determining the override should not be fatal here.
- settings["CC"] = try? buildParameters.toolchain.getClangCompiler().pathString
+ settings["CC"] = try? buildParameters.toolchain.getClangCompiler(isCXX: false).pathString
// Always specify the path of the effective Swift compiler, which was determined in the same way as for the native build system.
settings["SWIFT_EXEC"] = buildParameters.toolchain.swiftCompilerPath.pathString
settings["LIBRARY_SEARCH_PATHS"] = "$(inherited) \(buildParameters.toolchain.toolchainLibDir.pathString)"
--- a/Tests/BuildTests/MockBuildTestHelper.swift
+++ b/Tests/BuildTests/MockBuildTestHelper.swift
@@ -15,7 +15,7 @@ struct MockToolchain: PackageModel.Toolchain {
#else
let extraCPPFlags: [String] = ["-lstdc++"]
#endif
- func getClangCompiler() throws -> AbsolutePath {
+ func getClangCompiler(isCXX: Bool) throws -> AbsolutePath {
return AbsolutePath("/fake/path/to/clang")
}
@@ -0,0 +1,23 @@
Swiftpm looks for the Swift stdlib relative to the swift compiler, but that's a
wrapper in our case. It wants to add the stdlib to the rpath, which is
necessary for back-deployment of some features.
--- a/Sources/PackageModel/Toolchain.swift
+++ b/Sources/PackageModel/Toolchain.swift
@@ -43,10 +43,16 @@ extension Toolchain {
}
public var macosSwiftStdlib: AbsolutePath {
+ if swiftCompilerPath.pathString.starts(with: "@storeDir@") {
+ return AbsolutePath("@swiftLib@/lib/swift/macosx")
+ }
return AbsolutePath("../../lib/swift/macosx", relativeTo: resolveSymlinks(swiftCompilerPath))
}
public var toolchainLibDir: AbsolutePath {
+ if swiftCompilerPath.pathString.starts(with: "@storeDir@") {
+ return AbsolutePath("@swiftLib@/lib")
+ }
// FIXME: Not sure if it's better to base this off of Swift compiler or our own binary.
return AbsolutePath("../../lib", relativeTo: resolveSymlinks(swiftCompilerPath))
}

Some files were not shown because too many files have changed in this diff Show More