perl: Switch to using Module::Build.

Replace ExtUtils::MakeMaker with Module::Build.

'perllocal.pod' and 'bindtests.pl' are no longer incorrectly
installed.

This change also removes the following phony deps: appliance src_deps
test_images.  No other language binding needs explicit dependencies
for their tests, they just rely on the top level build order being
correct (ie. SUBDIRS in /Makefile.am).
This commit is contained in:
Richard W.M. Jones
2015-10-23 14:11:21 +01:00
parent 1c506aa960
commit f98e0f115b
10 changed files with 143 additions and 84 deletions

12
.gitignore vendored
View File

@@ -371,17 +371,17 @@ Makefile.in
/p2v/virt-p2v-make-disk.1
/p2v/virt-p2v-make-kickstart
/p2v/virt-p2v-make-kickstart.1
/perl/_build
/perl/bindtests.pl
/perl/blib
/perl/Build
/perl/Build.PL
/perl/examples/guestfs-perl.3
/perl/examples/stamp-guestfs-perl.pod
/perl/Guestfs.bs
/perl/Guestfs.c
/perl/Guestfs.xs
/perl/lib/Sys/Guestfs.bs
/perl/lib/Sys/Guestfs.c
/perl/lib/Sys/Guestfs.xs
/perl/lib/Sys/Guestfs.pm
/perl/Makefile-pl
/perl/Makefile.PL
/perl/Makefile-pl.old
/perl/MYMETA.json
/perl/MYMETA.yml
/perl/pm_to_blib

2
README
View File

@@ -192,6 +192,8 @@ The full requirements are described below.
+--------------+-------------+---+-----------------------------------------+
| ocaml-gettext| | O | For localizing OCaml virt-* tools. |
+--------------+-------------+---+-----------------------------------------+
| Module::Build| 0.19 | O | To build the Perl bindings. |
+--------------+-------------+---+-----------------------------------------+
| Python | 2.2 | O | For the Python bindings. |
+--------------+-------------+---+-----------------------------------------+
| Ruby | | O | >= 1.9 is better than 1.8. |

View File

