public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-dev] [PATCH] eclass/ruby-fakegem.eclass: set flags for compilation
@ 2021-11-07  8:18 Hans de Graaff
  0 siblings, 0 replies; only message in thread
From: Hans de Graaff @ 2021-11-07  8:18 UTC (permalink / raw
  To: gentoo-dev; +Cc: Hans de Graaff

Explicitly pass CC, CFLAGS and LDFLAGS when compiling ruby
extensions. By default ruby re-uses the stored flags used when
compiling ruby itself. This is intended to create a better chance of
compatibility between extensions and ruby itself, and extensions do
not need to bother with this themselves, but it does not match the
expectations of a Gentoo system where each compile action should use
the currently defined flags.

We also cannot guarantee this compatibility in any case since
toolchain packages may have been updated in the meantime.

This change uses the current CC, CFLAGS and LDFLAGS, and adds -fPIC
which ruby extensions need and which would otherwise be added by
ruby. This combination is already used in some ebuilds without any
reported issues.

Signed-off-by: Hans de Graaff <graaff@gentoo.org>
---
 eclass/ruby-fakegem.eclass | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/eclass/ruby-fakegem.eclass b/eclass/ruby-fakegem.eclass
index 573e3511daf7..858fe04e082f 100644
--- a/eclass/ruby-fakegem.eclass
+++ b/eclass/ruby-fakegem.eclass
@@ -404,7 +404,7 @@ EOF
 each_fakegem_configure() {
 	tc-export PKG_CONFIG
 	for extension in "${RUBY_FAKEGEM_EXTENSIONS[@]}" ; do
-		${RUBY} --disable=did_you_mean -C ${extension%/*} ${extension##*/} || die
+		CC=$(tc-getCC) ${RUBY} --disable=did_you_mean -C ${extension%/*} ${extension##*/} || die
 	done
 }
 
@@ -441,7 +441,7 @@ all_fakegem_compile() {
 # Compile extensions defined in RUBY_FAKEGEM_EXTENSIONS, if any.
 each_fakegem_compile() {
 	for extension in "${RUBY_FAKEGEM_EXTENSIONS[@]}" ; do
-		emake V=1 -C ${extension%/*}
+		emake V=1 -C ${extension%/*} CFLAGS="${CFLAGS} -fPIC" archflag="${LDFLAGS}"
 		mkdir -p "${RUBY_FAKEGEM_EXTENSION_LIBDIR%/}"
 		cp "${extension%/*}"/*$(get_modname) "${RUBY_FAKEGEM_EXTENSION_LIBDIR%/}/" || die "Copy of extension into ${RUBY_FAKEGEM_EXTENSION_LIBDIR} failed"
 	done
-- 
2.32.0



^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2021-11-07  8:18 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-11-07  8:18 [gentoo-dev] [PATCH] eclass/ruby-fakegem.eclass: set flags for compilation Hans de Graaff

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox