1 |
Explicitly pass CC, CFLAGS and LDFLAGS when compiling ruby |
2 |
extensions. By default ruby re-uses the stored flags used when |
3 |
compiling ruby itself. This is intended to create a better chance of |
4 |
compatibility between extensions and ruby itself, and extensions do |
5 |
not need to bother with this themselves, but it does not match the |
6 |
expectations of a Gentoo system where each compile action should use |
7 |
the currently defined flags. |
8 |
|
9 |
We also cannot guarantee this compatibility in any case since |
10 |
toolchain packages may have been updated in the meantime. |
11 |
|
12 |
This change uses the current CC, CFLAGS and LDFLAGS, and adds -fPIC |
13 |
which ruby extensions need and which would otherwise be added by |
14 |
ruby. This combination is already used in some ebuilds without any |
15 |
reported issues. |
16 |
|
17 |
Signed-off-by: Hans de Graaff <graaff@g.o> |
18 |
--- |
19 |
eclass/ruby-fakegem.eclass | 4 ++-- |
20 |
1 file changed, 2 insertions(+), 2 deletions(-) |
21 |
|
22 |
diff --git a/eclass/ruby-fakegem.eclass b/eclass/ruby-fakegem.eclass |
23 |
index 573e3511daf7..858fe04e082f 100644 |
24 |
--- a/eclass/ruby-fakegem.eclass |
25 |
+++ b/eclass/ruby-fakegem.eclass |
26 |
@@ -404,7 +404,7 @@ EOF |
27 |
each_fakegem_configure() { |
28 |
tc-export PKG_CONFIG |
29 |
for extension in "${RUBY_FAKEGEM_EXTENSIONS[@]}" ; do |
30 |
- ${RUBY} --disable=did_you_mean -C ${extension%/*} ${extension##*/} || die |
31 |
+ CC=$(tc-getCC) ${RUBY} --disable=did_you_mean -C ${extension%/*} ${extension##*/} || die |
32 |
done |
33 |
} |
34 |
|
35 |
@@ -441,7 +441,7 @@ all_fakegem_compile() { |
36 |
# Compile extensions defined in RUBY_FAKEGEM_EXTENSIONS, if any. |
37 |
each_fakegem_compile() { |
38 |
for extension in "${RUBY_FAKEGEM_EXTENSIONS[@]}" ; do |
39 |
- emake V=1 -C ${extension%/*} |
40 |
+ emake V=1 -C ${extension%/*} CFLAGS="${CFLAGS} -fPIC" archflag="${LDFLAGS}" |
41 |
mkdir -p "${RUBY_FAKEGEM_EXTENSION_LIBDIR%/}" |
42 |
cp "${extension%/*}"/*$(get_modname) "${RUBY_FAKEGEM_EXTENSION_LIBDIR%/}/" || die "Copy of extension into ${RUBY_FAKEGEM_EXTENSION_LIBDIR} failed" |
43 |
done |
44 |
-- |
45 |
2.32.0 |