perl: Fix build and test to work with separated builds.

This is inspired largely by Hilko Bengen's equivalent
hivex patch here:

887466794a
This commit is contained in:
Richard W.M. Jones
2013-04-30 12:22:54 +01:00
parent 440183b440
commit 4ea016dae9
6 changed files with 21 additions and 8 deletions

1
.gitignore vendored
View File

@@ -285,6 +285,7 @@ Makefile.in
/perl/MYMETA.json
/perl/MYMETA.yml
/perl/pm_to_blib
/perl/run-perl-tests
/php/extension/acinclude.m4
/php/extension/aclocal.m4
/php/extension/autom4te.cache

View File

@@ -1546,6 +1546,8 @@ AC_CONFIG_FILES([appliance/libguestfs-make-fixed-appliance],
[chmod +x,-w appliance/libguestfs-make-fixed-appliance])
AC_CONFIG_FILES([inspector/test-xmllint.sh],
[chmod +x,-w inspector/test-xmllint.sh])
AC_CONFIG_FILES([perl/run-perl-tests],
[chmod +x,-w perl/run-perl-tests])
AC_CONFIG_FILES([pick-guests.pl],
[chmod +x,-w pick-guests.pl])
AC_CONFIG_FILES([podwrapper.pl],

View File

@@ -19,13 +19,13 @@ use Config;
use ExtUtils::MakeMaker;
WriteMakefile (
FIRST_MAKEFILE => 'Makefile-pl',
FIRST_MAKEFILE => '@abs_builddir@/Makefile-pl',
NAME => 'Sys::Guestfs',
VERSION => '0.@MAX_PROC_NR@',
LIBS => '-L@top_builddir@/src/.libs -lguestfs',
INC => '-I@top_builddir@/src -I@top_srcdir@/src',
LIBS => '-L@abs_top_builddir@/src/.libs -lguestfs',
INC => '-I@abs_top_builddir@/src -I@abs_top_srcdir@/src',
TYPEMAPS => [ '@srcdir@/typemap' ],
CCFLAGS => $Config{ccflags} . ' -DGUESTFS_PRIVATE=1 @CFLAGS@',
);

View File

@@ -64,10 +64,20 @@ TESTS_ENVIRONMENT = $(top_builddir)/run --test
INSTALLDIRS = site
all: Makefile-pl src_deps
$(MAKE) -f Makefile-pl
$(MAKE) -C $(srcdir) -f $(abs_builddir)/Makefile-pl \
INST_ARCHLIB=$(abs_builddir)/blib/arch \
INST_SCRIPT=$(abs_builddir)/blib/script \
INST_BIN=$(abs_builddir)/blib/bin \
INST_LIB=$(abs_builddir)/blib/lib \
INST_MAN1DIR=$(abs_builddir)/blib/man1 \
INST_MAN3DIR=$(abs_builddir)/blib/man3 \
TEST_FILES=$(abs_srcdir)/t/*.t
Makefile-pl: Makefile.PL
perl Makefile.PL INSTALLDIRS=$(INSTALLDIRS) PREFIX=$(prefix)
cd $(srcdir); \
perl $(abs_builddir)/Makefile.PL \
INSTALLDIRS=$(INSTALLDIRS) PREFIX=$(prefix)
sed -i 's,Makefile.PL,$(abs_builddir)/Makefile.PL,' $@
# No! Otherwise it is deleted before the clean-local rule runs.
#CLEANFILES = Makefile-pl

View File

@@ -18,4 +18,4 @@
set -e
make -f Makefile-pl test "$@"
make -C $srcdir -f @abs_builddir@/Makefile-pl test "$@"

4
run.in
View File

@@ -74,9 +74,9 @@ export LD_LIBRARY_PATH
# For Perl.
if [ -z "$PERL5LIB" ]; then
PERL5LIB="$b/perl/blib/lib:$b/perl/blib/arch"
PERL5LIB="$s/perl/lib:$b/perl/blib/lib:$b/perl/blib/arch"
else
PERL5LIB="$b/perl/blib/lib:$b/perl/blib/arch:$PERL5LIB"
PERL5LIB="$s/perl/lib:$b/perl/blib/lib:$b/perl/blib/arch:$PERL5LIB"
fi
export PERL5LIB