gcc-arm-embedded: fix hardcoded library paths on x86_64-darwin (#407272)

authored by Pavol Rusnak and committed by GitHub 8098aca4 8f2f7ab5

+70 -30
+35 -14
pkgs/by-name/gc/gcc-arm-embedded-13/package.nix
··· 4 fetchurl, 5 ncurses5, 6 libxcrypt-legacy, 7 }: 8 9 stdenv.mkDerivation rec { ··· 38 ./info-fix.patch 39 ]; 40 41 dontConfigure = true; 42 dontBuild = true; 43 dontPatchELF = true; ··· 50 rm $out/bin/{arm-none-eabi-gdb-py,arm-none-eabi-gdb-add-index-py} || : 51 ''; 52 53 - preFixup = lib.optionalString stdenv.isLinux '' 54 - find $out -type f | while read f; do 55 - patchelf "$f" > /dev/null 2>&1 || continue 56 - patchelf --set-interpreter $(cat ${stdenv.cc}/nix-support/dynamic-linker) "$f" || true 57 - patchelf --set-rpath ${ 58 - lib.makeLibraryPath [ 59 - "$out" 60 - stdenv.cc.cc 61 - ncurses5 62 - libxcrypt-legacy 63 - ] 64 - } "$f" || true 65 - done 66 - ''; 67 68 meta = with lib; { 69 description = "Pre-built GNU toolchain from ARM Cortex-M & Cortex-R processors";
··· 4 fetchurl, 5 ncurses5, 6 libxcrypt-legacy, 7 + xz, 8 + zstd, 9 + makeBinaryWrapper, 10 + darwin, 11 }: 12 13 stdenv.mkDerivation rec { ··· 42 ./info-fix.patch 43 ]; 44 45 + nativeBuildInputs = lib.optionals (stdenv.isDarwin && stdenv.isx86_64) [ 46 + makeBinaryWrapper 47 + darwin.sigtool 48 + ]; 49 + 50 dontConfigure = true; 51 dontBuild = true; 52 dontPatchELF = true; ··· 59 rm $out/bin/{arm-none-eabi-gdb-py,arm-none-eabi-gdb-add-index-py} || : 60 ''; 61 62 + preFixup = 63 + lib.optionalString stdenv.isLinux '' 64 + find $out -type f | while read f; do 65 + patchelf "$f" > /dev/null 2>&1 || continue 66 + patchelf --set-interpreter $(cat ${stdenv.cc}/nix-support/dynamic-linker) "$f" || true 67 + patchelf --set-rpath ${ 68 + lib.makeLibraryPath [ 69 + "$out" 70 + stdenv.cc.cc 71 + ncurses5 72 + libxcrypt-legacy 73 + ] 74 + } "$f" || true 75 + done 76 + '' 77 + + lib.optionalString (stdenv.isDarwin && stdenv.isx86_64) '' 78 + find "$out" -executable -type f | while read executable; do 79 + ( \ 80 + install_name_tool \ 81 + -change "/usr/local/opt/zstd/lib/libzstd.1.dylib" "${lib.getLib zstd}/lib/libzstd.1.dylib" \ 82 + -change "/usr/local/opt/xz/lib/liblzma.5.dylib" "${lib.getLib xz}/lib/liblzma.5.dylib" \ 83 + "$executable" \ 84 + && codesign -f -s - "$executable" \ 85 + ) || true 86 + done 87 + ''; 88 89 meta = with lib; { 90 description = "Pre-built GNU toolchain from ARM Cortex-M & Cortex-R processors";
+35 -16
pkgs/by-name/gc/gcc-arm-embedded-14/package.nix
··· 6 libxcrypt-legacy, 7 xz, 8 zstd, 9 }: 10 11 stdenv.mkDerivation rec { ··· 33 } 34 .${stdenv.hostPlatform.system} or (throw "Unsupported system: ${stdenv.hostPlatform.system}"); 35 }; 36 37 patches = [ 38 # fix double entry in share/info/porting.info ··· 52 rm $out/bin/{arm-none-eabi-gdb-py,arm-none-eabi-gdb-add-index-py} || : 53 ''; 54 55 - preFixup = lib.optionalString stdenv.isLinux '' 56 - find $out -type f | while read f; do 57 - patchelf "$f" > /dev/null 2>&1 || continue 58 - patchelf --set-interpreter $(cat ${stdenv.cc}/nix-support/dynamic-linker) "$f" || true 59 - patchelf --set-rpath ${ 60 - lib.makeLibraryPath [ 61 - "$out" 62 - stdenv.cc.cc 63 - ncurses6 64 - libxcrypt-legacy 65 - xz 66 - zstd 67 - ] 68 - } "$f" || true 69 - done 70 - ''; 71 72 meta = with lib; { 73 description = "Pre-built GNU toolchain from ARM Cortex-M & Cortex-R processors";
··· 6 libxcrypt-legacy, 7 xz, 8 zstd, 9 + makeBinaryWrapper, 10 + darwin, 11 }: 12 13 stdenv.mkDerivation rec { ··· 35 } 36 .${stdenv.hostPlatform.system} or (throw "Unsupported system: ${stdenv.hostPlatform.system}"); 37 }; 38 + 39 + nativeBuildInputs = lib.optionals (stdenv.isDarwin && stdenv.isx86_64) [ 40 + makeBinaryWrapper 41 + darwin.sigtool 42 + ]; 43 44 patches = [ 45 # fix double entry in share/info/porting.info ··· 59 rm $out/bin/{arm-none-eabi-gdb-py,arm-none-eabi-gdb-add-index-py} || : 60 ''; 61 62 + preFixup = 63 + lib.optionalString stdenv.isLinux '' 64 + find $out -type f | while read f; do 65 + patchelf "$f" > /dev/null 2>&1 || continue 66 + patchelf --set-interpreter $(cat ${stdenv.cc}/nix-support/dynamic-linker) "$f" || true 67 + patchelf --set-rpath ${ 68 + lib.makeLibraryPath [ 69 + "$out" 70 + stdenv.cc.cc 71 + ncurses6 72 + libxcrypt-legacy 73 + xz 74 + zstd 75 + ] 76 + } "$f" || true 77 + done 78 + '' 79 + + lib.optionalString (stdenv.isDarwin && stdenv.isx86_64) '' 80 + find "$out" -executable -type f | while read executable; do 81 + ( \ 82 + install_name_tool \ 83 + -change "/usr/local/opt/zstd/lib/libzstd.1.dylib" "${lib.getLib zstd}/lib/libzstd.1.dylib" \ 84 + -change "/usr/local/opt/xz/lib/liblzma.5.dylib" "${lib.getLib xz}/lib/liblzma.5.dylib" \ 85 + "$executable" \ 86 + && codesign -f -s - "$executable" \ 87 + ) || true 88 + done 89 + ''; 90 91 meta = with lib; { 92 description = "Pre-built GNU toolchain from ARM Cortex-M & Cortex-R processors";