2014-01-07 16:29:49 +00: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 19:19:00 +00:00
|
|
|
local perlprefix=${XBPS_STATEDIR}/perlprefix-${XBPS_TARGET_MACHINE}
|
|
|
|
mkdir -p $perlprefix
|
2018-02-26 18:52:04 +00:00
|
|
|
if [ -d "$XBPS_CROSS_BASE/usr/lib/perl5/core_perl" ]; then
|
2018-02-26 08:33:16 +00: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 04:42:19 +00: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 08:33:16 +00:00
|
|
|
else
|
|
|
|
cp "/usr/lib/perl5/core_perl/Config"*.p? $perlprefix
|
|
|
|
cp "/usr/lib/perl5/core_perl/Errno.pm" $perlprefix
|
|
|
|
fi
|
2016-08-14 19:19:00 +00:00
|
|
|
export PERL5LIB=$perlprefix
|
|
|
|
|
2020-09-02 17:04:41 +00:00
|
|
|
if [ -f "${wrksrc}/Makefile.PL" ]; then
|
|
|
|
sed -i "s,/usr/include,${XBPS_CROSS_BASE}/usr/include,g" "${wrksrc}/Makefile.PL"
|
2015-02-24 09:05:08 +00:00
|
|
|
fi
|
|
|
|
|
2014-01-07 16:29:49 +00:00
|
|
|
if [ -z "$perl_configure_dirs" ]; then
|
|
|
|
perlmkf="$wrksrc/Makefile.PL"
|
2020-09-02 17:04:41 +00:00
|
|
|
if [ ! -f "$perlmkf" ]; then
|
2014-01-07 16:29:49 +00:00
|
|
|
msg_error "*** ERROR couldn't find $perlmkf, aborting ***\n"
|
|
|
|
fi
|
|
|
|
|
2020-09-02 17:04:41 +00:00
|
|
|
cd "$wrksrc"
|
2014-01-28 09:31:06 +00: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 17:52:56 +00:00
|
|
|
LDFLAGS="$LDFLAGS -L${XBPS_CROSS_BASE}/usr/lib -lperl" \
|
2014-01-28 09:31:06 +00:00
|
|
|
LDDLFLAGS="-shared $CFLAGS -L${XBPS_CROSS_BASE}/usr/lib" \
|
2014-01-07 16:29:49 +00:00
|
|
|
perl Makefile.PL ${configure_args} INSTALLDIRS=vendor
|
|
|
|
fi
|
|
|
|
|
2015-02-24 09:05:08 +00:00
|
|
|
for i in ${perl_configure_dirs}; do
|
2014-01-07 16:29:49 +00:00
|
|
|
perlmkf="$wrksrc/$i/Makefile.PL"
|
2020-09-02 17:04:41 +00:00
|
|
|
if [ -f "$perlmkf" ]; then
|
|
|
|
cd "$wrksrc/$i"
|
2014-01-28 09:31:06 +00: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 17:52:56 +00:00
|
|
|
LDFLAGS="$LDFLAGS -L${XBPS_CROSS_BASE}/usr/lib -lperl" \
|
|
|
|
LDDLFLAGS="-shared $CFLAGS -L${XBPS_CROSS_BASE}/usr/lib -lperl" \
|
2014-01-07 16:29:49 +00: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 09:31:06 +00:00
|
|
|
${make_cmd} CC="$CC" LD="$CC" CFLAGS="$CFLAGS" OPTIMIZE="$CFLAGS" \
|
2015-06-22 17:52:56 +00:00
|
|
|
LDFLAGS="$LDFLAGS -L${XBPS_CROSS_BASE}/usr/lib -lperl" \
|
|
|
|
LDDLFLAGS="-shared $CFLAGS -L${XBPS_CROSS_BASE}/usr/lib -lperl" \
|
2014-01-28 09:31:06 +00:00
|
|
|
${makejobs} ${make_build_args} ${make_build_target}
|
2014-01-07 16:29:49 +00:00
|
|
|
}
|
|
|
|
|
2017-11-20 03:27:25 +00:00
|
|
|
do_check() {
|
|
|
|
: ${make_cmd:=make}
|
|
|
|
: ${make_check_target:=test}
|
|
|
|
|
|
|
|
${make_cmd} ${make_check_args} ${make_check_target}
|
|
|
|
}
|
|
|
|
|
2014-01-07 16:29:49 +00:00
|
|
|
do_install() {
|
|
|
|
: ${make_cmd:=make}
|
|
|
|
: ${make_install_target:=install}
|
|
|
|
|
2015-02-19 15:38:30 +00:00
|
|
|
${make_cmd} DESTDIR=${DESTDIR} ${make_install_args} ${make_install_target}
|
2014-01-07 16:29:49 +00:00
|
|
|
}
|