From aaca0d1c927913dbdb613bd8f16179ae8312facf Mon Sep 17 00:00:00 2001 From: Michael Eden Date: Sat, 30 Mar 2019 22:45:32 -0400 Subject: [PATCH] gcc: put target-specific libs in lib output --- pkgs/development/compilers/gcc/7/default.nix | 3 +++ pkgs/development/compilers/gcc/builder.sh | 15 ++++++++++++--- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/pkgs/development/compilers/gcc/7/default.nix b/pkgs/development/compilers/gcc/7/default.nix index 68c05d289784a..3124b07367783 100644 --- a/pkgs/development/compilers/gcc/7/default.nix +++ b/pkgs/development/compilers/gcc/7/default.nix @@ -152,6 +152,9 @@ stdenv.mkDerivation ({ libc_dev = stdenv.cc.libc_dev; + # set this var to use in builder.sh + target_triple = targetPlatform.config; + hardeningDisable = [ "format" "pie" ]; # This should kill all the stdinc frameworks that gcc and friends like to diff --git a/pkgs/development/compilers/gcc/builder.sh b/pkgs/development/compilers/gcc/builder.sh index 07a003691d6b2..fb79a4ef9531e 100644 --- a/pkgs/development/compilers/gcc/builder.sh +++ b/pkgs/development/compilers/gcc/builder.sh @@ -213,9 +213,18 @@ preInstall() { postInstall() { # Move runtime libraries to $lib. - moveToOutput "lib/lib*.so*" "$lib" - moveToOutput "lib/lib*.la" "$lib" - moveToOutput "lib/lib*.dylib" "$lib" + if [[ -d "$out/$target_triple/lib" ]]; then + moveToOutput "$target_triple/lib/lib*.so*" "$lib" + moveToOutput "$target_triple/lib/lib*.la" "$lib" + moveToOutput "$target_triple/lib/lib*.dylib" "$lib" + mv "$lib/$target_triple"/lib/* "$lib/lib/" + rmdir -p --ignore-fail-on-non-empty "$lib/$target_triple/lib" || : + else + moveToOutput "lib/lib*.so*" "$lib" + moveToOutput "lib/lib*.la" "$lib" + moveToOutput "lib/lib*.dylib" "$lib" + fi + moveToOutput "share/gcc-*/python" "$lib" for i in "$lib"/lib/*.{la,py}; do