perl: convert to the new template format.

This commit is contained in:
Juan RP 2013-04-10 23:46:36 +02:00
parent fef8be1ee0
commit e1e1e54d9b
1 changed files with 130 additions and 127 deletions

View File

@ -11,11 +11,130 @@ license="GPL-2"
distfiles="http://www.cpan.org/src/5.0/perl-${version}.tar.bz2"
checksum=bb7bc735e6813b177dcfccd480defcde7eddefa173b5967eac11babd1bfa98e8
disable_debug=yes
# Before updating this package to a new major version, run ${FILESDIR}/provides.pl
# against ${wrksrc} to find the list of built in packages.
_provides="
if [ "$CROSS_BUILD" ]; then
hostmakedepends+=" perl>=${version}"
fi
do_configure() {
local _args="-Dusethreads -Duseshrplib
-Dprefix=/usr -Dvendorprefix=/usr
-Dprivlib=/usr/share/perl5/core_perl
-Darchlib=/usr/lib/perl5/core_perl
-Dsitelib=/usr/share/perl5/site_perl
-Dsitearch=/usr/lib/perl5/site_perl
-Dvendorlib=/usr/share/perl5/vendor_perl
-Dvendorarch=/usr/lib/perl5/vendor_perl
-Dscriptdir=/usr/lib/perl5/core_perl/bin
-Dvendorscript=/usr/lib/perl5/vendor_perl/bin
-Dinc_version_list=none -Dman1ext=1p -Dman3ext=3p
-Dman1dir=/usr/share/man/man1
-Dman3dir=/usr/share/man/man3"
if [ "$CROSS_BUILD" ]; then
# Copy target files
if [ ! -d $FILESDIR/$XBPS_CROSS_TRIPLET ]; then
msg_error "$pkgver: cannot be cross built for $XBPS_CROSS_TRIPLET, contact $maintainer.\n"
fi
cp -f ${FILESDIR}/${XBPS_CROSS_TRIPLET}/* .
cp -f ${FILESDIR}/Configure.cross .
# substitute some required strings in generated config.sh
sed -e "s|@@PERL_VERSION@@|${version}|g" \
-e "s|@@PERL_SUBVERSION@@|${version##*.}|g" \
-i config.sh
sh ./Configure.cross
perl -Ilib make_patchnum.pl
else
./Configure -des ${_args} \
-Dcccdlflags="-fPIC" \
-Doptimize="${XBPS_CFLAGS}"
fi
}
do_build() {
if [ "$CROSS_BUILD" ]; then
export HOST_PERL=/usr/bin/perl
export PERL_TO_USE=$HOST_PERL
export HOST_PERL_LIBS=/usr/lib/perl5/core_perl
export LIB=/usr/$XBPS_CROSS_TRIPLET/lib
export INCLUDE=/usr/$XBPS_CROSS_TRIPLET/include
make SHRPLDFLAGS='-shared -Wl,-soname,libperl.so' \
CROSS_PERL=$HOST_PERL libperl.so ${makejobs}
cp -fr $HOST_PERL_LIBS/auto/* lib/auto/
mkdir -p lib/$XBPS_CROSS_TRIPLET
make extensions CROSS_PERL=$HOST_PERL \
INST_ARCHLIB=$wrksrc/lib/$XBPS_CROSS_TRIPLET \
${makejobs}
else
make ${makejobs}
fi
}
do_install() {
if [ "$CROSS_BUILD" ]; then
export HOST_PERL=/usr/bin/perl
export PERL_TO_USE=$HOST_PERL
export HOST_PERL_LIBS=/usr/lib/perl5/core_perl
export LIB=/usr/$XBPS_CROSS_TRIPLET/lib
export INCLUDE=/usr/$XBPS_CROSS_TRIPLET/include
cp -fr $HOST_PERL_LIBS/auto/* lib/auto/
make CROSS_PERL=$HOST_PERL DESTDIR=$DESTDIR install
find lib/auto -name .exists -o -name '*.bs' | xargs rm -f
vmkdir usr/lib/perl5/core_perl/auto
cp -fr lib/$XBPS_CROSS_TRIPLET/auto/* \
${DESTDIR}/usr/lib/perl5/core_perl/auto/
find ${DESTDIR} -name .exists |xargs rm -f
rm -rf ${DESTDIR}/usr/share/perl5/core_perl/$XBPS_CROSS_TRIPLET
else
# We use the same defaults than Arch Linux.
make DESTDIR=${DESTDIR} install
fi
# Set proper perms to shared libs.
find ${DESTDIR} -type f -name \*.so -exec chmod 644 {} \;
# Make a link from perl${version} to perl.
cd ${DESTDIR}/usr/bin && ln -sf perl${version} perl
### CPAN Settings ###
# Set CPAN default config to use the site directories.
sed -e '/(makepl_arg =>/ s/""/"INSTALLDIRS=site"/' \
-e '/(mbuildpl_arg =>/ s/""/"installdirs=site"/' \
-i ${DESTDIR}/usr/share/perl5/core_perl/CPAN/FirstTime.pm
### CPANPLUS Settings ###
# Set CPANPLUS default config to use the site directories.
sed -e "/{'makemakerflags'}/ s/'';/'INSTALLDIRS=site';/" \
-e "/{'buildflags'}/ s/'';/'installdirs=site';/" \
-i ${DESTDIR}/usr/share/perl5/core_perl/CPANPLUS/Config.pm
# Profile script so set paths to perl scripts.
vinstall ${FILESDIR}/perlbin.sh 644 etc/profile.d
# Remove all pod files *except* those under
# /usr/share/perl5/core_perl/pod/ (FS#16488)
rm -f ${DESTDIR}/usr/share/perl5/core_perl/*.pod
for d in ${DESTDIR}/usr/share/perl5/core_perl/*; do
if [ -d $d -a $(basename $d) != "pod" ]; then
find $d -name *.pod -delete
fi
done
find ${DESTDIR}/usr/lib -name *.pod -delete
find ${DESTDIR} -name .packlist -delete
# Make a symlink so that libperl.so is accesible.
cd ${DESTDIR}/usr/lib && \
ln -sf ./perl5/core_perl/CORE/libperl.so libperl.so
}
perl_package() {
_provides="
perl-Archive-Extract-0.58_1
perl-Archive-Tar-1.82_1
perl-Attribute-Handlers-0.93_1
@ -147,130 +266,14 @@ perl-threads-1.86_1
perl-threads-shared-1.40_1
perl-version-0.99_1
"
for _f in ${_provides}; do
_p=$($XBPS_UHELPER_CMD getpkgname ${_f})
provides="${provides} ${_f}"
replaces="${replaces} ${_p}>=0"
done
unset _f _p _provides
if [ "$CROSS_BUILD" ]; then
hostmakedepends+=" perl>=${version}"
fi
do_configure() {
local _args="-Dusethreads -Duseshrplib
-Dprefix=/usr -Dvendorprefix=/usr
-Dprivlib=/usr/share/perl5/core_perl
-Darchlib=/usr/lib/perl5/core_perl
-Dsitelib=/usr/share/perl5/site_perl
-Dsitearch=/usr/lib/perl5/site_perl
-Dvendorlib=/usr/share/perl5/vendor_perl
-Dvendorarch=/usr/lib/perl5/vendor_perl
-Dscriptdir=/usr/lib/perl5/core_perl/bin
-Dvendorscript=/usr/lib/perl5/vendor_perl/bin
-Dinc_version_list=none -Dman1ext=1p -Dman3ext=3p
-Dman1dir=/usr/share/man/man1
-Dman3dir=/usr/share/man/man3"
if [ "$CROSS_BUILD" ]; then
# Copy target files
if [ ! -d $FILESDIR/$XBPS_CROSS_TRIPLET ]; then
msg_error "$pkgver: cannot be cross built for $XBPS_CROSS_TRIPLET, contact $maintainer.\n"
fi
cp -f ${FILESDIR}/${XBPS_CROSS_TRIPLET}/* .
cp -f ${FILESDIR}/Configure.cross .
# substitute some required strings in generated config.sh
sed -e "s|@@PERL_VERSION@@|${version}|g" \
-e "s|@@PERL_SUBVERSION@@|${version##*.}|g" \
-i config.sh
sh ./Configure.cross
perl -Ilib make_patchnum.pl
else
./Configure -des ${_args} \
-Dcccdlflags="-fPIC" \
-Doptimize="${XBPS_CFLAGS}"
fi
}
do_build() {
if [ "$CROSS_BUILD" ]; then
export HOST_PERL=/usr/bin/perl
export PERL_TO_USE=$HOST_PERL
export HOST_PERL_LIBS=/usr/lib/perl5/core_perl
export LIB=/usr/$XBPS_CROSS_TRIPLET/lib
export INCLUDE=/usr/$XBPS_CROSS_TRIPLET/include
make SHRPLDFLAGS='-shared -Wl,-soname,libperl.so' \
CROSS_PERL=$HOST_PERL libperl.so ${makejobs}
cp -fr $HOST_PERL_LIBS/auto/* lib/auto/
mkdir -p lib/$XBPS_CROSS_TRIPLET
make extensions CROSS_PERL=$HOST_PERL \
INST_ARCHLIB=$wrksrc/lib/$XBPS_CROSS_TRIPLET \
${makejobs}
else
make ${makejobs}
fi
}
do_install() {
if [ "$CROSS_BUILD" ]; then
export HOST_PERL=/usr/bin/perl
export PERL_TO_USE=$HOST_PERL
export HOST_PERL_LIBS=/usr/lib/perl5/core_perl
export LIB=/usr/$XBPS_CROSS_TRIPLET/lib
export INCLUDE=/usr/$XBPS_CROSS_TRIPLET/include
cp -fr $HOST_PERL_LIBS/auto/* lib/auto/
make CROSS_PERL=$HOST_PERL DESTDIR=$DESTDIR install
find lib/auto -name .exists -o -name '*.bs' | xargs rm -f
vmkdir usr/lib/perl5/core_perl/auto
cp -fr lib/$XBPS_CROSS_TRIPLET/auto/* \
${DESTDIR}/usr/lib/perl5/core_perl/auto/
find ${DESTDIR} -name .exists |xargs rm -f
rm -rf ${DESTDIR}/usr/share/perl5/core_perl/$XBPS_CROSS_TRIPLET
else
# We use the same defaults than Arch Linux.
make DESTDIR=${DESTDIR} install
fi
# Set proper perms to shared libs.
find ${DESTDIR} -type f -name \*.so -exec chmod 644 {} \;
# Make a link from perl${version} to perl.
cd ${DESTDIR}/usr/bin && ln -sf perl${version} perl
### CPAN Settings ###
# Set CPAN default config to use the site directories.
sed -e '/(makepl_arg =>/ s/""/"INSTALLDIRS=site"/' \
-e '/(mbuildpl_arg =>/ s/""/"installdirs=site"/' \
-i ${DESTDIR}/usr/share/perl5/core_perl/CPAN/FirstTime.pm
### CPANPLUS Settings ###
# Set CPANPLUS default config to use the site directories.
sed -e "/{'makemakerflags'}/ s/'';/'INSTALLDIRS=site';/" \
-e "/{'buildflags'}/ s/'';/'installdirs=site';/" \
-i ${DESTDIR}/usr/share/perl5/core_perl/CPANPLUS/Config.pm
# Profile script so set paths to perl scripts.
vinstall ${FILESDIR}/perlbin.sh 644 etc/profile.d
# Remove all pod files *except* those under
# /usr/share/perl5/core_perl/pod/ (FS#16488)
rm -f ${DESTDIR}/usr/share/perl5/core_perl/*.pod
for d in ${DESTDIR}/usr/share/perl5/core_perl/*; do
if [ -d $d -a $(basename $d) != "pod" ]; then
find $d -name *.pod -delete
fi
# Find virtual packages provided by the current perl version.
for _f in ${_provides}; do
_p=$($XBPS_UHELPER_CMD getpkgname ${_f})
provides+=" ${_f}"
replaces+=" ${_p}>=0"
done
find ${DESTDIR}/usr/lib -name *.pod -delete
find ${DESTDIR} -name .packlist -delete
# Make a symlink so that libperl.so is accesible.
cd ${DESTDIR}/usr/lib && \
ln -sf ./perl5/core_perl/CORE/libperl.so libperl.so
pkg_install() {
vmove usr
}
}