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
|
2021-07-07 18:25:31 +02:00
|
|
|
# than $XBPS_BUILDDIR/$wrksrc/$build_wrksrc, one can use (relative to
|
|
|
|
# $wrksrc/$build_wrksrc):
|
2014-01-07 17:29:49 +01:00
|
|
|
#
|
|
|
|
# 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
|
|
|
|
|
2021-07-07 18:25:31 +02:00
|
|
|
if [ -f "${wrksrc}/${build_wrksrc:+$build_wrksrc/}Makefile.PL" ]; then
|
|
|
|
sed -i "s,/usr/include,${XBPS_CROSS_BASE}/usr/include,g" \
|
|
|
|
"${wrksrc}/${build_wrksrc:+$build_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
|
2021-07-07 18:25:31 +02:00
|
|
|
perlmkf="$wrksrc/${build_wrksrc:+$build_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
|
|
|
|
|
2021-07-07 18:25:31 +02:00
|
|
|
cd "$wrksrc/${build_wrksrc:+$build_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" \
|
2021-02-05 10:44:07 +01:00
|
|
|
perl -I. Makefile.PL ${configure_args} INSTALLDIRS=vendor
|
2014-01-07 17:29:49 +01:00
|
|
|
fi
|
|
|
|
|
2015-02-24 10:05:08 +01:00
|
|
|
for i in ${perl_configure_dirs}; do
|
2021-07-07 18:25:31 +02:00
|
|
|
perlmkf="$wrksrc/${build_wrksrc:+$build_wrksrc/}$i/Makefile.PL"
|
2020-09-02 19:04:41 +02:00
|
|
|
if [ -f "$perlmkf" ]; then
|
2021-07-07 18:25:31 +02:00
|
|
|
cd "$wrksrc/${build_wrksrc:+$build_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" \
|
2021-02-05 10:44:07 +01:00
|
|
|
perl -I. Makefile.PL ${make_build_args} INSTALLDIRS=vendor
|
2014-01-07 17:29:49 +01:00
|
|
|
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
|
|
|
}
|