Merge pull request #93912 from thefloweringash/cctools-tapi

stdenv/darwin: enable tapi support in cctools
This commit is contained in:
Matthew Bauer 2020-09-10 23:23:52 -05:00 committed by GitHub
commit 61517de024
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 27 additions and 18 deletions

View File

@ -1,4 +1,4 @@
{ lib, stdenv, fetchFromGitHub, cmake, python3, clang_6 }: { lib, stdenv, fetchFromGitHub, cmake, python3, ncurses }:
stdenv.mkDerivation { stdenv.mkDerivation {
name = "libtapi-1000.10.8"; name = "libtapi-1000.10.8";
@ -9,22 +9,36 @@ stdenv.mkDerivation {
sha256 = "1a19h39a48agvnmal99n9j1fjadiqwib7hfzmn342wmgh9z3vk0g"; sha256 = "1a19h39a48agvnmal99n9j1fjadiqwib7hfzmn342wmgh9z3vk0g";
}; };
nativeBuildInputs = [ cmake python3 ]; sourceRoot = "source/src/llvm";
buildInputs = [ clang_6.cc ];
preConfigure = '' nativeBuildInputs = [ cmake python3 ];
cd src/llvm
''; # ncurses is required here to avoid a reference to bootstrap-tools, which is
# not allowed for the stdenv.
buildInputs = [ ncurses ];
cmakeFlags = [ "-DLLVM_INCLUDE_TESTS=OFF" ]; cmakeFlags = [ "-DLLVM_INCLUDE_TESTS=OFF" ];
buildFlags = [ "libtapi" ]; # fixes: fatal error: 'clang/Basic/Diagnostic.h' file not found
# adapted from upstream
# https://github.com/tpoechtrager/apple-libtapi/blob/3cb307764cc5f1856c8a23bbdf3eb49dfc6bea48/build.sh#L58-L60
preConfigure = ''
INCLUDE_FIX="-I $PWD/projects/clang/include"
INCLUDE_FIX+=" -I $PWD/build/projects/clang/include"
installTarget = "install-libtapi"; cmakeFlagsArray+=(-DCMAKE_CXX_FLAGS="$INCLUDE_FIX")
'';
buildFlags = [ "clangBasic" "libtapi" ];
installTargets = [ "install-libtapi" "install-tapi-headers" ];
postInstall = ''
install_name_tool -id $out/lib/libtapi.dylib $out/lib/libtapi.dylib
'';
meta = with lib; { meta = with lib; {
license = licenses.apsl20; license = licenses.apsl20;
maintainers = with maintainers; [ matthewbauer ]; maintainers = with maintainers; [ matthewbauer ];
}; };
} }

View File

@ -198,12 +198,6 @@ in rec {
python3 = super.python3Minimal; python3 = super.python3Minimal;
ninja = super.ninja.override { buildDocs = false; }; ninja = super.ninja.override { buildDocs = false; };
darwin = super.darwin // {
cctools = super.darwin.cctools.override {
enableTapiSupport = false;
};
};
}; };
in with prevStage; stageFun 1 prevStage { in with prevStage; stageFun 1 prevStage {
extraPreHook = "export NIX_CFLAGS_COMPILE+=\" -F${bootstrapTools}/Library/Frameworks\""; extraPreHook = "export NIX_CFLAGS_COMPILE+=\" -F${bootstrapTools}/Library/Frameworks\"";
@ -305,7 +299,7 @@ in rec {
persistent = self: super: with prevStage; { persistent = self: super: with prevStage; {
inherit inherit
gnumake gzip gnused bzip2 gawk ed xz patch bash python3 gnumake gzip gnused bzip2 gawk ed xz patch bash python3
ncurses libffi zlib gmp pcre gnugrep ncurses libffi zlib gmp pcre gnugrep cmake
coreutils findutils diffutils patchutils ninja libxml2; coreutils findutils diffutils patchutils ninja libxml2;
# Hack to make sure we don't link ncurses in bootstrap tools. The proper # Hack to make sure we don't link ncurses in bootstrap tools. The proper
@ -330,7 +324,6 @@ in rec {
darwin = super.darwin // rec { darwin = super.darwin // rec {
inherit (darwin) dyld Libsystem libiconv locale; inherit (darwin) dyld Libsystem libiconv locale;
cctools = super.darwin.cctools.override { enableTapiSupport = false; };
CF = super.darwin.CF.override { CF = super.darwin.CF.override {
inherit libxml2; inherit libxml2;
python3 = prevStage.python3; python3 = prevStage.python3;
@ -419,7 +412,7 @@ in rec {
curl.out openssl.out libssh2.out nghttp2.lib libkrb5 curl.out openssl.out libssh2.out nghttp2.lib libkrb5
cc.expand-response-params libxml2.out cc.expand-response-params libxml2.out
]) ++ (with pkgs.darwin; [ ]) ++ (with pkgs.darwin; [
dyld Libsystem CF cctools ICU libiconv locale dyld Libsystem CF cctools ICU libiconv locale libtapi
]); ]);
overrides = lib.composeExtensions persistent (self: super: { overrides = lib.composeExtensions persistent (self: super: {

View File

@ -100,6 +100,8 @@ in rec {
cp ${cctools_}/bin/$i $out/bin cp ${cctools_}/bin/$i $out/bin
done done
cp -d ${darwin.libtapi}/lib/libtapi* $out/lib
cp -rd ${pkgs.darwin.CF}/Library $out cp -rd ${pkgs.darwin.CF}/Library $out
chmod -R u+w $out chmod -R u+w $out