]> err.no Git - libchamplain/commitdiff
Makefile.PL tweaks
authorEmmanuele Bassi <ebassi@gnome.org>
Tue, 17 Mar 2009 11:34:20 +0000 (11:34 +0000)
committerPierre-Luc Beaudoin <pierre-luc@pierlux.com>
Wed, 25 Mar 2009 08:06:19 +0000 (10:06 +0200)
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

index e4127b24a7145ad265ea2550aa615873af38fcc3..7cdf44d5ca7d07d60512fd08c2ee18eab2374915 100644 (file)
@@ -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, <xs/Champlain*.xs>;
+        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, <xs/Champlain*.xs>;
-       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, <xs/Gtk2Champlain*.xs>;
                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'));