void-packages/helper-templates/perl-module.sh
Juan RP e9def74b60 Mega patch to improve how build dependencies are handled and
how packages are found.

First: I removed all these *-deps.db files and only a single file
is used now "build-depends.db"; it's smaller and will be easier
to handle in the future... when "run-depends.db" is added :-)

Second: there's no need to specify version of package anymore;
before you had to do:

	$ pkgfs.sh install git-1.6.0.2

now you only do:

	$ pkgfs.sh install git

This will read the variables located at PKGFS_TEMPLATESDIR/git.tmpl
and will the install the version that is there.

--HG--
extra : convert_revision : 9e3e5d70965a69c76f59e322b7c7b674d627af52
2008-10-04 06:29:49 +02:00

93 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-$version}
: ${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
}