diff --git a/.gitignore b/.gitignore index eb1e7493b..a3030924e 100644 --- a/.gitignore +++ b/.gitignore @@ -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 diff --git a/configure.ac b/configure.ac index bb7e2fe13..3298a4915 100644 --- a/configure.ac +++ b/configure.ac @@ -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], diff --git a/perl/Makefile.PL.in b/perl/Makefile.PL.in index 59b00d627..4f12bc080 100644 --- a/perl/Makefile.PL.in +++ b/perl/Makefile.PL.in @@ -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@', ); diff --git a/perl/Makefile.am b/perl/Makefile.am index de38fcd39..d34adbe1f 100644 --- a/perl/Makefile.am +++ b/perl/Makefile.am @@ -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 diff --git a/perl/run-perl-tests b/perl/run-perl-tests.in similarity index 93% rename from perl/run-perl-tests rename to perl/run-perl-tests.in index 0e7e9aba1..11278a81e 100755 --- a/perl/run-perl-tests +++ b/perl/run-perl-tests.in @@ -18,4 +18,4 @@ set -e -make -f Makefile-pl test "$@" +make -C $srcdir -f @abs_builddir@/Makefile-pl test "$@" diff --git a/run.in b/run.in index 33f979c95..1edc8e48b 100755 --- a/run.in +++ b/run.in @@ -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