Hi,
Below is (part of) our internal documentation on perl module building
inside our solaris environment. I'll spare you the part about gcc
selection and get right to the point.
You can see that the makefile generation depends on selecting the right
$PERL and $FULLPERL. I've been trying to at least automate this part by
writing a MY::find_perl, sticking this somewhere in my home directory and
try to get perl to find this find_perl instead of the one in MM_Unix. I
found another way: copying and editing MM_Unix.pm directly (fixing
find_perl) and setting PERL5LIB. Not very clean. Is there a better way?
The other one is much more difficult to do. Our perl installation ends up
with a Config.pm that has entries like this:
installprivlib='/opt/local/stow/perl-5.8.0/lib/perl5/5.8.0'
We need to put every module in its own install path, something like:
/opt/local/sun4u-5.8/stow/cpan$VERSION.$MODULENAME/lib/perl5/5.8.0
So we end up doing a s/ regex to change all of those paths.
For reference on how all this is done, see below. It would be heaven if we
could somehow rip the dependency part out of CPAN or otherwise (preferred
option!) fix MakeMaker to let us insert the right values for all these at
build time, so that we can use CPAN directly.
I was wondering if you have any thoughts on improving our build process. I
know we can set VENDOR* but that just moves the problem, it doesn't
resolve it. Also making a separate Config.pm for each build is a
possibility, but we'd have to script that behaviour into CPAN to setup the
Config.pm on each build.
Thanks for any help with this! Our building docs follow:
MAKEFILE GENERATION:
Let perl build the Makefile:
% $SOMEPERL Makefile.PL PERL=$PATHTO_SOMEPERL
FULLPERL=$PATHTO_SOMEPERL
$SOMEPERL should be the perl you're building a module for, and
$PATHTO_SOMEPERL is the same perl, fully-pathed. (we need to help perl
find itself, otherwise it'll find /opt/local/bin/perl which is 5.005_02).
So for 5.8.0 it'd be:
% perl5.8.0 Makefile.PL PERL=/opt/local/bin/perl5.8.0 \
FULLPERL=/opt/local/bin/perl5.8.0
Now we have to tweak the Makefile for stow. I usually stow perl modules
as cpan.$MODULE for perl5.6.0, or cpan573.$MODULE or cpan580.$MODULE.
% find . -name Makefile -print | xargs perl -pi~ -e \
's,^(INST.*)/opt/local/stow/$SOMEPERL,$1/opt/local/sun4u-5.8/stow/$STOWNAME,;'
So, if I was installing Bit::Vector for perl5.8.0, it'd look like:
% find . -name Makefile -print | xargs perl -pi~ -e \
's,^(INST.*)/opt/local/stow/perl-5.8.0,$1/opt/local/sun4u-5.8/stow/cpan580.Bit-Vector-6.3,;'
If you're building on 5.5.1 (for perl5.6.0) , say "/export/local" instead
of "/opt/local/sun4u-5.8" here.
BUILDING:
Build it:
% make 2>&1 | tee Make.log
(in csh that'd be "make |& tee Make.log", or you can run "script
Make.log", and then "make").
Test it:
% make test
If that looks OK login to the fileserver, su, cd to the build dir &
% make install
% cd /export/local/sun4u-5.8/stow #(/export/local/stow for
perl5.6.0)
% cat
$STOWNAME/lib/perl5/site_perl/5.8.0/sun4-solaris-64int/perllocal.pod \
>> /opt/local/lib/perl5/5.8.0/sun4-solaris-64int/perllocal.pod
# beware, some perls put perlocal.pod in a slightly different
place...
% rm
$STOWNAME/lib/perl5/site_perl/5.8.0/sun4-solaris-64int/perllocal.pod
% stow $STOWNAME
% /opt/local/etc/buildlocalinterface