[gimp-perl] Move build system to using Alien::Gimp, unify typemaps



commit 2c5f6f6afb3d7305e01201b81f26ded25d04fdfb
Author: Ed J <edj src gnome org>
Date:   Mon Dec 15 02:53:14 2014 +0000

    Move build system to using Alien::Gimp, unify typemaps

 Gimp.pm                          |    3 +-
 Gimp/Config.pm.in                |   26 -----------
 Gimp/Makefile.PL                 |   20 +++------
 Makefile.PL                      |   29 +++++--------
 Net/Makefile.PL                  |   11 +++--
 Net/Net.pm                       |    4 +-
 UI/Makefile.PL                   |   17 +++----
 UI/typemap                       |   88 --------------------------------------
 config.pl                        |   42 ------------------
 examples/Makefile.PL             |   11 ++---
 examples/registry_viewer         |    7 ++-
 examples/registry_viewer.threads |    7 ++-
 t/gimpsetup.pl                   |    4 +-
 typemap                          |   84 ++++++++++++++++++++++++++++++++++++
 14 files changed, 134 insertions(+), 219 deletions(-)
---
diff --git a/Gimp.pm b/Gimp.pm
index a34dab0..d041e15 100644
--- a/Gimp.pm
+++ b/Gimp.pm
@@ -1227,5 +1227,4 @@ Ed J (2.3000_01+)
 =head1 SEE ALSO
 
 perl(1), gimp(1), L<Gimp::Fu>, L<Gimp::PixelRgn>, L<Gimp::UI>,
-L<Gimp::Util>, L<Gimp::Data>, L<Gimp::Config>, L<Gimp::Net>, and
-L<Gimp::Lib>.
+L<Gimp::Util>, L<Gimp::Data>, L<Gimp::Net>, and L<Gimp::Lib>.
diff --git a/Gimp/Makefile.PL b/Gimp/Makefile.PL
index 6f76410..b7d6146 100644
--- a/Gimp/Makefile.PL
+++ b/Gimp/Makefile.PL
@@ -1,21 +1,15 @@
+use strict;
+use warnings;
 use ExtUtils::MakeMaker;
-use ExtUtils::Depends;
-require PDL::Core::Dev;
 
-require '../config.pl';
-
-my $pkg = new ExtUtils::Depends Gimp;
-$pkg->set_inc($cfg{GIMP_CFLAGS}.' '.&PDL::Core::Dev::PDL_INCLUDE);
-$pkg->set_libs("$cfg{GIMP_LIBS} $cfg{INTLLIBS}");
-$pkg->add_typemaps("$topdir/typemap", &PDL::Core::Dev::PDL_TYPEMAP);
-$pkg->add_pm(
-  map { ($_ => "\$(INST_LIB)/Gimp/$_") } grep { $_ ne 'IFiles.pm' } glob '*.pm'
-);
+my $pkg = ExtUtils::Depends->new(qw(Gimp Alien::Gimp Gtk2 PDL));
+$pkg->add_typemaps("../typemap");
+$pkg->set_inc('-I.. -Ddatadir=""');
 
 WriteMakefile(
     'NAME'     => 'Gimp::Lib',
-    'VERSION_FROM' => '../Gimp.pm',
-    $pkg->get_makefile_vars,
+    'VERSION_FROM' => 'Lib.pm',
     NO_MYMETA  => 1,
     NO_META    => 1,
+    $pkg->get_makefile_vars,
 );
diff --git a/Makefile.PL b/Makefile.PL
index 244e271..f409842 100644
--- a/Makefile.PL
+++ b/Makefile.PL
@@ -1,11 +1,6 @@
 require 5.008;
 use ExtUtils::Depends;
-use Data::Dumper qw(Dumper);
 use ExtUtils::MakeMaker;
-use IO::All;
-
-our %cfg;
-require './config.pl';
 
 sub MY::postamble {
    my $self=shift;
@@ -27,30 +22,31 @@ setver:
 EOF
 }
 
-my $cfg = io("Gimp/Config.pm.in")->all or die "Gimp/Config.pm.in: $!\n";
-$cfg =~ s/#CFG#/Data::Dumper->Dump([\%cfg], ['*Gimp::Config'])/e;
-io("Gimp/Config.pm")->print($cfg) or die "Gimp/Config.pm: $!\n";
-
-my $pkg = new ExtUtils::Depends Gimp, Gtk2;
-$pkg->set_inc($cfg{GIMP_CFLAGS});
+my $pkg = ExtUtils::Depends->new(qw(Gimp Alien::Gimp Gtk2 PDL));
 $pkg->add_pm(map { ($_ => "\$(INST_LIB)/$_") } qw(Gimp.pm));
