~ubuntu-branches/ubuntu/lucid/libgtk2-mozembed-perl/lucid

« back to all changes in this revision

Viewing changes to Makefile.PL

  • Committer: Bazaar Package Importer
  • Author(s): Ryan Niebur
  • Date: 2009-03-23 10:42:49 UTC
  • Revision ID: james.westby@ubuntu.com-20090323104249-bbxezbl4sitjk954
Tags: upstream-0.08
ImportĀ upstreamĀ versionĀ 0.08

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/usr/bin/perl
 
2
use 5.008;
 
3
use strict;
 
4
use warnings;
 
5
 
 
6
use ExtUtils::MakeMaker;
 
7
use Config;
 
8
use Cwd;
 
9
use File::Spec;
 
10
 
 
11
# $Header: /cvsroot/gtk2-perl/gtk2-perl-xs/Gtk2-MozEmbed/Makefile.PL,v 1.14 2008/08/25 21:30:23 kaffeetisch Exp $
 
12
 
 
13
our %build_reqs = (
 
14
  'perl-ExtUtils-Depends'   => '0.20',
 
15
  'perl-ExtUtils-PkgConfig' => '1.03',
 
16
  'perl-Glib'               => '1.180',
 
17
  'perl-Gtk2'               => '1.081',
 
18
  'perl-Mozilla-DOM'        => '0.01',
 
19
  'Mozilla'                 => '1.7',
 
20
  'Firefox'                 => '1.0',
 
21
  'XULRunner'               => '1.8',
 
22
);
 
23
 
 
24
our %pre_reqs = (
 
25
  'Gtk2'                => $build_reqs{'perl-Gtk2'},
 
26
  'ExtUtils::Depends'   => $build_reqs{'perl-ExtUtils-Depends'},
 
27
  'ExtUtils::PkgConfig' => $build_reqs{'perl-ExtUtils-PkgConfig'},
 
28
);
 
29
 
 
30
unless (eval "use ExtUtils::Depends '$build_reqs{'perl-ExtUtils-Depends'}';"
 
31
           . "use ExtUtils::PkgConfig '$build_reqs{'perl-ExtUtils-PkgConfig'}';"
 
32
           . "use Glib '$build_reqs{'perl-Glib'}';"
 
33
           . "use Gtk2 '$build_reqs{'perl-Gtk2'}';"
 
34
           . "use Glib::MakeHelper;"
 
35
           . "use Gtk2::CodeGen;"
 
36
           . "1") {
 
37
  warn "$@\n";
 
38
  WriteMakefile(
 
39
    PREREQ_FATAL => 1,
 
40
    PREREQ_PM    => \%pre_reqs,
 
41
  );
 
42
  exit 1; # not reached
 
43
}
 
44
 
 
45
# Check if Mozilla::DOM is installed. (could use an ENABLE_DOM option)
 
46
my $use_dom = 1;
 
47
unless (eval "use Mozilla::DOM '$build_reqs{'perl-Mozilla-DOM'}'; 1") {
 
48
  $use_dom = 0;
 
49
}
 
50
 
 
51
my %pkgcfg = ExtUtils::PkgConfig->find(
 
52
        "xulrunner-gtkmozembed >= $build_reqs{'XULRunner'}",
 
53
        "mozilla-gtkmozembed >= $build_reqs{'Mozilla'}",
 
54
        "firefox-gtkmozembed >= $build_reqs{'Firefox'}",
 
55
        "mozilla-firefox-gtkmozembed >= $build_reqs{'Firefox'}");
 
56
 
 
57
mkdir 'build', 0777;
 
58
 
 
59
our @xs_files = <xs/*.xs>;
 
60
our %pod_files = (
 
61
        'MozEmbed.pm' => '$(INST_MAN3DIR)/Gtk2::MozEmbed.$(MAN3EXT)',
 
62
        Glib::MakeHelper->do_pod_files (@xs_files),
 
63
);
 
64
 
 
65
Gtk2::CodeGen->parse_maps('gtkmozembed2perl');
 
66
Gtk2::CodeGen->write_boot(ignore => qr/^Gtk2::MozEmbed$/);
 
67
 
 
68
my ($pkg) = $pkgcfg{pkg} =~ /^(\S+)/;
 
69
print "Compiling against $pkg\n";
 
70
 
 
71
ExtUtils::PkgConfig->write_version_macros (
 
72
  "build/gtkmozembed2perl-version.h",
 
73
  $pkg => "GTK_MOZ_EMBED",
 
74
);
 
75
 
 
76
my $inc = $pkgcfg{cflags};
 
77
my $libs = $pkgcfg{libs};
 
78
 
 
79
if ($libs =~ m#xulrunner-devel-([^/]+)#) {
 
80
        $inc .= qq( -DGTK_MOZ_EMBED_PERL_XULRUNNER_PATH=)
 
81
              . qq("\\"/usr/lib/xulrunner-$1\\"" );
 
82
}
 
83
 
 
84
my $mozembed = ExtUtils::Depends->new('Gtk2::MozEmbed', 'Gtk2',
 
85
                                      ($use_dom ? ('Mozilla::DOM') : ()));
 
86
 
 
87
$mozembed->set_inc($inc);
 
88
$mozembed->set_libs($libs);
 
89
$mozembed->add_xs(@xs_files);
 
90
$mozembed->add_pm('MozEmbed.pm' => '$(INST_LIBDIR)/MozEmbed.pm');
 
91
$mozembed->add_typemaps(map { File::Spec->catfile(cwd(), $_) }
 
92
                          qw(gtkmozembed.typemap
 
93
                             build/gtkmozembed2perl.typemap));
 
94
 
 
95
$mozembed->install(qw(gtkmozembed2perl.h
 
96
                      build/gtkmozembed2perl-autogen.h));
 
97
$mozembed->save_config('build/IFiles.pm');
 
98
 
 
99
my $configure_requires =
 
100
  Glib::MakeHelper->get_configure_requires_yaml(%pre_reqs);
 
101
 
 
102
WriteMakefile(
 
103
  NAME          => 'Gtk2::MozEmbed',
 
104
  VERSION_FROM  => 'MozEmbed.pm',
 
105
  ABSTRACT_FROM => 'MozEmbed.pm',
 
106
  PREREQ_PM     => \%pre_reqs,
 
107
  XSPROTOARG    => '-noprototypes',
 
108
  MAN3PODS      => \%pod_files,
 
109
 
 
110
  ($use_dom ? (CC => 'c++', XSOPT => '-C++') : ()),
 
111
 
 
112
  $mozembed->get_makefile_vars,
 
113
 
 
114
  EXTRA_META => qq/
 
115
$configure_requires
 
116
/,
 
117
);
 
118
 
 
119
sub MY::postamble {
 
120
  return Glib::MakeHelper->postamble_clean ()
 
121
       . Glib::MakeHelper->postamble_docs_full (
 
122
           DEPENDS => $mozembed,
 
123
           COPYRIGHT_FROM => 'copyright.pod');
 
124
}