From f76c7b8fab2f4e5e3866d4dced0f18ceeae562b4 Mon Sep 17 00:00:00 2001 From: Matthew Bauer Date: Fri, 25 Jan 2019 18:04:50 -0500 Subject: [PATCH] libtapi: init (cherry picked from commit 69347697d3336d4b6add8276d9f75daf6f0cacf3) --- pkgs/os-specific/darwin/cctools/port.nix | 10 +++++-- pkgs/os-specific/darwin/libtapi/default.nix | 29 +++++++++++++++++++++ pkgs/top-level/darwin-packages.nix | 4 ++- 3 files changed, 40 insertions(+), 3 deletions(-) create mode 100644 pkgs/os-specific/darwin/libtapi/default.nix diff --git a/pkgs/os-specific/darwin/cctools/port.nix b/pkgs/os-specific/darwin/cctools/port.nix index caf85b227bed..b379933f3c80 100644 --- a/pkgs/os-specific/darwin/cctools/port.nix +++ b/pkgs/os-specific/darwin/cctools/port.nix @@ -2,6 +2,7 @@ , libcxxabi, libuuid, llvm , libobjc ? null, maloader ? null , enableDumpNormalizedLibArgs ? false +, enableTapiSupport ? stdenv.hostPlatform != stdenv.targetPlatform, libtapi }: let @@ -52,7 +53,8 @@ let nativeBuildInputs = [ autoconf automake libtool_2 autoreconfHook ]; buildInputs = [ libuuid ] - ++ stdenv.lib.optionals stdenv.isDarwin [ libcxxabi libobjc ]; + ++ stdenv.lib.optionals stdenv.isDarwin [ libcxxabi libobjc ] + ++ stdenv.lib.optional enableTapiSupport libtapi; patches = [ ./ld-rpath-nonfinal.patch ./ld-ignore-rpath-link.patch @@ -74,7 +76,11 @@ let # TODO(@Ericson2314): Always pass "--target" and always targetPrefix. configurePlatforms = [ "build" "host" ] ++ stdenv.lib.optional (stdenv.targetPlatform != stdenv.hostPlatform) "target"; - configureFlags = [ "--disable-clang-as" ]; + configureFlags = [ "--disable-clang-as" ] + ++ stdenv.lib.optionals enableTapiSupport [ + "--enable-tapi-support" + "--with-libtapi=${libtapi}" + ]; postPatch = '' sed -i -e 's/addStandardLibraryDirectories = true/addStandardLibraryDirectories = false/' cctools/ld64/src/ld/Options.cpp diff --git a/pkgs/os-specific/darwin/libtapi/default.nix b/pkgs/os-specific/darwin/libtapi/default.nix new file mode 100644 index 000000000000..e68e77f55afe --- /dev/null +++ b/pkgs/os-specific/darwin/libtapi/default.nix @@ -0,0 +1,29 @@ +{ lib, stdenv, fetchFromGitHub, cmake, python }: + +stdenv.mkDerivation { + name = "libtapi"; + src = fetchFromGitHub { + owner = "tpoechtrager"; + repo = "apple-libtapi"; + rev = "e56673694db395e25b31808b4fbb9a7005e6875f"; + sha256 = "1lnl1af9sszp9wxfk0wljrpdmwcx83j0w5c0y4qw4pqrdkdgwks7"; + }; + + nativeBuildInputs = [ cmake python ]; + + preConfigure = '' + cd src/apple-llvm/src + ''; + + cmakeFlags = [ "-DLLVM_INCLUDE_TESTS=OFF" ]; + + buildFlags = "libtapi"; + + installTarget = "install-libtapi"; + + meta = with lib; { + license = licenses.apsl20; + maintainers = with maintainers; [ matthewbauer ]; + }; + +} diff --git a/pkgs/top-level/darwin-packages.nix b/pkgs/top-level/darwin-packages.nix index 5ff97aa44401..2a82af19fa2b 100644 --- a/pkgs/top-level/darwin-packages.nix +++ b/pkgs/top-level/darwin-packages.nix @@ -27,7 +27,7 @@ in }; cctools = callPackage ../os-specific/darwin/cctools/port.nix { - inherit (darwin) libobjc maloader; + inherit (darwin) libobjc maloader libtapi; stdenv = if stdenv.isDarwin then stdenv else pkgs.libcxxStdenv; libcxxabi = pkgs.libcxxabi; }; @@ -79,4 +79,6 @@ in darling = callPackage ../os-specific/darwin/darling/default.nix { }; + libtapi = callPackage ../os-specific/darwin/libtapi {}; + })