|
|
|
@ -9,6 +9,7 @@ |
|
|
|
|
, lib |
|
|
|
|
, stdenvNoCC |
|
|
|
|
, bintools ? null, libc ? null, coreutils ? null, shell ? stdenvNoCC.shell, gnugrep ? null |
|
|
|
|
, sharedLibraryLoader ? if libc == null then null else lib.getLib libc |
|
|
|
|
, nativeTools, noLibc ? false, nativeLibc, nativePrefix ? "" |
|
|
|
|
, propagateDoc ? bintools != null && bintools ? man |
|
|
|
|
, extraPackages ? [], extraBuildCommands ? "" |
|
|
|
@ -54,19 +55,19 @@ let |
|
|
|
|
# The dynamic linker has different names on different platforms. This is a |
|
|
|
|
# shell glob that ought to match it. |
|
|
|
|
dynamicLinker = |
|
|
|
|
/**/ if libc == null then null |
|
|
|
|
else if targetPlatform.libc == "musl" then "${libc_lib}/lib/ld-musl-*" |
|
|
|
|
/**/ if sharedLibraryLoader == null then null |
|
|
|
|
else if targetPlatform.libc == "musl" then "${sharedLibraryLoader}/lib/ld-musl-*" |
|
|
|
|
else if (targetPlatform.libc == "bionic" && targetPlatform.is32bit) then "/system/bin/linker" |
|
|
|
|
else if (targetPlatform.libc == "bionic" && targetPlatform.is64bit) then "/system/bin/linker64" |
|
|
|
|
else if targetPlatform.libc == "nblibc" then "${libc_lib}/libexec/ld.elf_so" |
|
|
|
|
else if targetPlatform.system == "i686-linux" then "${libc_lib}/lib/ld-linux.so.2" |
|
|
|
|
else if targetPlatform.system == "x86_64-linux" then "${libc_lib}/lib/ld-linux-x86-64.so.2" |
|
|
|
|
else if targetPlatform.system == "powerpc64le-linux" then "${libc_lib}/lib/ld64.so.2" |
|
|
|
|
else if targetPlatform.libc == "nblibc" then "${sharedLibraryLoader}/libexec/ld.elf_so" |
|
|
|
|
else if targetPlatform.system == "i686-linux" then "${sharedLibraryLoader}/lib/ld-linux.so.2" |
|
|
|
|
else if targetPlatform.system == "x86_64-linux" then "${sharedLibraryLoader}/lib/ld-linux-x86-64.so.2" |
|
|
|
|
else if targetPlatform.system == "powerpc64le-linux" then "${sharedLibraryLoader}/lib/ld64.so.2" |
|
|
|
|
# ARM with a wildcard, which can be "" or "-armhf". |
|
|
|
|
else if (with targetPlatform; isAarch32 && isLinux) then "${libc_lib}/lib/ld-linux*.so.3" |
|
|
|
|
else if targetPlatform.system == "aarch64-linux" then "${libc_lib}/lib/ld-linux-aarch64.so.1" |
|
|
|
|
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 (with targetPlatform; isAarch32 && isLinux) then "${sharedLibraryLoader}/lib/ld-linux*.so.3" |
|
|
|
|
else if targetPlatform.system == "aarch64-linux" then "${sharedLibraryLoader}/lib/ld-linux-aarch64.so.1" |
|
|
|
|
else if targetPlatform.system == "powerpc-linux" then "${sharedLibraryLoader}/lib/ld.so.1" |
|
|
|
|
else if targetPlatform.isMips then "${sharedLibraryLoader}/lib/ld.so.1" |
|
|
|
|
else if targetPlatform.isDarwin then "/usr/lib/dyld" |
|
|
|
|
else if targetPlatform.isFreeBSD then "/libexec/ld-elf.so.1" |
|
|
|
|
else if lib.hasSuffix "pc-gnu" targetPlatform.config then "ld.so.1" |
|
|
|
@ -224,10 +225,10 @@ stdenv.mkDerivation { |
|
|
|
|
## |
|
|
|
|
## Dynamic linker support |
|
|
|
|
## |
|
|
|
|
+ '' |
|
|
|
|
+ optionalString (sharedLibraryLoader != null) '' |
|
|
|
|
if [[ -z ''${dynamicLinker+x} ]]; then |
|
|
|
|
echo "Don't know the name of the dynamic linker for platform '${targetPlatform.config}', so guessing instead." >&2 |
|
|
|
|
local dynamicLinker="${libc_lib}/lib/ld*.so.?" |
|
|
|
|
local dynamicLinker="${sharedLibraryLoader}/lib/ld*.so.?" |
|
|
|
|
fi |
|
|
|
|
'' |
|
|
|
|
|
|
|
|
@ -246,9 +247,9 @@ stdenv.mkDerivation { |
|
|
|
|
|
|
|
|
|
${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 |
|
|
|
|
'' else lib.optionalString (sharedLibraryLoader != null) '' |
|
|
|
|
if [ -e ${sharedLibraryLoader}/lib/32/ld-linux.so.2 ]; then |
|
|
|
|
echo ${sharedLibraryLoader}/lib/32/ld-linux.so.2 > $out/nix-support/dynamic-linker-m32 |
|
|
|
|
fi |
|
|
|
|
touch $out/nix-support/ld-set-dynamic-linker |
|
|
|
|
''} |
|
|
|
|