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/binutils | |
parent | bfa8f3049989739223687324aec986d4da3b5dae (diff) |
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/binutils')
-rw-r--r-- | pkgs/os-specific/darwin/binutils/default.nix | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/pkgs/os-specific/darwin/binutils/default.nix b/pkgs/os-specific/darwin/binutils/default.nix index c4ccdb94b8123..bde42e45e9c23 100644 --- a/pkgs/os-specific/darwin/binutils/default.nix +++ b/pkgs/os-specific/darwin/binutils/default.nix @@ -1,11 +1,25 @@ -{ stdenv, binutils-raw, cctools }: +{ stdenv, binutils-raw, cctools +, hostPlatform, targetPlatform +}: +let + prefix = stdenv.lib.optionalString + (targetPlatform != hostPlatform) + "${targetPlatform.config}-"; + + cmds = [ + "ar" "ranlib" "as" "dsymutil" "install_name_tool" + "ld" "strip" "otool" "lipo" "nm" "strings" "size" + ]; +in + +# TODO loop over prefixed binaries too stdenv.mkDerivation { name = "cctools-binutils-darwin"; buildCommand = '' mkdir -p $out/bin $out/include - ln -s ${binutils-raw.out}/bin/c++filt $out/bin/c++filt + ln -s ${binutils-raw.out}/bin/${prefix}c++filt $out/bin/${prefix}c++filt # We specifically need: # - ld: binutils doesn't provide it on darwin @@ -18,11 +32,11 @@ stdenv.mkDerivation { # - strip: the binutils one seems to break mach-o files # - lipo: gcc build assumes it exists # - nm: the gnu one doesn't understand many new load commands - for i in ar ranlib as dsymutil install_name_tool ld strip otool lipo nm strings size; do + for i in ${stdenv.lib.concatStringsSep " " (builtins.map (e: prefix + e) cmds)}; do ln -sf "${cctools}/bin/$i" "$out/bin/$i" done - for i in ${binutils-raw.dev}/include/*.h; do + for i in ${binutils-raw.dev or binutils-raw.out}/include/*.h; do ln -s "$i" "$out/include/$(basename $i)" done |