diff --git a/pkgs/gcc/gcc.yaml b/pkgs/gcc/gcc.yaml index 97b68d4fd..b64fb9862 100644 --- a/pkgs/gcc/gcc.yaml +++ b/pkgs/gcc/gcc.yaml @@ -12,6 +12,16 @@ sources: url: http://ftpmirror.gnu.org/gcc/gcc-4.9.2/gcc-4.9.2.tar.bz2 build_stages: + # Make gcc automatically embed RPATH to the proper libstdc++, libgfortran, + # libgcc and libquadmath libraries: + - name: rpath_patch + before: configure + files: [rpath.patch] + handler: bash + bash: | + patch -up1 < _hashdist/rpath.patch + sed -i "s|@@ARTIFACT@@|${ARTIFACT}|g" gcc/config/i386/gnu-user.h gcc/config/i386/gnu-user64.h + - name: link_lib64_to_lib after: install handler: bash diff --git a/pkgs/gcc/rpath.patch b/pkgs/gcc/rpath.patch new file mode 100644 index 000000000..4ed6b182e --- /dev/null +++ b/pkgs/gcc/rpath.patch @@ -0,0 +1,24 @@ +diff --git a/gcc/config/i386/gnu-user.h b/gcc/config/i386/gnu-user.h +index e1163c9..dc09728 100644 +--- a/gcc/config/i386/gnu-user.h ++++ b/gcc/config/i386/gnu-user.h +@@ -79,6 +79,7 @@ along with GCC; see the file COPYING3. If not see + %{!static: \ + %{rdynamic:-export-dynamic} \ + -dynamic-linker %(dynamic_linker)} \ ++ -rpath @@ARTIFACT@@/lib \ + %{static:-static}}" + + #undef LINK_SPEC +diff --git a/gcc/config/i386/gnu-user64.h b/gcc/config/i386/gnu-user64.h +index 1c72b41..457639b 100644 +--- a/gcc/config/i386/gnu-user64.h ++++ b/gcc/config/i386/gnu-user64.h +@@ -63,6 +63,7 @@ see the files COPYING3 and COPYING.RUNTIME respectively. If not, see + %{" SPEC_32 ":-dynamic-linker " GNU_USER_DYNAMIC_LINKER32 "} \ + %{" SPEC_64 ":-dynamic-linker " GNU_USER_DYNAMIC_LINKER64 "} \ + %{" SPEC_X32 ":-dynamic-linker " GNU_USER_DYNAMIC_LINKERX32 "}} \ ++ -rpath @@ARTIFACT@@/lib \ + %{static:-static}}" + + #undef LINK_SPEC