@@ -1774,8 +1774,8 @@ AC_CONFIG_FILES([Makefile
ocaml/Makefile
ocaml/examples/Makefile
p2v/Makefile
perl/Build.PL
perl/Makefile
perl/Makefile.PL
perl/examples/Makefile
php/Makefile
po-docs/Makefile

View File

@@ -127,7 +127,7 @@ Run it from the top source directory using the command
output_to "ocaml/guestfs-c-actions.c" generate_ocaml_c;
output_to "ocaml/guestfs-c-errnos.c" generate_ocaml_c_errnos;
output_to "ocaml/bindtests.ml" generate_ocaml_bindtests;
output_to "perl/Guestfs.xs" generate_perl_xs;
output_to "perl/lib/Sys/Guestfs.xs" generate_perl_xs;
output_to "perl/lib/Sys/Guestfs.pm" generate_perl_pm;
output_to "perl/bindtests.pl" generate_perl_bindtests;
output_to "python/guestfs-py.c" generate_python_c;

72
perl/Build.PL.in Executable file
View File

@@ -0,0 +1,72 @@
#!/usr/bin/env perl
# libguestfs Perl bindings
# Copyright (C) 2009-2015 Red Hat Inc.
# @configure_input@
#
# 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.,
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
use warnings;
use strict;
use Module::Build;
# The Perl module version doesn't (and can't) use the libguestfs
# version. It uses '0.<max_proc_nr>' instead. However it's nice to
# set the release_status correctly here based on the libguestfs minor
# number (see configure.ac for how this works).
my $release_status;
if ('@BRANCH_TYPE@' eq 'stable') { $release_status = "stable" }
else { $release_status = "testing" }
my $build = Module::Build->new (
module_name => 'Sys::Guestfs',
release_status => $release_status,
license => 'lgpl', # See COPYING.LIB
configure_requires => {
'Module::Build' => '0.4004', # test_requires
},
build_requires => {
'ExtUtils::CBuilder' => 0,
},
requires => {
perl => '5.6.0',
},
test_requires => {
'Test::More' => 0,
},
create_packlist => 0,
needs_compiler => 1,
extra_compiler_flags => [
'-DGUESTFS_PRIVATE=1',
split (' ', '@CFLAGS@'),
],
include_dirs => [
'@top_builddir@/src',
'@top_srcdir@/src',
],
extra_linker_flags => [
'-L@top_builddir@/src/.libs',
'-lguestfs',
],
);
$build->create_build_script;

31
perl/MANIFEST Normal file
View File

@@ -0,0 +1,31 @@
bindtests.pl
Build.PL
Build.PL.in
examples/create_disk.pl
examples/guestfs-perl.pod
examples/inspect_vm.pl
examples/LICENSE
examples/Makefile.am
examples/README
lib/Sys/Guestfs.pm
lib/Sys/Guestfs.xs
Makefile.am
MANIFEST This list of files
README
run-bindtests
run-perl-tests
t/010-load.t
t/020-create.t
t/030-create-flags.t
t/040-create-multiple.t
t/060-handle-properties.t
t/070-optargs.t
t/100-launch.t
t/410-close-event.t
t/420-log-messages.t
t/800-explicit-close.t
t/810-mkdir-eexist.t
t/900-introspection.t
t/910-pod.t
t/920-pod-coverage.t
typemap

View File

@@ -1,31 +0,0 @@
# libguestfs Perl bindings
# Copyright (C) 2009-2015 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
use Config;
use ExtUtils::MakeMaker;
WriteMakefile (
FIRST_MAKEFILE => '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',
TYPEMAPS => [ '@srcdir@/typemap' ],
CCFLAGS => $Config{ccflags} . ' -DGUESTFS_PRIVATE=1 @CFLAGS@',
);

View File

@@ -1,5 +1,5 @@
# libguestfs Perl bindings
# Copyright (C) 2009 Red Hat Inc.
# Copyright (C) 2009-2015 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
@@ -24,7 +24,7 @@ generator_built = \
EXTRA_DIST = \
$(generator_built) \
Makefile.PL.in \
Build.PL.in \
examples/README \
examples/LICENSE \
examples/*.pl \
@@ -33,54 +33,39 @@ EXTRA_DIST = \
t/*.t \
typemap
DISTCLEANFILES = Build
# It would be nice to do this, but 'make distclean' runs 'make clean'
# in parallel, and './Build clean' requires '_build/magicnum' to
# exist, so you end up deleting a file which is required by the
# parallel 'make clean' instance.
#
#distclean-local:
# rm -rf _build
if HAVE_PERL
# Interfacing automake and ExtUtils::MakeMaker known to be
# a nightmare, news at 11.
all-local: Build
./Build
# src/ dependencies
src_deps: $(top_builddir)/src/libguestfs.la $(generator_built)
clean-local: Build
./Build clean
# Images used by tests.
test_images:
$(MAKE) -C $(top_builddir)/tests/data
# Build the appliance.
appliance:
$(MAKE) -C $(top_builddir)/appliance
TESTS = run-bindtests
test_prereq = src_deps all test_images
if ENABLE_APPLIANCE
test_prereq += appliance
TESTS += run-perl-tests
endif
$(TESTS): $(test_prereq)
Build: Build.PL
$(PERL) $(srcdir)/Build.PL --prefix "@prefix@"
TESTS_ENVIRONMENT = $(top_builddir)/run --test
INSTALLDIRS = site
all: Makefile-pl src_deps
$(MAKE) -f Makefile-pl
Makefile-pl: Makefile.PL
-[ $(srcdir) != $(builddir) ] && cp -rsu $(abs_srcdir)/. $(builddir)/.
perl Makefile.PL INSTALLDIRS=$(INSTALLDIRS) PREFIX=$(prefix)
# No! Otherwise it is deleted before the clean-local rule runs.
#CLEANFILES = Makefile-pl
clean-local:
-$(MAKE) -f Makefile-pl clean
rm -f Makefile-pl
install-data-hook:
$(MAKE) -C $(srcdir) -f $(abs_builddir)/Makefile-pl \
DESTDIR=$(DESTDIR) install
TESTS = run-bindtests
if ENABLE_APPLIANCE
TESTS += run-perl-tests
endif
.PHONY: appliance src_deps test_images
# Packagers may override this, eg using 'make install INSTALLDIRS=vendor'
INSTALLDIRS = site
install-data-hook: Build
./Build install --destdir "$(DESTDIR)" --installdirs $(INSTALLDIRS)
endif

View File

@@ -18,4 +18,4 @@
set -e
make -f Makefile-pl test "$@"
./Build test

View File

@@ -278,8 +278,8 @@ p2v/main.c
p2v/miniexpect.c
p2v/ssh.c
p2v/utils.c
perl/Guestfs.c
perl/bindtests.pl
perl/lib/Sys/Guestfs.c
perl/lib/Sys/Guestfs.pm
php/extension/guestfs_php.c
python/guestfs-py-byhand.c