2014-01-07 17:29:49 +01:00
|
|
|
#
|
|
|
|
# This helper does the required steps to be able to build and install
|
|
|
|
# perl modules that use MakeMaker 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 $XBPS_BUILDDIR/$wrksrc, one can use (relative to $wrksrc):
|
|
|
|
#
|
|
|
|
# perl_configure_dirs="blob/bob foo/blah"
|
|
|
|
#
|
|
|
|
do_configure() {
|
|
|
|
local perlmkf
|
|
|
|
|
2016-08-14 21:19:00 +02:00
|
|
|
local perlprefix=${XBPS_STATEDIR}/perlprefix-${XBPS_TARGET_MACHINE}
|
|
|
|
mkdir -p $perlprefix
|
2018-02-26 19:52:04 +01:00
|
|
|
if [ -d "$XBPS_CROSS_BASE/usr/lib/perl5/core_perl" ]; then
|
2018-02-26 09:33:16 +01:00
|
|
|
cp "$XBPS_CROSS_BASE/usr/lib/perl5/core_perl/Config"*.p? $perlprefix
|
|
|
|
cp "$XBPS_CROSS_BASE/usr/lib/perl5/core_perl/Errno.pm" $perlprefix
|
2018-09-04 06:42:19 +02:00
|
|
|
sed -i -e "s;archlibexp => '\(.*\)';archlibexp => '${XBPS_CROSS_BASE}\1';" \
|
|
|
|
${perlprefix}/Config.pm
|
|
|
|
sed -i -e "s;^archlibexp='\(.*\)';archlibexp='${XBPS_CROSS_BASE}\1';" \
|
|
|
|
${perlprefix}/Config_heavy.pl
|
2018-02-26 09:33:16 +01:00
|
|
|
else
|
|
|
|
cp "/usr/lib/perl5/core_perl/Config"*.p? $perlprefix
|
|
|
|
cp "/usr/lib/perl5/core_perl/Errno.pm" $perlprefix
|
|
|
|
fi
|
2016-08-14 21:19:00 +02:00
|
|
|
export PERL5LIB=$perlprefix
|
|
|
|
|
2020-09-02 19:04:41 +02:00
|
|
|
if [ -f "${wrksrc}/Makefile.PL" ]; then
|
|
|
|
sed -i "s,/usr/include,${XBPS_CROSS_BASE}/usr/include,g" "${wrksrc}/Makefile.PL"
|
2015-02-24 10:05:08 +01:00
|
|
|
fi
|
|
|
|
|
2014-01-07 17:29:49 +01:00
|
|
|
if [ -z "$perl_configure_dirs" ]; then
|
|
|
|
perlmkf="$wrksrc/Makefile.PL"
|
2020-09-02 19:04:41 +02:00
|
|
|
if [ ! -f "$perlmkf" ]; then
|
2014-01-07 17:29:49 +01:00
|
|
|
msg_error "*** ERROR couldn't find $perlmkf, aborting ***\n"
|
|
|
|
fi
|
|
|
|
|
2020-09-02 19:04:41 +02:00
|
|
|
cd "$wrksrc"
|
2014-01-28 10:31:06 +01:00
|
|
|
PERL_MM_USE_DEFAULT=1 GCC="$CC" CC="$CC" LD="$CC" \
|
|
|
|
OPTIMIZE="$CFLAGS" \
|
|
|
|
CFLAGS="$CFLAGS -I${XBPS_CROSS_BASE}/usr/include" \
|
2015-06-22 19:52:56 +02:00
|
|
|
LDFLAGS="$LDFLAGS -L${XBPS_CROSS_BASE}/usr/lib -lperl" \
|
2014-01-28 10:31:06 +01:00
|
|
|
LDDLFLAGS="-shared $CFLAGS -L${XBPS_CROSS_BASE}/usr/lib" \
|
2014-01-07 17:29:49 +01:00
|
|
|
perl Makefile.PL ${configure_args} INSTALLDIRS=vendor
|
|
|
|
fi
|
|
|
|
|
2015-02-24 10:05:08 +01:00
|
|
|
for i in ${perl_configure_dirs}; do
|
2014-01-07 17:29:49 +01:00
|
|
|
perlmkf="$wrksrc/$i/Makefile.PL"
|
2020-09-02 19:04:41 +02:00
|
|
|
if [ -f "$perlmkf" ]; then
|
|
|
|
cd "$wrksrc/$i"
|
2014-01-28 10:31:06 +01:00
|
|
|
PERL_MM_USE_DEFAULT=1 GCC="$CC" CC="$CC" LD="$CC" \
|
|
|
|
OPTIMIZE="$CFLAGS" \
|
|
|
|
CFLAGS="$CFLAGS -I${XBPS_CROSS_BASE}/usr/include" \
|
2015-06-22 19:52:56 +02:00
|
|
|
LDFLAGS="$LDFLAGS -L${XBPS_CROSS_BASE}/usr/lib -lperl" \
|
|
|
|
LDDLFLAGS="-shared $CFLAGS -L${XBPS_CROSS_BASE}/usr/lib -lperl" \
|
2014-01-07 17:29:49 +01:00
|
|
|
perl Makefile.PL ${make_build_args} INSTALLDIRS=vendor
|
|
|
|
else
|
|
|
|
msg_error "*** ERROR: couldn't find $perlmkf, aborting **\n"
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
}
|
|
|
|
|
|
|
|
do_build() {
|
|
|
|
: ${make_cmd:=make}
|
|
|
|
|
2014-01-28 10:31:06 +01:00
|
|
|
${make_cmd} CC="$CC" LD="$CC" CFLAGS="$CFLAGS" OPTIMIZE="$CFLAGS" \
|
2015-06-22 19:52:56 +02:00
|
|
|
LDFLAGS="$LDFLAGS -L${XBPS_CROSS_BASE}/usr/lib -lperl" \
|
|
|
|
LDDLFLAGS="-shared $CFLAGS -L${XBPS_CROSS_BASE}/usr/lib -lperl" \
|
2014-01-28 10:31:06 +01:00
|
|
|
${makejobs} ${make_build_args} ${make_build_target}
|
2014-01-07 17:29:49 +01:00
|
|
|
}
|
|
|
|
|
2017-11-20 04:27:25 +01:00
|
|
|
do_check() {
|
|
|
|
: ${make_cmd:=make}
|
|
|
|
: ${make_check_target:=test}
|
|
|
|
|
|
|
|
${make_cmd} ${make_check_args} ${make_check_target}
|
|
|
|
}
|
|
|
|
|
2014-01-07 17:29:49 +01:00
|
|
|
do_install() {
|
|
|
|
: ${make_cmd:=make}
|
|
|
|
: ${make_install_target:=install}
|
|
|
|
|
2015-02-19 16:38:30 +01:00
|
|
|
${make_cmd} DESTDIR=${DESTDIR} ${make_install_args} ${make_install_target}
|
2014-01-07 17:29:49 +01:00
|
|
|
}
|