From 67c3c147bc421840c4419e365b1bcbbc39e9b57d Mon Sep 17 00:00:00 2001 From: Emmanuele Bassi Date: Tue, 17 Mar 2009 11:34:20 +0000 Subject: [PATCH] Makefile.PL tweaks Various fixes to the Makefile.PL: - change the dependencies to be conditional - install the champlain-perl.h header file - check dependencies first, then invoke ExtUtils::Depends --- bindings/perl/Champlain/Makefile.PL | 37 +++++++++++++++-------------- 1 file changed, 19 insertions(+), 18 deletions(-) diff --git a/bindings/perl/Champlain/Makefile.PL b/bindings/perl/Champlain/Makefile.PL index e4127b2..7cdf44d 100644 --- a/bindings/perl/Champlain/Makefile.PL +++ b/bindings/perl/Champlain/Makefile.PL @@ -11,72 +11,73 @@ use Glib::MakeHelper; use ExtUtils::Depends; use ExtUtils::PkgConfig; - my $DEPENDS; my @XS_FILES = (); - exit main(); - sub main { # Create the build folder used by the code generation utilities mkdir 'build', 0777; - $DEPENDS = ExtUtils::Depends->new('Champlain', 'Clutter'); - # The version of libchamplain (and friends) for which this module can built against my $champlain_version = '0.3'; - # Find libchamplain my @typemaps = (); + my @deps = qw/ Glib /; my %pkgconfig; + eval { %pkgconfig = ExtUtils::PkgConfig->find("champlain-$champlain_version"); + # All XS files that start with Champlain are for libchamplain + push @XS_FILES, ; + push @typemaps, 'maps'; + push @deps, 'Clutter'; }; if (my $error = $@) { warn "FAIL: ", $error; return; } - # All XS files that start with Champlain are for libchamplain - push @XS_FILES, ; - push @typemaps, 'maps'; - $DEPENDS->add_pm( - File::Spec->catfile('lib', 'Champlain.pm'), - File::Spec->catfile('$(INST_LIBDIR)', 'Champlain.pm'), - ); - - # If libchamplain-gtk is installed the GTK bindings will be generated eval { my %conf = ExtUtils::PkgConfig->find("champlain-gtk-$champlain_version"); - $pkgconfig{cflags} .= $conf{cflags} . '-DCHAMPLAINPERL_GTK'; + $pkgconfig{cflags} .= $conf{cflags} . ' -DCHAMPLAINPERL_GTK'; $pkgconfig{libs} .= $conf{libs}; # All XS files that start with Gtk2Champlain are for libchamplain-gtk push @XS_FILES, ; push @typemaps, 'maps-gtk'; + push @deps, 'Gtk2'; }; if (my $error = $@) { warn "Ignoring the Gtk2 bindings ($error)"; } + $DEPENDS = ExtUtils::Depends->new('Champlain', @deps); + $DEPENDS->add_pm( + File::Spec->catfile('lib', 'Champlain.pm'), + File::Spec->catfile('$(INST_LIBDIR)', 'Champlain.pm'), + ); + # Code generation Gtk2::CodeGen->parse_maps('champlain', input => [ @typemaps ]); Gtk2::CodeGen->write_boot(xs_files => [ @XS_FILES ]); - $DEPENDS->set_inc($pkgconfig{cflags}); + $DEPENDS->set_inc($pkgconfig{cflags} . ' -I./build'); $DEPENDS->set_libs($pkgconfig{libs}); $DEPENDS->add_xs(@XS_FILES); $DEPENDS->add_typemaps( File::Spec->catfile(cwd(), 'build', 'champlain.typemap') ); - $DEPENDS->install(File::Spec->catfile('build', 'champlain-autogen.h')); + $DEPENDS->install( + File::Spec->catfile('build', 'champlain-autogen.h'), + 'champlain-perl.h', + ); $DEPENDS->save_config(File::Spec->catfile('build', 'IFiles.pm')); -- 2.39.5