3
0
Fork 0
forked from mirrors/nixpkgs

darwin/stdenv: assemble full clang toolchain

Adapted from main expression for clang 7.
This commit is contained in:
Andrew Childs 2020-07-31 23:03:51 +09:00
parent 7f1a82d476
commit 86ee107a15

View file

@ -24,6 +24,8 @@ assert crossSystem == localSystem;
let
inherit (localSystem) system platform;
bootstrapClangVersion = "7.1.0";
commonImpureHostDeps = [
"/bin/sh"
"/usr/lib/libSystem.B.dylib"
@ -90,7 +92,18 @@ in rec {
inherit shell;
inherit (last) stdenvNoCC;
extraPackages = [];
extraPackages = [
# last.pkgs.llvmPackages_7.libcxxabi # TODO: is this required? if not, why not?
last.pkgs.llvmPackages_7.compiler-rt
];
extraBuildCommands = ''
rsrc="$out/resource-root"
mkdir "$rsrc"
ln -s "${bootstrapTools}/lib/clang/${bootstrapClangVersion}/include" "$rsrc"
ln -s "${last.pkgs.llvmPackages_7.compiler-rt.out}/lib" "$rsrc/lib"
echo "-resource-dir=$rsrc" >> $out/nix-support/cc-cflags
'';
nativeTools = false;
nativeLibc = false;
@ -180,6 +193,15 @@ in rec {
ln -s ${bootstrapTools}/lib/libc++abi.dylib $out/lib/libc++abi.dylib
'';
};
compiler-rt = stdenv.mkDerivation {
name = "bootstrap-stage0-compiler-rt";
buildCommand = ''
mkdir -p $out/lib
ln -s ${bootstrapTools}/lib/libclang_rt* $out/lib
ln -s ${bootstrapTools}/lib/darwin $out/lib/darwin
'';
};
};
};
@ -195,6 +217,12 @@ in rec {
python3 = super.python3Minimal;
ninja = super.ninja.override { buildDocs = false; };
llvmPackages_7 = super.llvmPackages_7 // (let
libraries = super.llvmPackages_7.libraries.extend (_: _: {
inherit (llvmPackages_7) compiler-rt;
});
in { inherit libraries; } // libraries);
};
in with prevStage; stageFun 1 prevStage {
extraPreHook = "export NIX_CFLAGS_COMPILE+=\" -F${bootstrapTools}/Library/Frameworks\"";
@ -203,7 +231,9 @@ in rec {
libcxx = pkgs.libcxx;
allowedRequisites =
[ bootstrapTools ] ++ (with pkgs; [ libcxx libcxxabi ]) ++ [ pkgs.darwin.Libsystem ];
[ bootstrapTools ] ++
(with pkgs; [ libcxx libcxxabi llvmPackages_7.compiler-rt ]) ++
(with pkgs.darwin; [ Libsystem ]);
overrides = persistent;
};
@ -217,6 +247,12 @@ in rec {
findfreetype libssh curl cmake autoconf automake libtool ed cpio coreutils
libssh2 nghttp2 libkrb5 ninja;
llvmPackages_7 = super.llvmPackages_7 // (let
libraries = super.llvmPackages_7.libraries.extend (_: _: {
inherit (llvmPackages_7) compiler-rt;
});
in { inherit libraries; } // libraries);
darwin = super.darwin // {
inherit (darwin)
dyld Libsystem xnu configd ICU libdispatch libclosure launchd CF;
@ -234,8 +270,8 @@ in rec {
allowedRequisites =
[ bootstrapTools ] ++
(with pkgs; [
xz.bin xz.out libcxx libcxxabi zlib libxml2.out curl.out openssl.out libssh2.out
nghttp2.lib libkrb5
xz.bin xz.out libcxx libcxxabi llvmPackages_7.compiler-rt zlib
libxml2.out curl.out openssl.out libssh2.out nghttp2.lib libkrb5
]) ++
(with pkgs.darwin; [ dyld Libsystem CF ICU locale ]);
@ -284,8 +320,8 @@ in rec {
allowedRequisites =
[ bootstrapTools ] ++
(with pkgs; [
xz.bin xz.out bash libcxx libcxxabi zlib libxml2.out curl.out openssl.out libssh2.out
nghttp2.lib libkrb5
xz.bin xz.out bash libcxx libcxxabi llvmPackages_7.compiler-rt zlib
libxml2.out curl.out openssl.out libssh2.out nghttp2.lib libkrb5
]) ++
(with pkgs.darwin; [ dyld ICU Libsystem locale ]);