+$pkg->add_typemaps("typemap");
 $pkg->save_config('Gimp/IFiles.pm');
 
 WriteMakefile(
+  NAME => 'Gimp',
+  VERSION_FROM => 'Gimp.pm',
   dist => { PREOP => 'make setver && chmod -R u=rwX,go=rX . ;' },
   MIN_PERL_VERSION => '5.014001',
   PREREQ_PM    => {
     Gtk2               => 1.0,
-    PDL                        => 2.0,
+    'PDL'              => '2.007_04',
     Data::Dumper       => 2.0,
     IO::All            => 0,
-    ExtUtils::Depends  => 0,
-    ExtUtils::PkgConfig        => 0,
+    ExtUtils::Depends  => '0.402',
+    'Alien::Gimp'      => '0.01',
     Gtk2::Ex::PodViewer        => 0,
     IO::Scalar         => 0,
     Web::Scraper       => 0,
     HTML::Entities     => 0,
   },
+  TEST_REQUIRES        => {
+    'Test::More'       => '0.88',
+  },
   META_MERGE => {
     "meta-spec" => { version => 2 },
     resources => {
@@ -62,10 +58,7 @@ WriteMakefile(
     },
   },
   DIR  => [ qw/Gimp Net UI examples/ ],
-  NAME => 'Gimp',
-  VERSION_FROM => 'Gimp.pm',
   EXE_FILES => [ map { "utils/$_" } qw(gimpdoc xcftopnm embedxpm scm2perl) ],
-  realclean    => { FILES => "Makefile" },
-  clean        => { FILES => "Makefile.old stamp-h Gimp/Config.pm Gimp/IFiles.pm" },
+  clean        => { FILES => "Gimp/IFiles.pm" },
   $pkg->get_makefile_vars,
 );
diff --git a/Net/Makefile.PL b/Net/Makefile.PL
index a9713dc..df7b7c5 100644
--- a/Net/Makefile.PL
+++ b/Net/Makefile.PL
@@ -1,12 +1,15 @@
+use strict;
+use warnings;
 use ExtUtils::MakeMaker;
 
-require '../config.pl';
+my $pkg = ExtUtils::Depends->new(qw(Gimp Alien::Gimp Gtk2 PDL));
+$pkg->add_typemaps("../typemap");
+$pkg->set_inc('-I.. -Ddatadir=""');
 
 WriteMakefile(
   'NAME' => 'Gimp::Net',
-  'VERSION_FROM' => '../Gimp.pm',
-  'INC' => $cfg{GIMP_CFLAGS},
-  'TYPEMAPS' => ["$topdir/typemap"],
+  'VERSION_FROM' => 'Net.pm',
   NO_MYMETA => 1,
   NO_META => 1,
+  $pkg->get_makefile_vars,
 );
diff --git a/Net/Net.pm b/Net/Net.pm
index d85c448..14d3a14 100644
--- a/Net/Net.pm
+++ b/Net/Net.pm
@@ -105,7 +105,7 @@ sub start_server {
       unless ($server_fh, my $gimp_fh) =
         IO::Socket->socketpair(AF_UNIX, SOCK_STREAM, PF_UNSPEC);
    # do it here so it is done only once
-   require Gimp::Config;
+   require Alien::Gimp;
    $gimp_pid = fork;
    croak __"unable to fork: $!" if $gimp_pid < 0;
    if ($gimp_pid > 0) {
@@ -120,7 +120,7 @@ sub start_server {
      &Gimp::RUN_NONINTERACTIVE,
      fileno($gimp_fh),
      int($Gimp::verbose);
-   my @exec_args = ($Gimp::Config{GIMP}, qw(--no-splash --console-messages));
+   my @exec_args = (Alien::Gimp->gimp, qw(--no-splash --console-messages));
    push @exec_args, "--no-data" if $opt=~s/(^|:)no-?data//;
    push @exec_args, "-i" unless $opt=~s/(^|:)gui//;
    push @exec_args, "--verbose" if $Gimp::verbose >= 2;
diff --git a/UI/Makefile.PL b/UI/Makefile.PL
index 50aacdd..10db671 100644
--- a/UI/Makefile.PL
+++ b/UI/Makefile.PL
@@ -1,18 +1,15 @@
+use strict;
+use warnings;
 use ExtUtils::MakeMaker;
-use ExtUtils::Depends;
 
-require '../config.pl';
-
-my $pkg = new ExtUtils::Depends Gimp, Gtk2;
-$pkg->set_inc($cfg{GIMP_CFLAGS});
-$pkg->set_libs($cfg{GIMP_LIBS});
-$pkg->add_pm('UI.pm' => '$(INST_LIBDIR)/UI.pm');
-$pkg->add_typemaps("$topdir/typemap");
+my $pkg = ExtUtils::Depends->new(qw(Gimp Alien::Gimp Gtk2 PDL));
+$pkg->add_typemaps("../typemap");
+$pkg->set_inc('-I.. -Ddatadir=""');
 
 WriteMakefile(
   'NAME'       => 'Gimp::UI',
-  'VERSION_FROM' => '../Gimp.pm',
-  $pkg->get_makefile_vars,
+  'VERSION_FROM' => 'UI.pm',
   NO_MYMETA    => 1,
   NO_META      => 1,
+  $pkg->get_makefile_vars,
 );
diff --git a/examples/Makefile.PL b/examples/Makefile.PL
index 81aea8a..b2390ed 100644
--- a/examples/Makefile.PL
+++ b/examples/Makefile.PL
@@ -1,11 +1,10 @@
 require 5.008;
 use ExtUtils::MakeMaker;
 use File::Basename;
+use Alien::Gimp;
 use strict;
 use warnings;
 
-require '../config.pl';
-
 # list of standard plugins
 our %cfg;
 my @pins = qw(
@@ -69,11 +68,12 @@ EOF
 undef &MY::postamble; # suppress warning
 *MY::postamble = sub {
    my $self=shift;
-   my $UT = "$cfg{GIMPTOOL} --uninstall-admin-bin";
+   my $UT = Alien::Gimp->gimptool . " --uninstall-admin-bin";
+   my $plugindir = Alien::Gimp->gimpplugindir;
    <<EOF;
 
 INST_PLUGINS = ../blib/plugins
-GIMP_PLUGINS = $cfg{gimpplugindir}
+GIMP_PLUGINS = $plugindir
 
 \$(INST_PLUGINS)\$(DFSEP).exists :: Makefile.PL
        \$(NOECHO) \$(MKPATH) \$(INST_PLUGINS)
@@ -101,8 +101,7 @@ EOF
 WriteMakefile(
     'NAME'     => 'Gimp',
     'VERSION_FROM' => '../Gimp.pm',
-    'clean'    => { FILES => qq(Makefile.old) },
     NO_MYMETA  => 1,
     NO_META    => 1,
-    macro      => { GTINSTALL => "$cfg{GIMPTOOL} --install-admin-bin" },
+    macro      => { GTINSTALL => Alien::Gimp->gimptool . " --install-admin-bin" },
 );
diff --git a/examples/registry_viewer b/examples/registry_viewer
index ea31447..83f47cb 100755
--- a/examples/registry_viewer
+++ b/examples/registry_viewer
@@ -179,7 +179,7 @@ sub do_file {
 }
 
 podregister {
-  require Gimp::Config;
+  require Alien::Gimp;
   require Gtk2::SimpleList;
   require File::Temp;
   require URI;
@@ -281,9 +281,10 @@ podregister {
                sub {
                  my ($file, $dir) = @_;
                  $status->set_text('installing: '.$f->{name}||$f->{desc});
-                 die ("couldn't $Gimp::Config{GIMPTOOL} ",
+                my $tool = Alien::Gimp->gimptool;
+                 die ("couldn't $tool ",
                       "--install-script $file: $!")
-                  unless system ($Gimp::Config{GIMPTOOL},
+                 unless system ($tool,
                                  '--install-script', $file) == 0;
                  $status->set_text('installed, refreshing');
                  Gimp->script_fu_refresh();
diff --git a/examples/registry_viewer.threads b/examples/registry_viewer.threads
index bcc1f51..847f4e4 100755
--- a/examples/registry_viewer.threads
+++ b/examples/registry_viewer.threads
@@ -184,7 +184,7 @@ sub get_file {
 }
 
 podregister {
-  require Gimp::Config;
+  require Alien::Gimp;
   require Gtk2::SimpleList;
   require File::Temp;
   require URI;
@@ -295,9 +295,10 @@ podregister {
                   return unless defined $file; # not happening
                   return 1 unless $stat;       # wait more
                   $status->set_text('installing: '.$f->{name}||$f->{desc});
-                  die ("couldn't $Gimp::Config{GIMPTOOL} ",
+                 my $tool = Alien::Gimp->gimptool;
+                  die ("couldn't $tool ",
                        "--install-script $file: $!")
-                   unless system ($Gimp::Config{GIMPTOOL},
+                  unless system ($tool,
                                   '--install-script', $file) == 0;
                   $status->set_text('installed, refreshing');
                   Gimp->script_fu_refresh();
diff --git a/t/gimpsetup.pl b/t/gimpsetup.pl
index b86840a..8b9516c 100644
--- a/t/gimpsetup.pl
+++ b/t/gimpsetup.pl
@@ -10,11 +10,11 @@ use strict;
 use Config;
 use File::Temp;
 use IO::All;
-require Gimp::Config;
+require Alien::Gimp;
 
 our $DEBUG = 0 unless defined $DEBUG;
 
-my $sysplugins = $Gimp::Config{gimpplugindir};
+my $sysplugins = Alien::Gimp->gimpplugindir;
 die "plugins dir: $!" unless -d $sysplugins;
 die "script-fu not executable: $!" unless -x "$sysplugins/script-fu";
 
diff --git a/typemap b/typemap
index dcf4f6d..570eee9 100644
--- a/typemap
+++ b/typemap
@@ -1,3 +1,5 @@
+TYPEMAP
+
 gchar                                          T_IV
 gint                                           T_IV
 gint32                                         T_IV
@@ -30,6 +32,53 @@ DRAWABLE                                     T_PREF_ANY
 DISPLAY                                                T_PREF
 REGION                                         T_PREF
 
+GimpMemsizeEntry *     GOBJECT
+GimpMemsizeEntry_own * GOBJECT_OWN
+GimpButton *           GOBJECT
+GimpButton_own *       GOBJECT_OWN
+GimpChainButton *      GOBJECT
+GimpChainButton_own *  GOBJECT_OWN
+GimpColorArea *                GOBJECT
+GimpColorArea_own *    GOBJECT_OWN
+GimpColorButton *      GOBJECT
+GimpColorButton_own *  GOBJECT_OWN
+GimpColorDisplay *     GOBJECT
+GimpColorDisplay_own * GOBJECT_OWN
+GimpColorNotebook *    GOBJECT
+GimpColorNotebook_own *        GOBJECT_OWN
+GimpColorScale *       GOBJECT
+GimpColorScale_own *   GOBJECT_OWN
+GimpColorSelect *      GOBJECT
+GimpColorSelect_own *  GOBJECT_OWN
+GimpColorSelector *    GOBJECT
+GimpColorSelector_own *        GOBJECT_OWN
+GimpDialog *           GOBJECT
+GimpDialog_own *       GOBJECT_OWN
+GimpFileEntry  *       GOBJECT
+GimpFileEntry_own *    GOBJECT_OWN
+GimpFontSelectButton * GOBJECT
+GimpFontSelectButton_own *     GOBJECT_OWN
+GimpOffsetArea *       GOBJECT
+GimpOffsetArea_own *   GOBJECT_OWN
+GimpPathEditor *       GOBJECT
+GimpPathEditor_own *   GOBJECT_OWN
+GimpPickButton *       GOBJECT
+GimpPickButton_own *   GOBJECT_OWN
+GimpPixmap *           GOBJECT
+GimpPixmap_own *       GOBJECT_OWN
+GimpSizeEntry *                GOBJECT
+GimpSizeEntry_own *    GOBJECT_OWN
+GimpUnitMenu *         GOBJECT
+GimpUnitMenu_own *     GOBJECT_OWN
+
+GimpRGB                                T_GIMP_RGB
+GimpHSV                                T_GIMP_HSV
+GimpUnit                       T_GIMP_ENUM
+GimpColorAreaType              T_GIMP_ENUM
+GimpChainPosition              T_GIMP_ENUM
+GimpColorSelectorChannel       T_GIMP_ENUM
+GimpSizeEntryUpdatePolicy      T_GIMP_ENUM
+
 INPUT
 
 T_UTF8
@@ -53,6 +102,22 @@ T_PIXELRGN
 T_PIXELRGN_PDL
        $var = old_pixelrgn_pdl ($arg)
 
+GOBJECT
+       $var = ($type) SvGObject ($arg);
+
+T_GIMP_RGB
+       SvGimpRGB ($arg, $var);
+
+T_GIMP_HSV
+       SvGimpHSV ($arg, $var);
+
+T_GIMP_ENUM
+       $var = gperl_convert_enum (${
+          my $t = $ntype;
+          $t =~ s/(?=[A-Z])/_/g;
+          \lc substr $t, 1;
+        }_type (), ($arg));
+
 OUTPUT
 
 T_UTF8
@@ -67,3 +132,22 @@ T_PREF_ANY
 
 T_GDRAWABLE
 
+GOBJECT
+       $arg = newSVGObject (G_OBJECT ($var));
+
+GOBJECT_OWN
+       $arg = newSVGObject_noinc (G_OBJECT ($var));
+
+T_GIMP_ENUM
+       $arg = gperl_convert_back_enum (${
+          my $t = $ntype;
+          $t =~ s/(?=[A-Z])/_/g;
+          \lc substr $t, 1;
+        }_type (), ($var));
+
+T_GIMP_RGB
+       $arg = newSVGimpRGB ($var);
+
+T_GIMP_HSV
+       $arg = newSVGimpHSV ($var);
+


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]