void-packages/helper-templates/perl-module.sh
Juan RP 0fdfc94802 Added support for build_style=perl_module. That means that perl modules
now work on pkgfs.

While doing this work I added some new variables that can be used in
templates:

run_stuff_before="<stage>"
run_stuff_after="<stage>"
run_stuff_before_<stage>_file
run_stuff_after_<stage>_file

These can be used in a template when you need to do some stuff before
or after the stage specified, and the file will be read and the commands
on it executed.

Now that finally perl modules work, add the following templates:

intltool-0.40.4 and perl-XML-Parser-2.36.

Also mktmpl.sh has been updated to understand build_style=perl_module.

ENJOY!

--HG--
extra : convert_revision : 53c5148f1ba703e2b5af6e43f71668aac54a37d2
2008-10-02 01:38:12 +02:00

92 lines
3.1 KiB
Bash
Executable file

# This helper does the required steps to be able to build and install
# perl modules into the correct location.
#
# Required vars to be set by a template:
#
# build_style=perl_module
#
# Optionally if the module needs more directories to be configured other
# than $PKGFS_BUILDDIR/$wrksrc, one can use (relative to $wrksrc):
#
# perl_configure_dirs=blob/bob foo/blah
#
# Override the paths to get desired results.
: ${_arch:=$(uname -m)}
: ${perl_thrmulti:=${_arch}-netbsd-thread-multi}
: ${perl_cmd:=$PKGFS_MASTERDIR/bin/perl}
: ${PERL_DESTDIR:=$PKGFS_MASTERDIR}
: ${PERL_PREFIX:=$PERL_DESTDIR}
: ${PERL_DPREFIX:=$PKGFS_DESTDIR/$pkgname}
: ${PERL_VERSION:=5.10.0}
: ${PERL_LDDLFLAGS:=--whole-archive -shared -L$PKGFS_MASTERDIR/lib}
: ${PERL_SITELIBEXP:=$PERL_DPREFIX/lib/perl5/site_perl/$PERL_VERSION}
: ${PERL_SITEARCHEXP:=$PERL_SITELIBEXP/$perl_thrmulti}
: ${PERL_SITEPREFIX:=$PERL_PREFIX}
: ${PERL_INSTALLPRIVLIB:=$PERL_DPREFIX/lib/perl5/$PERL_VERSION}
: ${PERL_INSTALLSITELIB:=$PERL_DPREFIX/lib/perl5/site_perl/$PERL_VERSION}
: ${PERL_INSTALLARCHLIB:=$PERL_DPREFIX/lib/perl5/$PERL_VERSION/$perl_thrmulti}
: ${PERL_INSTALLSITEARCH:=$PERL_SITELIBEXP}
: ${PERL_INSTALLBIN:=$PERL_DPREFIX/bin}
: ${PERL_INSTALLSITEBIN:=$PERL_INSTALLBIN}
: ${PERL_INSTALLSCRIPT:=$PERL_DPREFIX/bin}
: ${PERL_INSTALLSITESCRIPT:=$PERL_INSTALLSCRIPT}
: ${PERL_INSTALLMAN1DIR:=$PERL_DPREFIX/man/man1}
: ${PERL_INSTALLSITEMAN1DIR=$PERL_INSTALLMAN1DIR}
: ${PERL_INSTALLMAN3DIR:=$PERL_DPREFIX/man/man3}
: ${PERL_INSTALLSITEMAN3DIR:=$PERL_INSTALLMAN3DIR}
: ${PERL_PERLLIB:=$PERL_PREFIX/lib/perl5/$PERL_VERSION}
: ${PERL_ARCHLIB:=$PERL_PREFIX/lib/perl5/$PERL_VERSION/$perl_thrmulti}
: ${PERL_INC:=$PERL_PREFIX/lib/perl5/$PERL_VERSION/$perl_thrmulti/CORE}
: ${PERL_MAKE_VARS:=LDFLAGS=$LDFLAGS LDDLFLAGS=$PERL_LDDLFLAGS \
SITELIBEXP=$PERL_SITELIBEXP SITEARCHEXP=$PERL_SITEARCHEXP \
PERLPREFIX=$PERL_DESTDIR SITEPREFIX=$PERL_SITEPREFIX \
INSTALLPRIVLIB=$PERL_INSTALLPRIVLIB \
INSTALLSITELIB=$PERL_INSTALLSITELIB \
INSTALLARCHLIB=$PERL_INSTALLARCHLIB \
INSTALLSITEARCH=$PERL_INSTALLSITEARCH \
INSTALLBIN=$PERL_INSTALLBIN \
INSTALLSITEBIN=$PERL_INSTALLSITEBIN \
INSTALLSCRIPT=$PERL_INSTALLSCRIPT \
INSTALLSITESCRIPT=$PERL_INSTALLSITESCRIPT \
INSTALLMAN1DIR=$PERL_INSTALLMAN1DIR \
INSTALLSITEMAN1DIR=$PERL_INSTALLSITEMAN1DIR \
INSTALLMAN3DIR=$PERL_INSTALLMAN3DIR \
INSTALLSITEMAN3DIR=$PERL_INSTALLSITEMAN3DIR \
PERL_LIB=$PERL_PERLLIB PERL_ARCHLIB=$PERL_ARCHLIB}
perl_module_build()
{
local builddir="$wrksrc"
local perlmkf=
if [ -z "$perl_configure_dirs" ]; then
perlmkf="$builddir/Makefile.PL"
if [ ! -f $perlmkf ]; then
echo "*** ERROR couldn't find $perlmkf, aborting"
exit 1
fi
cd $builddir && \
$perl_cmd Makefile.PL ${PERL_MAKE_VARS} $make_build_args
if [ "$?" -ne 0 ]; then
echo "*** ERROR building perl module for $pkgname ***"
exit 1
fi
fi
for i in "$perl_configure_dirs"; do
perlmkf="$builddir/$i/Makefile.PL"
if [ -f $perlmkf ]; then
cd $builddir/$i && \
$perl_cmd Makefile.PL \
${PERL_MAKE_VARS} $make_build_args
[ "$?" -ne 0 ] && exit 1
else
echo -n "*** ERROR: couldn't find $perlmkf"
echo ", aborting ***"
exit 1
fi
done
}