[Slackbuilds-users] Perl-modules and CFLAGS

Thomas Morper thomas at beingboiled.info
Wed Jun 23 21:28:04 UTC 2010


Dear Slackbuilders,

I'm in the process of preparing some Perl-modules for SBo but I'm unsure
how to handle CFLAGS "the right way" when C is involved.

A MakeMaker-based Makefile.PL allows you to pass the CCFLAGS and
OPTIMIZE variables to the compiler, however...

1.) 'perl Makefile.PL CCFLAGS="$SLKCFLAGS"' isn't a very good idea,
since it will a overwrite the CCFLAGS defaults and something like a
missing "-D_LARGEFILE_SOURCE" will haunt you later on.

2.) 'perl Makefile.PL OPTIMIZE="$SLKCFLAGS"' isn't perfect, either. So
far I've got three modules and in each one OPTIMIZE behaves differently:

 - module1 only has "-O2" as a default but will accept OPTIMIZE
 - module2 uses what Perl was compiled with as a default, e.g. "-O2
   -march=i486 -mtune=i686" and thus doesn't need OPTIMIZE, but will
   use it if it's set
 - module3 is similar to module2, however for some of its C-sources it
   will use the Perl defaults instead of whatever you set OPTIMIZE to

My conclusion: there are 18000 modules on cpan.org - don't waste your
time trying to find the über-perfect settings for each one, just go with
the defaults unless there's a good reason for manual intervention (e.g.
doesn't work otherwise).

In SBo-terms: set ARCH, SLKCFLAGS and LIBDIRSUFFIX as we always do, but
don't care about it; the result will be fine for most users. Those who
want more from their Perl modules still only have to add a single line
to the module's SlackBuild script.

Interestingly, this is what the current template does :-) So, is this
the way to go or am I missing something and the CFLAGS actually do need
more attention?

-- 


More information about the SlackBuilds-users mailing list