diff options
author | John Ericson <Ericson2314@Yahoo.com> | 2017-04-24 16:00:11 -0400 |
---|---|---|
committer | John Ericson <Ericson2314@Yahoo.com> | 2017-05-17 15:33:05 -0400 |
commit | 88ea6463a342c2084266395b210d57b1218bad62 (patch) | |
tree | c67e3794ebf3475c5de05aed7de65a45bf2a685c /pkgs/os-specific/darwin/cctools/port.nix | |
parent | bfa8f3049989739223687324aec986d4da3b5dae (diff) | |
download | nixpkgs-88ea6463a342c2084266395b210d57b1218bad62.tar nixpkgs-88ea6463a342c2084266395b210d57b1218bad62.tar.gz nixpkgs-88ea6463a342c2084266395b210d57b1218bad62.tar.bz2 nixpkgs-88ea6463a342c2084266395b210d57b1218bad62.tar.lz nixpkgs-88ea6463a342c2084266395b210d57b1218bad62.tar.xz nixpkgs-88ea6463a342c2084266395b210d57b1218bad62.tar.zst nixpkgs-88ea6463a342c2084266395b210d57b1218bad62.zip |
binutils on darwin: Clean up the rats nest
- No more *Cross duplication for binutils on darwin either. `cctools_cross` is merged into plain `cctools`, so `buildPackages` chains alone are used to disambiguate. - Always use a mashup of cctools and actual GNU Binutils as `binutils`. Previously, this was only done in the native case as nobody had bothered to implement the masher in the cross case. Implemented it basically consisted of extending the wrapper to deal with prefixed binaries.
Diffstat (limited to 'pkgs/os-specific/darwin/cctools/port.nix')
-rw-r--r-- | pkgs/os-specific/darwin/cctools/port.nix | 68 |
1 files changed, 41 insertions, 27 deletions
diff --git a/pkgs/os-specific/darwin/cctools/port.nix b/pkgs/os-specific/darwin/cctools/port.nix index 0154d395216..204a4789bcc 100644 --- a/pkgs/os-specific/darwin/cctools/port.nix +++ b/pkgs/os-specific/darwin/cctools/port.nix @@ -1,9 +1,23 @@ -{ stdenv, fetchFromGitHub, autoconf, automake, libtool_2 +{ stdenv, fetchFromGitHub, makeWrapper, autoconf, automake, libtool_2 , llvm, libcxx, libcxxabi, clang, libuuid -, libobjc ? null +, libobjc ? null, maloader ? null, xctoolchain ? null +, buildPlatform, hostPlatform, targetPlatform }: let + inherit (stdenv.lib.systems.parse) isDarwin; + + prefix = stdenv.lib.optionalString + (targetPlatform != hostPlatform) + "${targetPlatform.config}-"; +in + +assert isDarwin targetPlatform.parsed; + +# Non-Darwin alternatives +assert (!isDarwin hostPlatform.parsed) -> (maloader != null && xctoolchain != null); + +let baseParams = rec { name = "cctools-port-${version}"; version = "895"; @@ -26,7 +40,14 @@ let enableParallelBuilding = true; - configureFlags = stdenv.lib.optionals (!stdenv.isDarwin) [ "CXXFLAGS=-I${libcxx}/include/c++/v1" ]; + configureFlags = stdenv.lib.optionals (!stdenv.isDarwin) [ + "CXXFLAGS=-I${libcxx}/include/c++/v1" + ] ++ stdenv.lib.optionals (targetPlatform != buildPlatform) [ + # TODO make unconditional next hash break + "--build=${buildPlatform.config}" + "--host=${hostPlatform.config}" + "--target=${targetPlatform.config}" + ]; postPatch = '' sed -i -e 's/addStandardLibraryDirectories = true/addStandardLibraryDirectories = false/' cctools/ld64/src/ld/Options.cpp @@ -69,33 +90,26 @@ let popd ''; + postInstall = + if isDarwin hostPlatform.parsed + then '' + cat >$out/bin/dsymutil << EOF + #!${stdenv.shell} + EOF + chmod +x $out/bin/dsymutil + '' + else '' + for tool in dyldinfo dwarfdump dsymutil; do + ${makeWrapper}/bin/makeWrapper "${maloader}/bin/ld-mac" "$out/bin/${targetPlatform.config}-$tool" \ + --add-flags "${xctoolchain}/bin/$tool" + ln -s "$out/bin/${targetPlatform.config}-$tool" "$out/bin/$tool" + done + ''; + meta = { homepage = "http://www.opensource.apple.com/source/cctools/"; description = "Mac OS X Compiler Tools (cross-platform port)"; license = stdenv.lib.licenses.apsl20; }; }; -in { - native = stdenv.mkDerivation (baseParams // { - # A hack for now... - postInstall = '' - cat >$out/bin/dsymutil << EOF - #!${stdenv.shell} - EOF - chmod +x $out/bin/dsymutil - ''; - }); - - cross = - { cross, maloader, makeWrapper, xctoolchain}: stdenv.mkDerivation (baseParams // { - configureFlags = baseParams.configureFlags ++ [ "--target=${cross.config}" ]; - - postInstall = '' - for tool in dyldinfo dwarfdump dsymutil; do - ${makeWrapper}/bin/makeWrapper "${maloader}/bin/ld-mac" "$out/bin/${cross.config}-$tool" \ - --add-flags "${xctoolchain}/bin/$tool" - ln -s "$out/bin/${cross.config}-$tool" "$out/bin/$tool" - done - ''; - }); -} +in stdenv.mkDerivation baseParams |