public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
Search results ordered by [date|relevance]  view[summary|nested|Atom feed]
thread overview below | download: 
* [gentoo-dev] perl-module.eclass: respect CFLAGS, LDFLAGS - please review
@ 2014-06-22  9:41 99% Andreas K. Huettel
  0 siblings, 0 replies; 1+ results
From: Andreas K. Huettel @ 2014-06-22  9:41 UTC (permalink / raw
  To: gentoo-dev

[-- Attachment #1: Type: Text/Plain, Size: 4655 bytes --]


TL;DR: 

Please review and test (also in exotic settings, arches, prefix?) the patch 
below for perl-module.eclass

Sending this to the list since perl is pretty deep down in the system, and 
since I'm not 100% sure of this stuff. Needs review.

Also people familiar with Perl have voiced doubts if we should meddle with the 
perl-module CFLAGS and LDFLAGS at all, maybe making these changes conditional 
on something like I_KNOW_WHAT_I_AM_DOING. Hoping for comments.

Detail discussion and test results follows below the patch.

=======================================

Index: perl-module.eclass
===================================================================
RCS file: /var/cvsroot/gentoo-x86/eclass/perl-module.eclass,v
retrieving revision 1.139
diff -u -B -r1.139 perl-module.eclass
--- perl-module.eclass	30 Mar 2014 19:25:14 -0000	1.139
+++ perl-module.eclass	22 Jun 2014 09:35:16 -0000
@@ -139,6 +139,8 @@
 			--libdoc= \
 			--destdir="${D}" \
 			--create_packlist=0 \
+			--config "optimize=${CFLAGS}" \
+			--config "lddlflags=-shared ${LDFLAGS}" \
 			"${myconf_local[@]}"
 		einfo "perl Build.PL" "$@"
 		perl Build.PL "$@" <<< "${pm_echovar}" \
@@ -150,6 +152,8 @@
 			INSTALLDIRS=vendor \
 			INSTALLMAN3DIR='none' \
 			DESTDIR="${D}" \
+			OPTIMIZE="${CFLAGS}" \
+			LDDLFLAGS="-shared ${LDFLAGS}" \
 			"${myconf_local[@]}"
 		einfo "perl Makefile.PL" "$@"
 		perl Makefile.PL "$@" <<< "${pm_echovar}" \
@@ -178,12 +182,12 @@
 			|| die "Compilation failed"
 	elif [[ -f Makefile ]] ; then
 		set -- \
-			OTHERLDFLAGS="${LDFLAGS}" \
+			OPTIMIZE="${CFLAGS}" \
+			LDDLFLAGS="-shared ${LDFLAGS}" \
 			"${mymake_local[@]}"
 		einfo "emake" "$@"
 		emake "$@" \
 			|| die "Compilation failed"
-#			OPTIMIZE="${CFLAGS}" \
 	fi
 }
 

=======================================

The details: 

Right now, if you build perl modules, e.g. ExtUtils::MakeMaker imports the 
CFLAGS and LDFLAGS used when building dev-lang/perl. They are stored for 
example in /usr/lib*/perl5/*/*/Config_heavy.pl in the "optimize" and 
"lddlflags" variable. 

The CFLAGS variable from the environment is not used at all; the cause for 
this is so far unknown. (If things were working "according to spec", they 
would be appended behind the "optimize" values... which is not really what we 
want either.)

Once OPTIMIZE="${CFLAGS}" is set, it overwrites the value from 
Config_heavy.pl. This means modules get built with the current CFLAGS. 

We can also overwrite lddlflags with the make.conf LDFLAGS by setting the 
mystic environment variable LDDLFLAGS (there's more than one way to do it!), 
but for this to work I have to manually add the parameter "-shared". 

** I'm assuming here that Perl wants to have shared library objects everywhere 
and that this parameter is accepted everywhere. If that is not true, please 
suggest an improvement or cry "foul" ... :| **

https://bugs.gentoo.org/show_bug.cgi?id=261375

=======================================

Testing done 
(in a chroot, amd64, stable except perl modules that are only ~arch and their 
deps): 

1) built a module using ExtUtils::MakeMaker against "perl with wrong flags" 
and checked log for flags (perl-core/Encode)
2) built a module using ModUtils::Build against "perl with wrong flags" and 
checked log for flags (dev-perl/Class-Load-XS)
3) built (nearly) everything using perl-modules.eclass (~1400 packages, either 
newest stable or if no stable ebuild newest ~arch) and checked for obvious 
problems by grepping the logs

Test results from 1)
All good.

Test results from 2)
Both CFLAGS and LDFLAGS are (still) inserted double. Reason so far unclear, 
odd but not problematic.

Test results from 3)

Before patching eclass:
240 packages throwing CFLAGS QA warning

After modification, the following packages still throw CFLAGS QA warning:
app-mobilephone/obexftp-0.23-r2
dev-perl/Wx-Scintilla-0.390.0
media-libs/ming-0.4.4
net-analyzer/net-snmp-5.7.3_pre3
net-analyzer/rrdtool-1.4.8
www-apache/libapreq2-2.13
www-apache/mod_perl-2.0.7

After modification, *IN ADDITION TO THOSE ABOVE* the "bad" flags occur in the 
logs of the following packages:
app-pda/pilot-link-0.12.5
dev-libs/stfl-0.22-r1
dev-perl/Text-BibTeX-0.690.0
dev-perl/math-pari-2.10.806.50
dev-vcs/subversion-1.7.14
games-arcade/frozen-bubble-2.2.1_beta1
sci-biology/vienna-rna-1.8.5
sci-libs/gdal-1.10.1
sys-fs/owfs-2.7_p21-r2
sys-libs/libapparmor-2.8.3

No additional build failures.

-- 

Andreas K. Huettel
Gentoo Linux developer 
dilfridge@gentoo.org
http://www.akhuettel.de/

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 966 bytes --]

^ permalink raw reply	[relevance 99%]

Results 1-1 of 1 | reverse | options above
-- pct% links below jump to the message on this page, permalinks otherwise --
2014-06-22  9:41 99% [gentoo-dev] perl-module.eclass: respect CFLAGS, LDFLAGS - please review Andreas K. Huettel

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