Hilko Bengen
2013-Apr-27 18:09 UTC
[Libguestfs] [PATCH] Build and test Perl bindings out-of-tree.
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
Hilko Bengen
2013-Apr-27 18:12 UTC
[Libguestfs] [PATCH] Build and test Perl bindings out-of-tree.
Oh, I should have put it in the subject, the patch is for hivex. I picked hivex first to save time on rebuilds. ;-) Cheers, -Hilko
Richard W.M. Jones
2013-Apr-29 10:19 UTC
[Libguestfs] [PATCH] Build and test Perl bindings out-of-tree.
On Sat, Apr 27, 2013 at 08:09:16PM +0200, Hilko Bengen wrote:> Remaining issue: The C file that is generated from XS is still built > in the source directoryI was reading your stackoverflow question[1] about this last week, and I agree this seems to be the best way to do separated builds for Perl. I have applied this to hivex. Thanks, Rich. [1] http://stackoverflow.com/questions/7032942/can-i-build-perl-modules-with-extutilsmakemaker-based-build-system-out-of-tre -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming blog: http://rwmj.wordpress.com Fedora now supports 80 OCaml packages (the OPEN alternative to F#)
Maybe Matching Threads
- [PATCH 1/2] Revert "perl: Fix build and test to work with separated builds."
- [PATCH 2/2] perl: Use symlink hack from hivex
- [PATCH] run script: Don't overwrite LD_LIBRARY_PATH and PERL5LIB
- [PATCH v3] perl: Switch to using Module::Build.
- [PATCH] Prepend local library path to LD_LIBRARY_PATH for tests, instead of replacing it