[Libguestfs] [PATCH] Build and test Perl bindings out-of-tree.

Hilko Bengen bengen at hilluzination.de
Sat Apr 27 18:09:16 UTC 2013


Remaining issue: The C file that is generated from XS is still built
in the source directory
---
 configure.ac           |    1 +
 perl/Makefile.PL.in    |    2 +-
 perl/Makefile.am       |   16 ++++++++++++----
 perl/run-perl-tests    |   21 ---------------------
 perl/run-perl-tests.in |   21 +++++++++++++++++++++
 5 files changed, 35 insertions(+), 26 deletions(-)
 delete mode 100755 perl/run-perl-tests
 create mode 100755 perl/run-perl-tests.in

diff --git a/configure.ac b/configure.ac
index 298e6a9..b398fcb 100644
--- a/configure.ac
+++ b/configure.ac
@@ -548,6 +548,7 @@ AC_CONFIG_FILES([Makefile
                  sh/Makefile
                  xml/Makefile])
 AC_CONFIG_FILES([python/run-python-tests], [chmod +x python/run-python-tests])
+AC_CONFIG_FILES([perl/run-perl-tests], [chmod +x perl/run-perl-tests])
 AC_OUTPUT
 
 dnl Produce summary.
diff --git a/perl/Makefile.PL.in b/perl/Makefile.PL.in
index 77b4a0e..ce97579 100644
--- a/perl/Makefile.PL.in
+++ b/perl/Makefile.PL.in
@@ -19,7 +19,7 @@ use Config;
 use ExtUtils::MakeMaker;
 
 WriteMakefile (
-    FIRST_MAKEFILE => 'Makefile-pl',
+    FIRST_MAKEFILE => '@abs_builddir@/Makefile-pl',
 
     NAME => 'Win::Hivex',
     VERSION => '@PACKAGE_VERSION@',
diff --git a/perl/Makefile.am b/perl/Makefile.am
index 22dd98c..ec49192 100644
--- a/perl/Makefile.am
+++ b/perl/Makefile.am
@@ -42,16 +42,24 @@ TESTS = run-perl-tests
 $(TESTS): src_deps all
 
 TESTS_ENVIRONMENT = \
-	LD_LIBRARY_PATH=$(top_builddir)/lib/.libs
+	LD_LIBRARY_PATH=$(top_builddir)/lib/.libs \
+	srcdir=$(abs_srcdir)
 
 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
-	-[ $(srcdir) != $(builddir) ] && cp -rsu $(abs_srcdir)/. $(builddir)/.
-	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
deleted file mode 100755
index 770df94..0000000
--- a/perl/run-perl-tests
+++ /dev/null
@@ -1,21 +0,0 @@
-#!/bin/sh -
-# hivex Perl bindings
-# Copyright (C) 2009-2010 Red Hat Inc.
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License as published by
-# the Free Software Foundation; either version 2 of the License, or
-# (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-
-set -e
-
-make -f Makefile-pl test "$@"
diff --git a/perl/run-perl-tests.in b/perl/run-perl-tests.in
new file mode 100755
index 0000000..46f067c
--- /dev/null
+++ b/perl/run-perl-tests.in
@@ -0,0 +1,21 @@
+#!/bin/sh -
+# hivex Perl bindings
+# Copyright (C) 2009-2010 Red Hat Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+set -e
+
+make -C @srcdir@ -f @abs_builddir@/Makefile-pl test "$@"
-- 
1.7.10.4




More information about the Libguestfs mailing list