void-packages

Void Source Packages
git clone git://ezup.dev/void-packages.git
Log | Files | Refs | README | LICENSE

perl-ModuleBuild.sh (1829B)


      1#
      2# This helper does the required steps to be able to build and install
      3# perl modules with the Module::Build method into the correct location.
      4#
      5# Required vars to be set by a template:
      6#
      7# 	build_style=perl-ModuleBuild
      8#
      9do_configure() {
     10	if [ -f Build.PL ]; then
     11		# When cross compiling Module::Build reads in the build flags from the host perl, not the target:
     12		# extract the target specific flags (the ones also set in perl’s template) from
     13		# the target perl configuration and use them to override Module::Build’s default
     14		_conf="${XBPS_CROSS_BASE}/usr/lib/perl5/core_perl/Config_heavy.pl"
     15		_optimize=$(sed -n "s;^optimize='\(.*\)';\1;p" $_conf)
     16		_ccflags=$(sed -n "s;^ccflags='\(.*\)';\1;p" $_conf)
     17		_lddlflags=$(sed -n "s;^lddlflags='\(.*\)';\1;p" $_conf)
     18		_ldflags=$(sed -n "s;^ldflags='\(.*\)';\1;p" $_conf)
     19		_archlibexp=$(sed -n "s;^archlibexp='\(.*\)';\1;p" $_conf)
     20
     21		PERL_MM_USE_DEFAULT=1 PERL_MM_OPT="INSTALLDIRS=vendor DESTDIR='$DESTDIR'" \
     22			PERL_MB_OPT="--installdirs vendor --destdir '$DESTDIR'" \
     23			LD="$CC" CFLAGS="$CFLAGS" LDFLAGS="$LDFLAGS" \
     24			perl Build.PL --config optimize="$_optimize" --config ccflags="$_ccflags" \
     25			--config lddlflags="$_lddlflags" --config ldflags="$_ldflags" \
     26			--config archlibexp="${XBPS_CROSS_BASE}${_archlibexp}" \
     27			${configure_args} INSTALLDIRS=vendor
     28	else
     29		msg_error "$pkgver: cannot find Build.PL for perl module!\n"
     30	fi
     31}
     32
     33do_build() {
     34	if [ ! -x ./Build ]; then
     35		msg_error "$pkgver: cannot find ./Build script!\n"
     36	fi
     37	LD="$CC" CFLAGS="$CFLAGS" LDFLAGS="$LDFLAGS" ./Build ${make_build_args}
     38}
     39
     40do_check() {
     41	if [ ! -x ./Build ]; then
     42		msg_error "$pkgver: cannot find ./Build script!\n"
     43	fi
     44	./Build test
     45}
     46
     47do_install() {
     48	if [ ! -x ./Build ]; then
     49		msg_error "$pkgver: cannot find ./Build script!\n"
     50	fi
     51	./Build ${make_install_args} install
     52}