Index: Glib/GenPod.pm =================================================================== RCS file: /cvsroot/gtk2-perl/gtk2-perl-xs/Glib/GenPod.pm,v retrieving revision 1.35 diff -u -r1.35 GenPod.pm --- Glib/GenPod.pm 8 Feb 2004 20:20:45 -0000 1.35 +++ Glib/GenPod.pm 9 Feb 2004 06:23:41 -0000 @@ -4,7 +4,7 @@ package Glib::GenPod; -our $VERSION = '0.01'; +our $VERSION = '0.02'; # FIXME/TODO #use strict; @@ -17,6 +17,7 @@ use base Exporter; our @EXPORT = qw( + add_types xsdoc2pod podify_properties podify_values @@ -363,27 +364,50 @@ FILE => 'file handle', - # there are a little special -- they don't actually get - # registered with the GType system. - GMainContext => 'Glib::MainContext', - GMainLoop => 'Glib::MainLoop', - GParamSpec => 'Glib::ParamSpec', - GParamFlags => 'Glib::ParamFlags', - GPerlFilename => 'localized file name', GPerlFilename_const => 'localized file name', - -## TODO/FIXME: we need a way to add to this hash at runtime, to alleviate -## the need for the terrible hack of putting other people's -## types down here. the trick is figuring out how to get the -## mappings in from the command line (e.g., Makefile rules). -## A file, maybe? - GtkTargetList => 'Gtk2::TargetList', - GdkAtom => 'Gtk2::Gdk::Atom', - GdkBitmap => 'Gtk2::Gdk::Bitmap', - GdkNativeWindow => 'Gtk2::Gdk::NativeWindow', ); +=item add_types (@filenames) + +Parse the given I<@filenames> for entries to add to the C<%basic_types> used +for C type name to Perl package name mappings of types that are not registered +with the Glib type system. The file format is dead simple: blank lines are +ignored; /#.*$/ is stripped from each line as comments; the first token on +each line is considered to be a C type name, and the remaining tokens are the +description of that type. For example, a valid file may look like this: + + # a couple of special types + FooBar Foo::Bar + Frob localized frobnicator + +C type decorations such as "const" and "*" are implied (do not include them), +and the _ornull variant is handled for you. + +=cut +sub add_types { + my @files = @_; + foreach my $f (@files) { + open IN, $f or die "can't open types file $f: $!\n"; + my $n = 0; + while () { + chomp; + s/#.*//; + next if m/^\s*$/; + my ($c_name, @bits) = split; + if (@bits) { + $basic_types{$c_name} = join ' ', @bits; + $n++; + } else { + warn "$f:$.: no description for $c_name\n" + } + } + print "loaded $n extra types from $f\n"; + close IN; + } +} + + =item $string = podify_properties ($packagename) Pretty-print the object properties owned by the Glib::Object derivative Index: Glib/MakeHelper.pm =================================================================== RCS file: /cvsroot/gtk2-perl/gtk2-perl-xs/Glib/MakeHelper.pm,v retrieving revision 1.23 diff -u -r1.23 MakeHelper.pm --- Glib/MakeHelper.pm 27 Jan 2004 15:46:09 -0000 1.23 +++ Glib/MakeHelper.pm 9 Feb 2004 06:23:42 -0000 @@ -130,7 +130,33 @@ sub postamble_docs { shift; # package name - my @xs_files = @_; + my @xs_files = (); + my $docgen_code = ''; + if (UNIVERSAL::isa ($_[0], 'ExtUtils::Depends')) { + warn "got an ExtUtils::Depends...\n"; + my $dep = shift; + @xs_files = @{$dep->{xs}}; + my @doctype_files = @_; + my %deps = $dep->get_deps; + foreach my $d (keys %deps) { + my $f = File::Spec->catfile ($deps{$d}{instpath}, + 'doctypes'); + warn "looking for $f\n"; + push @doctype_files, $f + if -f $f; + } + $docgen_code = "add_types (" + . join(", ",map {"\"$_\""} @doctype_files) + . "); " + if @doctype_files; + warn "".scalar(@doctype_files)." doctype files\n"; + } else { + @xs_files = @_; + } + warn "".scalar(@xs_files)." xs files\n"; + $docgen_code .= + '$(POD_SET) xsdoc2pod("build/doc.pl", "$(INST_LIB)", "build/podindex");'; + warn "docgen_code: $docgen_code\n"; " # BLIB_DONE should be set to something we can depend on that will ensure that @@ -157,7 +183,9 @@ build/podindex :: \$(BLIB_DONE) Makefile build/doc.pl $^X -I \$(INST_LIB) -I \$(INST_ARCHLIB) -MGlib::GenPod -M\$(NAME) \\ - -e \"\$(POD_SET) xsdoc2pod('build/doc.pl', '\$(INST_LIB)', 'build/podindex');\" + -e '$docgen_code' + +####### -e \"\$(POD_SET) xsdoc2pod('build/doc.pl', '\$(INST_LIB)', 'build/podindex');\" \$(INST_LIB)/\$(FULLEXT)/: mkdir -p \$@ Index: Glib/Makefile.PL =================================================================== RCS file: /cvsroot/gtk2-perl/gtk2-perl-xs/Glib/Makefile.PL,v retrieving revision 1.38 diff -u -r1.38 Makefile.PL --- Glib/Makefile.PL 25 Jan 2004 03:06:44 -0000 1.38 +++ Glib/Makefile.PL 9 Feb 2004 06:23:42 -0000 @@ -9,7 +9,7 @@ use File::Spec; use Cwd; -# minimum required version of dependancies we need to build +# minimum required version of dependencies we need to build our %build_reqs = ( 'perl-ExtUtils-Depends' => '0.1', 'perl-ExtUtils-PkgConfig' => '1.00', @@ -96,7 +96,7 @@ ); } -my $glib = ExtUtils::Depends->new ('Glib'); +our $glib = ExtUtils::Depends->new ('Glib'); # add -I. and -I./build to the include path so we can find our own files. # this will be inherited by dependant modules, so they can find their @@ -106,7 +106,7 @@ my $cwd = cwd(); $glib->add_typemaps (map {File::Spec->catfile($cwd,$_)} 'typemap'); $glib->add_headers ('"gperl.h"'); -$glib->install (qw(gperl.h gperl_marshal.h)); +$glib->install (qw(gperl.h gperl_marshal.h doctypes)); $glib->save_config ('build/IFiles.pm'); $glib->add_pm (%pm_files); $glib->add_xs (@xs_files); @@ -156,7 +156,7 @@ " . Glib::MakeHelper->postamble_clean () - . Glib::MakeHelper->postamble_docs (@main::xs_files) + . Glib::MakeHelper->postamble_docs ($main::glib, 'doctypes') . Glib::MakeHelper->postamble_rpms ( 'GLIB' => $build_reqs{'Glib'}, 'PERL_EXTUTILS_DEPENDS' => Index: Gnome2/Makefile.PL =================================================================== RCS file: /cvsroot/gtk2-perl/gtk2-perl-xs/Gnome2/Makefile.PL,v retrieving revision 1.30 diff -u -r1.30 Makefile.PL --- Gnome2/Makefile.PL 25 Jan 2004 03:06:48 -0000 1.30 +++ Gnome2/Makefile.PL 9 Feb 2004 06:23:42 -0000 @@ -9,12 +9,13 @@ use Cwd; use File::Spec; -# minimum required version of dependancies we need to build +# minimum required version of dependencies we need to build our %build_reqs = ( - 'perl-ExtUtils-Depends' => '0.1', - 'perl-ExtUtils-PkgConfig' => '0.1', - 'perl-Glib' => '1.01', + 'perl-ExtUtils-Depends' => '0.200', + 'perl-ExtUtils-PkgConfig' => '0.103', + 'perl-Glib' => '1.02', 'perl-Gtk2' => '1.00', + 'perl-Gnome2-Canvas' => '0.91', 'perl-Gnome2-VFS' => '0.01', 'Gnome' => '2.0.0', 'Bonobo' => '2.0.0', @@ -22,14 +23,15 @@ # Writing a fake Makefile ensures that CPAN will pick up the correct # dependencies and install them. -unless (eval "use ExtUtils::Depends;" - . "use ExtUtils::PkgConfig;" +unless (eval "use ExtUtils::Depends '$build_reqs{'perl-ExtUtils-Depends'}';" + . "use ExtUtils::PkgConfig '$build_reqs{'perl-ExtUtils-PkgConfig'}';" . "use Gtk2::CodeGen;" . "use Glib::MakeHelper;" # for do_pod_files() # just seeing if Glib is available isn't enough, make sure # it's recent enough, too . "use Glib '$build_reqs{'perl-Glib'}';" . "use Gtk2 '$build_reqs{'perl-Gtk2'}';" + . "use Gnome2::Canvas '$build_reqs{'perl-Gnome2-Canvas'}';" . "use Gnome2::VFS '$build_reqs{'perl-Gnome2-VFS'}';" . "1") { warn "$ \n"; @@ -54,12 +56,6 @@ my %libbonoboui_pkgcfg = ExtUtils::PkgConfig->find("libbonoboui-2.0 >= $build_reqs{Bonobo}"); -my %cfgs = ( - libgnome => \%libgnome_pkgcfg, - libgnomeui => \%libgnomeui_pkgcfg, - libbonoboui => \%libbonoboui_pkgcfg, -); - mkdir 'build', 0777; our @xs_files = ; @@ -84,22 +80,12 @@ # # create version guards for the libs that don't provide them. # -open VERSION, ">build/gnome2perl-version.h"; -foreach my $pkg (keys %cfgs) { - my $stem = uc $pkg; - my @modversion = split /\./, $cfgs{$pkg}{modversion}; - print VERSION "#define $stem\_MAJOR_VERSION ($modversion[0])\n"; - print VERSION "#define $stem\_MINOR_VERSION ($modversion[1])\n"; - print VERSION "#define $stem\_MICRO_VERSION ($modversion[2])\n"; - print VERSION - "#define $stem\_CHECK_VERSION(major,minor,micro) \\\n" - . " ($stem\_MAJOR_VERSION > (major) || \\\n" - . " ($stem\_MAJOR_VERSION == (major) && $stem\_MINOR_VERSION > (minor)) || \\\n" - . " ($stem\_MAJOR_VERSION == (major) && $stem\_MINOR_VERSION == (minor) && \\\n" - . " $stem\_MICRO_VERSION >= (micro)))\n" - . "\n"; -} -close VERSION; +ExtUtils::PkgConfig->write_version_macros( + "build/gnome2perl-versions.h", + 'libgnome-2.0' => 'LIBGNOME', + 'libgnomeui-2.0' => 'LIBGNOMEUI', + 'libbonoboui-2.0' => 'LIBBONOBOUI', +); # now we're ready to start creating the makefile. @@ -107,7 +93,7 @@ # the Glib extension, and to save config information for other modules which # will chain from this one. -my $gnome2 = ExtUtils::Depends->new ('Gnome2', 'Gtk2', 'Glib', 'Gnome2::VFS'); +our $gnome2 = ExtUtils::Depends->new ('Gnome2', 'Gnome2::Canvas', 'Gnome2::VFS'); $gnome2->set_inc ($libgnomeui_pkgcfg{cflags} . " " . $libbonoboui_pkgcfg{cflags}); $gnome2->set_libs ($libgnomeui_pkgcfg{libs} . " " . $libbonoboui_pkgcfg{libs}); $gnome2->add_xs (@xs_files); @@ -117,7 +103,8 @@ $gnome2->install (qw(gnome2perl.h build/gnome2perl-autogen.h - build/gnome2perl-version.h)); + build/gnome2perl-versions.h + doctypes)); $gnome2->save_config ('build/IFiles.pm'); WriteMakefile( @@ -129,12 +116,9 @@ $gnome2->get_makefile_vars, ); -package MY; - -sub postamble -{ +sub MY::postamble { return Glib::MakeHelper->postamble_clean () - . Glib::MakeHelper->postamble_docs (@main::xs_files) + . Glib::MakeHelper->postamble_docs ($main::gnome2, 'doctypes') . Glib::MakeHelper->postamble_rpms ( 'GNOME' => $build_reqs{'Gnome'}, 'PERL_EXTUTILS_DEPENDS' => @@ -145,4 +129,3 @@ 'PERL_GTK' => $build_reqs{'perl-Gtk2'}, ); } -package MAIN; Index: Gnome2/gnome2perl.h =================================================================== RCS file: /cvsroot/gtk2-perl/gtk2-perl-xs/Gnome2/gnome2perl.h,v retrieving revision 1.16 diff -u -r1.16 gnome2perl.h --- Gnome2/gnome2perl.h 27 Jan 2004 18:47:22 -0000 1.16 +++ Gnome2/gnome2perl.h 9 Feb 2004 06:23:42 -0000 @@ -31,7 +31,7 @@ #include -#include "gnome2perl-version.h" +#include "gnome2perl-versions.h" #include "gnome2perl-autogen.h" GnomeUIInfo *SvGnomeUIInfo (SV *sv); Index: Gnome2-VFS/Makefile.PL =================================================================== RCS file: /cvsroot/gtk2-perl/gtk2-perl-xs/Gnome2-VFS/Makefile.PL,v retrieving revision 1.15 diff -u -r1.15 Makefile.PL --- Gnome2-VFS/Makefile.PL 25 Jan 2004 03:07:13 -0000 1.15 +++ Gnome2-VFS/Makefile.PL 9 Feb 2004 06:23:42 -0000 @@ -8,9 +8,9 @@ # $Header: /cvsroot/gtk2-perl/gtk2-perl-xs/Gnome2-VFS/Makefile.PL,v 1.15 2004/01/25 03:07:13 rwmcfa1 Exp $ our %build_reqs = ( - 'perl-ExtUtils-Depends' => '0.1', - 'perl-ExtUtils-PkgConfig' => '0.1', - 'perl-Glib' => '1.02', + 'perl-ExtUtils-Depends' => '0.200', + 'perl-ExtUtils-PkgConfig' => '0.103', + 'perl-Glib' => '1.034', 'perl-Gtk2' => '1.02', 'GnomeVFS' => '2.0.0', ); @@ -35,7 +35,6 @@ } my %vfs_pkgcfg = ExtUtils::PkgConfig->find("gnome-vfs-2.0 >= $build_reqs{GnomeVFS}"); -my %cfgs = (vfs => \%vfs_pkgcfg); ############################################################################### @@ -96,22 +95,10 @@ Gtk2::CodeGen->parse_maps ('vfs2perl'); Gtk2::CodeGen->write_boot (ignore => qr/^Gnome2::VFS$/); -open VERSION, ">build/vfs2perl-version.h" or die("Opening '>build/vfs2perl-version.h': $!"); - -foreach my $pkg (keys %cfgs) { - my $stem = uc $pkg; - my @modversion = split /\./, $cfgs{$pkg}{modversion}; - print VERSION "#define $stem\_MAJOR_VERSION ($modversion[0])\n"; - print VERSION "#define $stem\_MINOR_VERSION ($modversion[1])\n"; - print VERSION "#define $stem\_MICRO_VERSION ($modversion[2])\n"; - print VERSION "#define $stem\_CHECK_VERSION(major,minor,micro) \\\n" - . " ($stem\_MAJOR_VERSION > (major) || \\\n" - . " ($stem\_MAJOR_VERSION == (major) && $stem\_MINOR_VERSION > (minor)) || \\\n" - . " ($stem\_MAJOR_VERSION == (major) && $stem\_MINOR_VERSION == (minor) && \\\n" - . " $stem\_MICRO_VERSION >= (micro)))\n"; -} - -close VERSION; +ExtUtils::PkgConfig->write_version_macros ( + "build/vfs2perl-version.h", + "gnome-vfs-2.0" => 'VFS', +); ############################################################################### @@ -128,7 +115,8 @@ $vfs->install (qw(vfs2perl.h build/vfs2perl-autogen.h build/vfs2perl-version.h - build/vfs2perl-gtypes.h)); + build/vfs2perl-gtypes.h + doctypes)); $vfs->save_config ('build/IFiles.pm'); WriteMakefile( @@ -142,11 +130,9 @@ ############################################################################### -package MY; - -sub postamble { +sub MY::postamble { return Glib::MakeHelper->postamble_clean () - . Glib::MakeHelper->postamble_docs (@main::xs_files) + . Glib::MakeHelper->postamble_docs ($vfs, 'doctypes') . Glib::MakeHelper->postamble_rpms ( 'GNOME_VFS' => $build_reqs{'GnomeVFS'}, 'PERL_EXTUTILS_DEPENDS' => @@ -158,4 +144,3 @@ ); } -package MAIN; Index: GnomeCanvas/Makefile.PL =================================================================== RCS file: /cvsroot/gtk2-perl/gtk2-perl-xs/GnomeCanvas/Makefile.PL,v retrieving revision 1.23 diff -u -r1.23 Makefile.PL --- GnomeCanvas/Makefile.PL 25 Jan 2004 03:07:23 -0000 1.23 +++ GnomeCanvas/Makefile.PL 9 Feb 2004 06:23:43 -0000 @@ -8,11 +8,11 @@ use Cwd; use File::Spec; -# minimum required version of dependancies we need to build +# minimum required version of dependencies we need to build our %build_reqs = ( - 'perl-ExtUtils-Depends' => '0.1', + 'perl-ExtUtils-Depends' => '0.200', 'perl-ExtUtils-PkgConfig' => '0.1', - 'perl-Glib' => '1.020', # we need Glib::MakeHelper + 'perl-Glib' => '1.034', 'perl-Gtk2' => '1.00', 'GnomeCanvas' => '2.0.0', ); @@ -66,17 +66,17 @@ # the Glib extension, and to save config information for other modules which # will chain from this one. -my $gnome2 = ExtUtils::Depends->new ('Gnome2::Canvas', 'Gtk2', 'Glib'); -$gnome2->set_inc ($pkgcfg{cflags}); -$gnome2->set_libs ($pkgcfg{libs}); -$gnome2->add_xs (); -$gnome2->add_pm ('Canvas.pm' => '$(INST_LIBDIR)/Canvas.pm'); +my $gnomecanvas = ExtUtils::Depends->new ('Gnome2::Canvas', 'Gtk2'); +$gnomecanvas->set_inc ($pkgcfg{cflags}); +$gnomecanvas->set_libs ($pkgcfg{libs}); +$gnomecanvas->add_xs (@xs_files); +$gnomecanvas->add_pm ('Canvas.pm' => '$(INST_LIBDIR)/Canvas.pm'); my $cwd = cwd(); -$gnome2->add_typemaps (map {File::Spec->catfile($cwd,$_)} 'canvas.typemap', 'build/gnomecanvasperl.typemap'); -$gnome2->add_headers ('gnomecanvasperl.h'); +$gnomecanvas->add_typemaps (map {File::Spec->catfile($cwd,$_)} 'canvas.typemap', 'build/gnomecanvasperl.typemap'); +$gnomecanvas->add_headers ('gnomecanvasperl.h'); -$gnome2->install (qw(gnomecanvasperl.h build/gnomecanvasperl-autogen.h)); -$gnome2->save_config ('build/IFiles.pm'); +$gnomecanvas->install (qw(gnomecanvasperl.h build/gnomecanvasperl-autogen.h)); +$gnomecanvas->save_config ('build/IFiles.pm'); WriteMakefile( NAME => 'Gnome2::Canvas', @@ -84,16 +84,14 @@ ABSTRACT => 'Perl bindings for the 2.x series of the Gnome Canvas widget', XSPROTOARG => '-noprototypes', MAN3PODS => \%pod_files, - $gnome2->get_makefile_vars, + $gnomecanvas->get_makefile_vars, ); -package MY; -sub postamble -{ +sub MY::postamble { chomp (my $date = `date +"%a %b %d %Y"`); return Glib::MakeHelper->postamble_clean () - . Glib::MakeHelper->postamble_docs (@main::xs_files) + . Glib::MakeHelper->postamble_docs ($gnomecanvas) . Glib::MakeHelper->postamble_rpms ( 'GNOME_CANVAS' => $build_reqs{'GnomeCanvas'}, 'PERL_EXTUTILS_DEPENDS' => @@ -102,7 +100,6 @@ $build_reqs{'perl-ExtUtils-PkgConfig'}, 'PERL_GLIB' => $build_reqs{'perl-Glib'}, 'PERL_GTK' => $build_reqs{'perl-Gtk2'}, - ($Glib::VERSION > 1.020 ? () : (DATE => $date)) + 'DATE' => $date, ); } -package MAIN; Index: Gtk2/Makefile.PL =================================================================== RCS file: /cvsroot/gtk2-perl/gtk2-perl-xs/Gtk2/Makefile.PL,v retrieving revision 1.75 diff -u -r1.75 Makefile.PL --- Gtk2/Makefile.PL 8 Feb 2004 01:49:41 -0000 1.75 +++ Gtk2/Makefile.PL 9 Feb 2004 06:23:43 -0000 @@ -28,7 +28,7 @@ use File::Spec; use Cwd; -# minimum required version of dependancies we need to build +# minimum required version of dependencies we need to build our %build_reqs = ( 'perl-ExtUtils-Depends' => '0.1', 'perl-ExtUtils-PkgConfig' => '1.03', @@ -179,7 +179,7 @@ # will chain from this one. # -my $gtk2 = ExtUtils::Depends->new ('Gtk2', 'Glib'); +our $gtk2 = ExtUtils::Depends->new ('Gtk2', 'Glib'); # Glib added -I. for us, but we'll need to add -I./build so we can get to # the autogenerated files. we do this kindof as a public service to client # modules, as these will carry through via the depends mechanism. @@ -194,7 +194,10 @@ ); $gtk2->add_headers ('gtk2perl.h'); -$gtk2->install (qw(gtk2perl.h build/gtk2perl-autogen.h build/gtk2perl-versions.h)); +$gtk2->install (qw(gtk2perl.h + build/gtk2perl-autogen.h + build/gtk2perl-versions.h + doctypes)); $gtk2->save_config ('build/IFiles.pm'); # exports list needed for win32, unused on others @@ -232,7 +235,7 @@ { my $text = "POD_DEPENDS=build/stock_items.podi\n\n" . Glib::MakeHelper->postamble_clean () - . Glib::MakeHelper->postamble_docs (@xs_files) + . Glib::MakeHelper->postamble_docs ($gtk2, 'doctypes') . Glib::MakeHelper->postamble_rpms ( 'GTK' => $build_reqs{'Gtk+'}, 'PERL_EXTUTILS_DEPENDS' =>