[kw-pm] Making Perl Module Packages

Andrew Kohlsmith akohlsmith-pm at benshaw.com
Tue May 11 13:57:06 CDT 2004


After some shell wrangling I have managed to figure out how to make Perl 
module packages for Slackware (or any distro, I think, you'd just have to 
tack on the distro-specific stuff like dep tracking).

I am trying to keep from installing compilers and all the compiler support 
crap on my production servers.  Much the same way as I keep X or multimedia 
crap off -- I figure they're a waste of space and can only add complication 
when not needed.

Perl modules were my pain in the ass -- As far as I have been able to 
determine (which includes hanging around freenode's #perl for a few days 
asking questions and lurking), there is no nice way to have CPAN build you a 
tarball of GroovyProg::Foo (and tarballs of all dependencies).  "make dist" 
makes the modules you see in CPAN, not a binary that you can just insert into 
a working system.

What follows is my copy-n-paste shell script.  You run Perl -MCPAN -e 'look 
GroovyProg::Foo' and then run this script in the directory you find yourself 
in.  It has no error checking, but I do a "make test" and when I copy-n-paste 
this script, I do it in two stages... everything up to and including the 
"make test" and, if that passes, the rest of it.

The resultant module package can be successfully installed and merges nicely 
into the "site-perl" directory, and it also behaves itself and ADDS itself to 
perllocal.pod.  

Slackware doesn't allow removal scripts (I wish it did) -- I would have had 
the removal script remove the module from the perllocal.pod file, otherwise.

I welcome any critique or "why didn't you just do this?" type of responses.  I 
was baffled that something like this didn't exist already (and perhaps it 
does but I was just too dense to know it).

Oh -- Make sure you don't have a "/distroot" directory with anything important 
in it.  :-)

-A.

#---8<--- Stage One ---8<---
rm -rf /distroot
mkdir -p /distroot/usr
mkdir -p /distroot/install

perl Makefile.PL SITEPREFIX=/distroot/usr
make test
#--->8--- enO egatS --->8---


#---8<--- Stage Two ---8<---
make install

mv /distroot/usr/lib/perl5/site_perl/5.8.0/i486-linux/perllocal.pod \
   /distroot/install/perllocal.pod.append

cat << EOF > /distroot/install/doinst.sh
#!/bin/sh

echo
cat install/perllocal.pod.append >> \
    usr/lib/perl5/site_perl/5.8.0/i486-linux/perllocal.pod

EOF

PKGNAME=`pwd | sed -e 's/.*\///'`
( cd /distroot ; makepkg -l y -c n ~/packages/$PKGNAME-i386-1.tgz )
rm -rf /distroot
#--->8--- owT egatS --->8---



More information about the kw-pm mailing list