Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions pkgs/gcc/gcc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think these two blobs can just be merged into one. I'll do it after my gcc build finishes.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line assumes that ${ARTIFACT} does not contain the | character. If it does, then the sed command will break.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ahmadia I've searched the web and there doesn't seem to be any solution really to this, except to manually escape the variable to be substituted. I think it will also fail if the variable contains []. I am inclined to just leave this be (it should work for most paths), unless we can figure out a better solution.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can use other separator but I would assume that "|" is fairly safe for a path. It is safer than ":" which we could use if there was more than one path.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right. The ${ARTIFACT} path can contain both : and |, so to be completely safe, one would need to escape it, but it just makes the code really messy.


- name: link_lib64_to_lib
after: install
handler: bash
Expand Down
24 changes: 24 additions & 0 deletions pkgs/gcc/rpath.patch
Original file line number Diff line number Diff line change
@@ -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