diff options
Diffstat (limited to 'nixpkgs/pkgs/build-support/bintools-wrapper/default.nix')
-rw-r--r-- | nixpkgs/pkgs/build-support/bintools-wrapper/default.nix | 38 |
1 files changed, 17 insertions, 21 deletions
diff --git a/nixpkgs/pkgs/build-support/bintools-wrapper/default.nix b/nixpkgs/pkgs/build-support/bintools-wrapper/default.nix index 6da0e58436d0..e960a2455282 100644 --- a/nixpkgs/pkgs/build-support/bintools-wrapper/default.nix +++ b/nixpkgs/pkgs/build-support/bintools-wrapper/default.nix @@ -6,6 +6,7 @@ # compiler and the linker just "work". { name ? "" +, lib , stdenvNoCC , bintools ? null, libc ? null, coreutils ? null, shell ? stdenvNoCC.shell, gnugrep ? null , nativeTools, noLibc ? false, nativeLibc, nativePrefix ? "" @@ -15,7 +16,7 @@ , useMacosReexportHack ? false }: -with stdenvNoCC.lib; +with lib; assert nativeTools -> !propagateDoc && nativePrefix != ""; assert !nativeTools -> @@ -31,11 +32,11 @@ let # # TODO(@Ericson2314) Make unconditional, or optional but always true by # default. - targetPrefix = stdenv.lib.optionalString (targetPlatform != hostPlatform) + targetPrefix = lib.optionalString (targetPlatform != hostPlatform) (targetPlatform.config + "-"); - bintoolsVersion = stdenv.lib.getVersion bintools; - bintoolsName = stdenv.lib.removePrefix targetPrefix (stdenv.lib.getName bintools); + bintoolsVersion = lib.getVersion bintools; + bintoolsName = lib.removePrefix targetPrefix (lib.getName bintools); libc_bin = if libc == null then null else getBin libc; libc_dev = if libc == null then null else getDev libc; @@ -62,7 +63,7 @@ let else if targetPlatform.system == "powerpc-linux" then "${libc_lib}/lib/ld.so.1" else if targetPlatform.isMips then "${libc_lib}/lib/ld.so.1" else if targetPlatform.isDarwin then "/usr/lib/dyld" - else if stdenv.lib.hasSuffix "pc-gnu" targetPlatform.config then "ld.so.1" + else if lib.hasSuffix "pc-gnu" targetPlatform.config then "ld.so.1" else null; expand-response-params = @@ -190,7 +191,7 @@ stdenv.mkDerivation { else if targetPlatform.isRiscV then "lriscv" else throw "unknown emulation for platform: ${targetPlatform.config}"; in if targetPlatform.useLLVM or false then "" - else targetPlatform.platform.bfdEmulation or (fmt + sep + arch); + else targetPlatform.bfdEmulation or (fmt + sep + arch); strictDeps = true; depsTargetTargetPropagated = extraPackages; @@ -237,19 +238,14 @@ stdenv.mkDerivation { if [ -n "''${dynamicLinker-}" ]; then echo $dynamicLinker > $out/nix-support/dynamic-linker - '' + (if targetPlatform.isDarwin then '' - printf "export LD_DYLD_PATH=%q\n" "$dynamicLinker" >> $out/nix-support/setup-hook - '' else '' - if [ -e ${libc_lib}/lib/32/ld-linux.so.2 ]; then - echo ${libc_lib}/lib/32/ld-linux.so.2 > $out/nix-support/dynamic-linker-m32 - fi - '' - # The dynamic linker is passed in `ldflagsBefore' to allow - # explicit overrides of the dynamic linker by callers to ld - # (the *last* value counts, so ours should come first). - + '' - echo -dynamic-linker "$dynamicLinker" >> $out/nix-support/libc-ldflags-before - '') + '' + ${if targetPlatform.isDarwin then '' + printf "export LD_DYLD_PATH=%q\n" "$dynamicLinker" >> $out/nix-support/setup-hook + '' else '' + if [ -e ${libc_lib}/lib/32/ld-linux.so.2 ]; then + echo ${libc_lib}/lib/32/ld-linux.so.2 > $out/nix-support/dynamic-linker-m32 + fi + touch $out/nix-support/ld-set-dynamic-linker + ''} fi '') @@ -331,10 +327,10 @@ stdenv.mkDerivation { let bintools_ = if bintools != null then bintools else {}; in (if bintools_ ? meta then removeAttrs bintools.meta ["priority"] else {}) // { description = - stdenv.lib.attrByPath ["meta" "description"] "System binary utilities" bintools_ + lib.attrByPath ["meta" "description"] "System binary utilities" bintools_ + " (wrapper script)"; priority = 10; } // optionalAttrs useMacosReexportHack { - platforms = stdenv.lib.platforms.darwin; + platforms = lib.platforms.darwin; }; } |