1#
2# $Id$
3#
4
5use 5.008;
6use ExtUtils::MakeMaker;
7use Cwd;
8use File::Spec;
9
10# minimum required version of dependancies we need to build
11our %build_reqs = (
12	'perl-ExtUtils-Depends'   => '0.1',
13	'perl-ExtUtils-PkgConfig' => '0.1',
14	'perl-Glib'               => '1.24',
15	'perl-Gtk2'               => '1.00',
16	'GtkSpell'                => '2.0.0',
17);
18
19# Writing a fake Makefile ensures that CPAN will pick up the correct
20# dependencies and install them.
21unless (eval "use ExtUtils::Depends;"
22           . "use ExtUtils::PkgConfig;"
23	   . "use Glib::MakeHelper;"
24	   . "use Gtk2::CodeGen;"
25           # just seeing if Glib is available isn't enough, make sure
26           # it's recent enough, too
27           . "use Glib '$build_reqs{'perl-Glib'}';"
28           . "use Gtk2 '$build_reqs{'perl-Gtk2'}';"
29           . "1") {
30   warn "$@\n";
31   WriteMakefile(
32         PREREQ_FATAL => 1,
33         PREREQ_PM    => {
34            'Glib'                => $build_reqs{'perl-Glib'},
35            'Gtk2'                => $build_reqs{'perl-Gtk2'},
36            'ExtUtils::Depends'   => $build_reqs{'perl-ExtUtils-Depends'},
37            'ExtUtils::PkgConfig' => $build_reqs{'perl-ExtUtils-PkgConfig'},
38         },
39   );
40   exit 1; # not reached
41}
42
43my %pkgcfg = ExtUtils::PkgConfig->find('gtkspell-2.0 >= '
44				       .$build_reqs{GtkSpell});
45
46mkdir 'build', 0777;
47
48# now we're ready to start creating the makefile.
49# we need to use ExtUtils::Depends to get relevant information out of
50# the Glib extension, and to save config information for other modules which
51# will chain from this one.
52
53$gtk2spell = ExtUtils::Depends->new ('GtkSpell', 'Gtk2', 'Glib');
54$gtk2spell->set_inc ($pkgcfg{cflags});
55$gtk2spell->set_libs ($pkgcfg{libs});
56$gtk2spell->add_pm ('lib/Gtk2/Spell.pm' => '$(INST_LIBDIR)/Spell.pm');
57$gtk2spell->add_xs ('GtkSpell.xs');
58my $cwd = cwd();
59$gtk2spell->add_typemaps (map {File::Spec->catfile($cwd,$_)} 'gtkspell.typemap' );
60
61$gtk2spell->install ('gtk2spellperl.h');
62$gtk2spell->save_config ('build/IFiles.pm');
63
64WriteMakefile(
65    NAME          => 'Gtk2::Spell',
66    VERSION_FROM  => 'lib/Gtk2/Spell.pm',
67    PREREQ_PM     => {},
68    ABSTRACT_FROM => 'lib/Gtk2/Spell.pm',
69    XSPROTOARG    => '-noprototypes',
70    $gtk2spell->get_makefile_vars,
71);
72
73use Cwd;
74
75sub MY::postamble
76{
77	return Glib::MakeHelper->postamble_clean ()
78	     . Glib::MakeHelper->postamble_docs (@main::xs_files)
79	     . Glib::MakeHelper->postamble_rpms (
80		'GTKSPELL' => $build_reqs{'GtkSpell'},
81		'PERL_EXTUTILS_DEPENDS' =>
82			$build_reqs{'perl-ExtUtils-Depends'},
83		'PERL_EXTUTILS_PKGCONFIG' =>
84			$build_reqs{'perl-ExtUtils-PkgConfig'},
85		'PERL_GLIB' => $build_reqs{'perl-Glib'},
86		'PERL_GTK' => $build_reqs{'perl-Gtk2'},
87	       );
88}
89
90__END__
91Copyright (C) 2003 by the gtk2-perl team (see the file AUTHORS for the
92full list)
93
94This library is free software; you can redistribute it and/or modify it under
95the terms of the GNU Library General Public License as published by the Free
96Software Foundation; either version 2.1 of the License, or (at your option) any
97later version.
98
99This library is distributed in the hope that it will be useful, but WITHOUT ANY
100WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
101PARTICULAR PURPOSE.  See the GNU Library General Public License for more
102details.
103
104You should have received a copy of the GNU Library General Public License along
105with this library; if not, write to the Free Software Foundation, Inc., 59
106Temple Place - Suite 330, Boston, MA  02111-1307  USA.
107