[gimp-perl] Tidy build files. Bug 727126



commit 5c239895a9c1ed4e491c1d7f84451da09e3848ef
Author: Ed J <m8r-35s8eo mailinator com>
Date:   Mon Mar 31 07:52:30 2014 +0100

    Tidy build files. Bug 727126

 Gimp/Config.pm.in    |   24 ++------
 Gimp/Feature.pm      |    2 +-
 Gimp/Makefile.PL     |   33 +++-------
 Gimp/Util.pm         |   14 +----
 MANIFEST             |   68 ++++++++++++---------
 Makefile.PL          |  155 +++++++++++++----------------------------------
 Net/Makefile.PL      |   18 ++----
 UI/Makefile.PL       |   32 ++++-------
 config.pl            |  164 +++++++++----------------------------------------
 examples/Makefile.PL |  117 +++++++++++------------------------
 t/perlplugin.t       |    7 +-
 11 files changed, 188 insertions(+), 446 deletions(-)
---
diff --git a/Gimp/Config.pm.in b/Gimp/Config.pm.in
index 17b72e3..da999c9 100644
--- a/Gimp/Config.pm.in
+++ b/Gimp/Config.pm.in
@@ -8,15 +8,14 @@ package Gimp::Config;
 
 =head1 DESCRIPTION
 
-The Gimp::Config module creates a tied hash %Gimp::Config which contains
-all the definitions the configure script and perl deduced from the system
-configuration at configure time. You can access these values just like you
-access any other values, i.e.  C<$Gimp::Config{KEY}>. Some important keys are:
+The Gimp::Config module creates a hash %Gimp::Config which contains
+all the definitions found by the configuration process.  You can
+access these values just like you access any other values, i.e.
+C<$Gimp::Config{KEY}>. Some important keys are:
 
   IN_GIMP      => true when gimp-perl was part of the Gimp distribution.
   GIMP         => the path of the gimp executable
   prefix       => the installation prefix
-  libdir       => the gimp systemwide libdir
   bindir       => paths where gimp binaries are installed
   gimpplugindir        => the gimp plug-in directory (without the /plug-ins-suffix)
 
@@ -26,20 +25,7 @@ L<Gimp>.
 
 =cut
 
-sub TIEHASH {
-   my $pkg = shift;
-   my $self;
-
-   bless \$self, $pkg;
-}
-
-sub FETCH {
-   $cfg{$_[1]};
-}
-
-tie %Gimp::Config, 'Gimp::Config';
-
-%cfg = (
+%Gimp::Config = (
 #CFG#);
 
 1;
diff --git a/Gimp/Feature.pm b/Gimp/Feature.pm
index 9fd4e2b..bcd1cf0 100644
--- a/Gimp/Feature.pm
+++ b/Gimp/Feature.pm
@@ -82,7 +82,7 @@ sub present {
    } elsif ($_ eq "perl-5.6") {
       $] >= 5.006;
    } elsif ($_ eq "pdl") {
-      require Gimp::Config; $Gimp::Config{DEFINE1} =~ /HAVE_PDL/;
+      require Gimp::Config; $Gimp::Config{GIMP_CFLAGS} =~ /HAVE_PDL/;
    } elsif ($_ eq "gnome") {
       eval { require Gnome }; $@ eq "";
    } elsif ($_ eq "gtkxmhtml") {
diff --git a/Gimp/Makefile.PL b/Gimp/Makefile.PL
index 6bdf555..aea2c6d 100644
--- a/Gimp/Makefile.PL
+++ b/Gimp/Makefile.PL
@@ -1,33 +1,18 @@
 use ExtUtils::MakeMaker;
+use ExtUtils::Depends;
 
 do '../config.pl';
 
-sub MY::const_config {
-   my $self = shift;
-   $self->{LDLOADLIBS}="$GIMP_LIBS_NOUI $self->{LDLOADLIBS} $LIBS $INTLLIBS";
-   package MY;
-   $self->SUPER::const_config(@_);
-}
-
-sub MY::const_loadlibs {
-   my $self = shift;
-   if ($IN_GIMP) {
-      $self->{LD_RUN_PATH} = join (":",
-         $libdir,
-         split /:/,$self->{LD_RUN_PATH}
-      );
-   }
-   package MY;
-   $self->SUPER::const_loadlibs(@_);
-}
-
-$GIMP_INC_NOUI = "-I../../.. $GIMP_INC_NOUI" if $IN_GIMP;
+my $pkg = new ExtUtils::Depends Gimp;
+$pkg->set_inc($cfg{GIMP_CFLAGS});
+$pkg->set_libs("$cfg{GIMP_LIBS} $cfg{INTLLIBS}");
+$pkg->add_typemaps("$topdir/typemap", @{$cfg{pdl_typemaps}});
+$pkg->add_pm(map { ($_ => "\$(INST_LIB)/Gimp/$_") } glob '*.pm');
 
 WriteMakefile(
     'NAME'     => 'Gimp::Lib',
     'VERSION_FROM' => '../Gimp.pm',
-    'INC'      => "$INC1 $GIMP_INC_NOUI $CPPFLAGS $pdl_inc $CFLAGS",
-    'DEFINE'   => "$DEFINE1 $DEFS",
-    'macro'    => { libdir => $libdir, exec_prefix => $exec_prefix, prefix => $prefix },
-    'TYPEMAPS' => ["$topdir/typemap",@pdl_typemaps],
+    $pkg->get_makefile_vars,
+    NO_MYMETA  => 1,
+    NO_META    => 1,
 );
diff --git a/Gimp/Util.pm b/Gimp/Util.pm
index d1ca2c2..09d4c54 100644
--- a/Gimp/Util.pm
+++ b/Gimp/Util.pm
@@ -49,7 +49,8 @@ require      Exporter;
                );
 # EXPORT_OK = qw();
 
-use Gimp;
+import Gimp;
+sub __ ($);
 
 $VERSION = 2.3001;
 
@@ -141,17 +142,6 @@ sub text_draw {
   # Do the fun stuff with the text.
   Gimp->layer_set_preserve_trans($text_layer, FALSE);
 
-  if ($resize == 0)
-    {
-    # Now figure out the size of $image
-    $width = Gimp->image_width($text_layer);
-    $height = Gimp->image_height($text_layer);
-    # and cut text layer
-    }
-  else
-    {
-    }
-
   # add text to image
   Gimp->image_add_layer($image, $text_layer, $pos);
   # merge white and text
diff --git a/MANIFEST b/MANIFEST
index 75d8f8e..a8c7bea 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -1,10 +1,43 @@
 AUTHORS
 ChangeLog
 Changes
-config.pl
 COPYING
 COPYING.Artistic
 COPYING.GNU
+Makefile.PL
+MAINTAINERS
+MANIFEST
+MYMETA.json
+MYMETA.yml
+NEWS
+README
+README.win32
+TODO
+Gimp/ColorDB.pm
+Gimp/Config.pm.in
+Gimp/Constant.pm
+Gimp/Data.pm
+Gimp/Feature.pm
+Gimp/Fu.pm
+Gimp/Lib.pm
+Gimp/Lib.xs
+Gimp/Makefile.PL
+Gimp/OO.pod
+Gimp/Pixel.pod
+Gimp/Pod.pm
+Gimp/Util.pm
+Gimp.pm
+Gimp.xs
+Net/Makefile.PL
+Net/Net.pm
+Net/Net.xs
+UI/Makefile.PL
+UI/typemap
+UI/UI.pm
+UI/UI.xs
+config.pl
+examples/Makefile.PL
+examples/Perl-Server
 examples/animate_cells
 examples/billboard
 examples/blended2
@@ -67,29 +100,8 @@ examples/yinyang
 extra.c
 extra.h
 gppport.h
-Gimp/Config.pm.in
-Gimp/Data.pm
-Gimp/Feature.pm
-Gimp/Fu.pm
-Gimp/Lib.pm
-Gimp/Lib.xs
-Gimp/Makefile.PL
-Gimp/OO.pod
-Gimp/Pixel.pod
-Gimp/Pod.pm
-Gimp/Util.pm
-Gimp.pm
-Gimp.xs
 logo.xpm
-MAINTAINERS
-Makefile.PL
-MANIFEST
-Net/Makefile.PL
-Net/Net.pm
-Net/Net.xs
-NEWS
 perl-intl.h
-Perl-Server
 po/ca.po
 po/ChangeLog
 po/cs.po
@@ -129,19 +141,17 @@ po/vi.po
 po/zh_CN.po
 po/zh_TW.po
 pxgettext
-README
-README.win32
+t/import.t
+t/perlplugin.t
 t/loadlib.t
 t/load.t
-TODO
 t/run.t
+t/supplied.t
 typemap
 typemap.pdl
-UI/Makefile.PL
-UI/typemap
-UI/UI.pm
-UI/UI.xs
 utils/embedxpm
 utils/gimpdoc
 utils/scm2perl
 utils/xcftopnm
+utils/find-deprecated-procs.pl
+utils/list-pdb-deprecations.pl
diff --git a/Makefile.PL b/Makefile.PL
index e400862..335b664 100644
--- a/Makefile.PL
+++ b/Makefile.PL
@@ -1,73 +1,19 @@
 require 5.008;
-
-$|=1;
-
-# run the config.pl to setup environment
-do './config.pl' or die $@;
-
-# GTK isn't absolutely required, but for most people it is highly
-# desirable, so make a nice big notice saying so.
-
-eval "use Gtk2;"; $GTK = $@ eq "";
-$GTK or print <<EOF;
-
-NOTICE:  unable to use the Perl-Gtk2 interface. Many features (like
-         Gimp::Fu) rely on this extension. You can build without it (and
-         many scripts will be disabled or run with reduced functionality
-         only), but it's better to install it.  If you do install it,
-        version 1.0 or higher is required; you can get it from
-        http://gtk2-perl.sourceforge.net/ or any CPAN mirror.
-
-EOF
-
+use ExtUtils::Depends;
+use Data::Dumper qw(Dumper);
 use ExtUtils::MakeMaker;
+use IO::All;
 
-sub MY::install {
-   my $self=shift;
-   package MY;
-   my $install = $self->SUPER::install(@_);
-   <<'EOF' . $install;
-install :: install-writable
-
-install-writable ::
-       @for dir in \
-          $(INSTALLPRIVLIB) \
-          $(INSTALLARCHLIB) \
-          $(INSTALLBIN) \
-          $(INSTALLSCRIPT) \
-          $(INSTALLMAN1DIR) \
-          $(INSTALLMAN3DIR) ; \
-       do \
-          $(MKPATH) "$$dir"; \
-          if test -d "$$dir" && test -w "$$dir" ; then : ; else \
-             echo "ERROR: installation directory $$dir" ; \
-             echo "       is not writable, not installing gimp-perl" ; \
-             exit 1 ; \
-          fi ; \
-       done ;
-
-install-po:
-       cd po && \$(MAKE) install
-
-EOF
-}
+require 'config.pl';
 
 sub MY::postamble {
    my $self=shift;
-   my $GT = "$GIMPTOOL --install-admin-bin";
-   my $UT = "$GIMPTOOL --uninstall-admin-bin";
    <<EOF;
+install-po:
+       cd po && \$(MAKE) install
 
-objclean :: clean
-maintainer-clean :: realclean
-distclean :: realclean
-check :: test
-
-force_uninstall_from_perldirs ::
-       \$(PERL) -MExtUtils::Install -e 'uninstall(\$\$ARGV[0],1,0)' 
@{[$self->catfile('$(PERL_ARCHLIB)','auto','$(FULLEXT)','.packlist')]}
-
-force_uninstall_from_sitedirs ::
-       \$(PERL) -MExtUtils::Install -e 'uninstall(\$\$ARGV[0],1,0)' 
@{[$self->catfile('$(SITEARCHEXP)','auto','$(FULLEXT)','.packlist')]}
+install ::
+       cd examples && \$(MAKE) install
 
 # generate tags file
 tags: .
@@ -81,57 +27,44 @@ EOF
 }
 
 print "writing Gimp/Config.pm... ";
-{
-   sub conf_eval {
-      my $v = expand($cfg{$_[0]});
-      $v =~ s/([\\\]])/\\$1/g;
-      $v;
-   }
-   local $/,*FH;
-   open FH,"<Gimp/Config.pm.in" or die "Gimp/Config.pm.in: $!\n";
-   my $cfg = <FH>;
-   $cfg =~ s/#CFG#/join "",
-                        map sprintf("   %-20s => q[%s],\n",$_,conf_eval $_),
-                            keys %cfg/e;
-   open FH,">Gimp/Config.pm" or die "Gimp/Config.pm: $!\n";
-   print(FH $cfg)>0 or die "Gimp/Config.pm: $!\n";
-}
+my $cfg = io("Gimp/Config.pm.in")->all or die "Gimp/Config.pm.in: $!\n";
+$Data::Dumper::Terse = 1; $Data::Dumper::Indent = 0;
+$cfg =~ s/#CFG#/join "", map { "  $_ => ".Dumper($cfg{$_}).",\n" } keys %cfg/e;
+io("Gimp/Config.pm")->print($cfg) or die "Gimp/Config.pm: $!\n";
 print "ok\n";
 
- EXE_FILES = qw(utils/gimpdoc utils/xcftopnm utils/embedxpm);
-push @EXE_FILES, qw(utils/scm2perl) if $PRD;
+my $pkg = new ExtUtils::Depends Gimp, Gtk2;
+$pkg->set_inc($cfg{GIMP_CFLAGS});
+$pkg->add_pm(map { ($_ => "\$(INST_LIB)/$_") } qw(Gimp.pm));
 
 WriteMakefile(
-    'dist'     => {
-                   PREOP       => 'make setver && chmod -R u=rwX,go=rX . ;',
-                   COMPRESS    => 'gzip -9v',
-                   SUFFIX      => '.gz',
-                  },
-    'PREREQ_PM'        => {
-                   Gtk2                => 1.0,
-                   PDL                 => 0,
-                   Data::Dumper        => 2.0,
-                   IO::All             => 0,
-                  },
-    META_MERGE => {
-                   "meta-spec" => { version => 2 },
-                   resources => {
-                     repository => {
-                       type => 'git',
-                       url => 'git://git.gnome.org/gimp-perl',
-                       web => 'https://git.gnome.org/browse/gimp-perl/',
-                     },
-                   },
-                 },
-    'DIR'      => [ qw/Gimp Net UI examples/ ],
-    'NAME'     => 'Gimp',
-    'VERSION_FROM' => 'Gimp.pm',
-    'INSTALLBIN'=> $bindir,
-    'LDFROM'   => expand("\$(OBJECT) $LIBS $INTLLIBS"),
-    'INC'      => "$INC1 $GIMP_INC_NOUI $GTK_CFLAGS $CPPFLAGS $CFLAGS",
-    'DEFINE'   => "$DEFINE1 $DEFS",
-    'EXE_FILES'        => \ EXE_FILES,
-    'macro'    => \%cfg,
-    'realclean'        => { FILES => "config.status config.cache config.log config.h Gimp/Config.pm 
Makefile" },
-    'clean'    => { FILES => "Makefile.old stamp-h Gimp/Config.pm" },
+  'dist'       => {
+    PREOP      => 'make setver && chmod -R u=rwX,go=rX . ;',
+    COMPRESS   => 'gzip -9v',
+    SUFFIX     => '.gz',
+  },
+  'PREREQ_PM'  => {
+    Gtk2               => 1.0,
+    PDL                        => 2.0,
+    Data::Dumper       => 2.0,
+    IO::All            => 0,
+    ExtUtils::Depends  => 0,
+  },
+  META_MERGE => {
+    "meta-spec" => { version => 2 },
+    resources => {
+      repository => {
+       type => 'git',
+       url => 'git://git.gnome.org/gimp-perl',
+       web => 'https://git.gnome.org/browse/gimp-perl/',
+      },
+    },
+  },
+  '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" },
+  $pkg->get_makefile_vars,
 );
diff --git a/Net/Makefile.PL b/Net/Makefile.PL
index f7a6e2a..a9713dc 100644
--- a/Net/Makefile.PL
+++ b/Net/Makefile.PL
@@ -1,16 +1,12 @@
 use ExtUtils::MakeMaker;
 
-do '../config.pl';
-
-$GIMP_INC_NOUI = "-I../../.. $GIMP_INC_NOUI" if $IN_GIMP;
+require '../config.pl';
 
 WriteMakefile(
-    'NAME'     => 'Gimp::Net',
-    'VERSION_FROM' => '../Gimp.pm',
-    #'INC'     => "$INC1 $CPPFLAGS $pdl_inc $cfg{GLIB_CFLAGS} $CFLAGS",
-    'INC'      => "$INC1 $CPPFLAGS $pdl_inc $CFLAGS",
-    'DEFINE'   => "$DEFINE1 $DEFS",
-    'TYPEMAPS' => ["$topdir/typemap",@pdl_typemaps],
-    #dynamic_lib       => { OTHERLDFLAGS => "$LDFLAGS $LIBS $cfg{GLIB_LIBS}" },
-    dynamic_lib        => { OTHERLDFLAGS => "$LDFLAGS $LIBS" },
+  'NAME' => 'Gimp::Net',
+  'VERSION_FROM' => '../Gimp.pm',
+  'INC' => $cfg{GIMP_CFLAGS},
+  'TYPEMAPS' => ["$topdir/typemap"],
+  NO_MYMETA => 1,
+  NO_META => 1,
 );
diff --git a/UI/Makefile.PL b/UI/Makefile.PL
index 8b04579..67df816 100644
--- a/UI/Makefile.PL
+++ b/UI/Makefile.PL
@@ -1,28 +1,18 @@
 use ExtUtils::MakeMaker;
 use ExtUtils::Depends;
 
-do '../config.pl';
+require '../config.pl';
 
-my $pkg = new ExtUtils::Depends Gimp, Glib, Gtk2;
-
-sub MY::const_loadlibs {
-   my $self = shift;
-   $self->{LD_RUN_PATH} = "$libdir:$self->{LD_RUN_PATH}" if $IN_GIMP;
-   package MY;
-   $self->SUPER::const_loadlibs(@_);
-}
-
-$GIMP_INC = "-I../../.. $GIMP_INC" if $IN_GIMP;
-
-# change add_define to add them in here instead
-$pkg->set_inc ("$DEFINE1 $DEFS $INC1 $GIMP_INC $CPPFLAGS $pdl_inc $CFLAGS");
-$pkg->set_libs ($GIMP_LIBS);
-$pkg->add_pm ('UI.pm' => '$(INST_LIBDIR)/UI.pm');
-$pkg->add_typemaps ("$topdir/typemap", @pdl_typemaps);
+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", @pdl_typemaps);
 
 WriteMakefile(
-    'NAME'     => 'Gimp::UI',
-    'VERSION_FROM' => '../Gimp.pm',
-    'macro'    => { libdir => $libdir, exec_prefix => $exec_prefix, prefix => $prefix },
-    $pkg->get_makefile_vars,
+  'NAME'       => 'Gimp::UI',
+  'VERSION_FROM' => '../Gimp.pm',
+  $pkg->get_makefile_vars,
+  NO_MYMETA    => 1,
+  NO_META      => 1,
 );
diff --git a/config.pl b/config.pl
index 35d1c77..8943582 100644
--- a/config.pl
+++ b/config.pl
@@ -1,153 +1,49 @@
-# this is ugly, but it makes Gimp installable from within CPAN
-
 use Cwd 'abs_path';
+use ExtUtils::PkgConfig;
 
 # make $topdir be where the gimp-perl sources start
 $topdir = ".";
 $topdir .= "/.." while ! -f "$topdir/MANIFEST";
 $topdir = abs_path $topdir;
 
-use ExtUtils::PkgConfig;
-%gimpcfg = ExtUtils::PkgConfig->find("gimp-2.0");
-%gtkcfg  = ExtUtils::PkgConfig->find("gtk+-2.0");
-%glibcfg = ExtUtils::PkgConfig->find("glib-2.0");
-
-$^W=0;
-
-# pull in the libs/includes/etc from gimp and glib
-$gimppath = ExtUtils::PkgConfig->variable("gimp-2.0", "exec_prefix") . "/bin/";
-$gimplibdir = ExtUtils::PkgConfig->variable("gimp-2.0", "gimplibdir");
+my %gimpcfg = ExtUtils::PkgConfig->find("gimp-2.0");
+my $gimppath = ExtUtils::PkgConfig->variable("gimp-2.0", "exec_prefix")."/bin/";
+my $gimptool = expand($gimppath . "gimptool-2.0");
+my ($plugindir, $pluginlibs) = split /\n/, `$gimptool --gimpplugindir --libs`;
 
-# need this for setting library variables below
-$pluginlibs = `$gimppath/gimptool-2.0 --libs`;
-chomp $pluginlibs;
-
-# Get gimp's version and append to make binname
-$gimpbinname = ExtUtils::PkgConfig->modversion("gimp-2.0");
+my $gimpbinname = ExtUtils::PkgConfig->modversion("gimp-2.0");
 $gimpbinname =~ s/^(\d\.\d).*/$1/; # strip off minor versions
-$gimpversion = $gimpbinname; # capture the x.y version number
-$gimpbinname = "gimp-" . $gimpbinname;
+die "Need GIMP version at least 2.8.0\n" unless $gimpbinname >= 2.8;
 
-die "Need GIMP version at least 2.8.0\n" unless $gimpversion >= 2.8;
+eval "use PDL";
+$PDL= !$@;
+require PDL::Core::Dev;
 
 %cfg = (
-   GIMP         => $gimppath . $gimpbinname,
-   GIMPTOOL     => $gimppath . "gimptool-2.0",
-   _GIMP_INC        => $gimpcfg{"cflags"},
-   _GIMP_INC_NOUI   => $gimpcfg{"cflags"},
-   _GIMP_LIBS       => $pluginlibs,
-   _GIMP_LIBS_NOUI  => $gimpcfg{"libs"},
-
-   GTK_CFLAGS       => $gtkcfg{"cflags"},
-
-   GLIB_CFLAGS      => $glibcfg{"cflags"},
-   GLIB_LIBS        => $glibcfg{"libs"},
-
-   gimpplugindir    => $gimplibdir,
-
-   _EXTENSIVE_TESTS => q[1],
-
-   pdl_inc      => '',
-   pdl_typemaps     => '',
-   INC1         => '',
-   DEFINE1      => '',
-
-   LIBS         => q[],
-   INTLLIBS     => q[],
+  GIMP => expand($gimppath . "gimp-" . $gimpbinname),
+  GIMPTOOL => $gimptool,
+  GIMP_LIBS => exp_topdir($pluginlibs),
+  GIMP_LIBS_NOUI => exp_topdir($gimpcfg{"libs"}),
+  gimpplugindir => $plugindir,
+  pdl_typemaps => [$PDL ? &PDL::Core::Dev::PDL_TYPEMAP : "$topdir/typemap.pdl"],
+  GIMP_CFLAGS => " -I$topdir -Ddatadir=\"\\\"".expand($datadir)."\\\"\" "
+    . ($PDL ? "-DHAVE_PDL=1 " . &PDL::Core::Dev::PDL_INCLUDE : '')
+    . ' ' . (add_ingimp(exp_topdir($gimpcfg{"cflags"}))) . ' ',
+  INTLLIBS => expand(q[]),
 );
 
 sub expand {
-   my $cfg = shift;
-   my $count = 5;
-   $cfg =~ s%\$\(top_builddir\)%$topdir/../../%g;
-   while($cfg=~/\$\{/ and $count--) {
-      while(($k,$v)=each %cfg) {
-         $cfg=~s/\$\{$k\}/$v/g;
-      }
-   }
-   $cfg;
-}
-
-
-# the next line should no longer be necessary, but...
-$cfg{_CFLAGS} =~ s/\B-Wall\b//g; # remove -Wall from cflags and pray...
-
-while (($k,$v)=each(%cfg)) {
-   $k=~s/^_//;
-   $$k=$v;
-}
-
-$GIMPTOOL       = expand($GIMPTOOL);
-$INTLLIBS   = expand($INTLLIBS);
-
-chomp($gimpplugindir  = `$GIMPTOOL --gimpplugindir`);
-$GIMP           = expand($GIMP);
-
-$GIMP_INC   =~ s%\$topdir%$topdir%g;
-$GIMP_INC_NOUI  =~ s%\$topdir%$topdir%g;
-$GIMP_LIBS  =~ s%\$topdir%$topdir%g;
-$GIMP_LIBS_NOUI =~ s%\$topdir%$topdir%g;
-
-# $...1 variables should be put in front of the corresponding MakeMaker values.
-$INC1    = "-I$topdir";
-$DEFINE1 = " -Ddatadir=\"\\\"".expand($datadir)."\\\"\"";
-
-eval "use PDL";
-if (!$@) {
-   require PDL::Version;
-   if ($PDL::Version::VERSION > 1.99) {
-      require PDL::Core::Dev;
-      if (!$@) {
-         $PDL=1;
-      } else {
-         $do_config_msg && print <<EOF;
-
-ERROR:   PDL::Core::Dev module not found ($@),
-         this is an error in your PDL installation.
-
-EOF
-      }
-   } else {
-      $do_config_msg && print <<EOF;
-
-WARNING: PDL version $PDL::Version::VERSION is installed. Gimp was only
-         tested with 2.0 and higher.  In case of problems its advisable to
-         upgrade PDL to at least version 2.
-
-EOF
-   }
-} else {
-   $do_config_msg && print <<EOF;
-
-WARNING: unable to use PDL (the perl data language). This means that
-         normal pixel access is non-functional. Unless you plan to use
-         Tile/PixelRgn functions together with PDL, this is harmless. The
-         plug-ins using PDL, however, will NOT WORK and you can NO LONGER
-         install PDL later. You can get PDL from any CPAN mirror.
-
-EOF
+  my $var = shift;
+  return '' unless defined $var;
+  my $count = 5;
+  $var =~ s%\$\(top_builddir\)%$topdir/../../%g;
+  while($var=~/\$\{/ and $count--) {
+    $var=~s/\$\{$k\}/$v/g while ($k,$v) = each %cfg;
+  }
+  $var;
 }
 
-$do_config_msg && print "checking for PDL support... ", $PDL ? "yes":"no","\n";
-if ($PDL) {
-   $do_config_msg && print "checking for PDL include path... ",&PDL::Core::Dev::PDL_INCLUDE,"\n";
-   $do_config_msg && print "checking for PDL typemap... ",&PDL::Core::Dev::PDL_TYPEMAP,"\n";
-
-   $pdl_inc      = $pdl_inc = &PDL::Core::Dev::PDL_INCLUDE;
-   $pdl_typemaps = "@{[ pdl_typemaps = &PDL::Core::Dev::PDL_TYPEMAP]}";
-   $DEFINE1 .= " -DHAVE_PDL=1";
-} else {
-   @pdl_typemaps = "$topdir/typemap.pdl";
-}
-
-for(keys %cfg) {
-   ($k=$_)=~s/^_//;
-   $cfg{$_}=$$k;
-}
-
-sub MY::makefile {
-   my $self = shift;
-   return $self->MM::makefile(@_);
-}
+sub exp_topdir { local $_ = shift; s%\$topdir%$topdir%g; $_ }
+sub add_ingimp { local $_ = shift; $_ = "-I$topdir/../.. $_"  if $IN_GIMP; $_ }
 
 1;
diff --git a/examples/Makefile.PL b/examples/Makefile.PL
index f42c3b3..a922aff 100644
--- a/examples/Makefile.PL
+++ b/examples/Makefile.PL
@@ -1,84 +1,37 @@
 require 5.008;
-
-$|=1;
-
-do '../config.pl' or die $@;
-
-# list of plugins using gtk directly (Gtk absolutely required)
- gtk_pins =
-   qw(
-     dataurl
-     colorhtml
-     fade-alpha
-   );
-
-# list of standard plugins
- pins =
-   qw(
-      Perl-Server
-      animate_cells
-      blended2 blowinout bricks burst
-      centerguide
-      ditherize dots dust
-      frame_filter frame_reshuffle
-      glowing_steel goldenmean guidegrid guides_to_selection
-      image_tile innerbevel
-      layerfuncs mirrorsplit
-      perlotine prep4gif
-      repdup roundsel
-      scratches sethspin stamps
-      tex-to-float translogo
-      randomart1 randomblends
-      selective_sharpen
-      warp-sharp webify windify
-      xachlego xachshadow xachvision
-      yinyang
-   );
-# list of plugins using PDL
-
- pdl_pins =
-   qw(
-      gouge
-      redeye
-      pixelmap
-      view3d
-   );
-
-# plugins that are useful code examples, but not even arguably useful
-# gimp plugins due to silliness or duplication
-
- uninstalled_pins =
-  qw(
-     example-fu
-     example-net
-     map_to_gradient
-  );
-
-# GTK isn't absolutely required, but for most people it is highly
-# desirable, so make a nice big notice saying so.
-
-eval "use Gtk2;"; $GTK = $@ eq "";
-
 use ExtUtils::MakeMaker;
+use File::Basename;
 
-push @pins, @pdl_pins if $PDL;
-push @pins, @gtk_pins if $GTK;
+require '../config.pl';
 
-sub MY::install {
-   my $self=shift;
-   package MY;
-   my $install = $self->SUPER::install(@_);
-   <<'EOF' . $install;
-install :: install-plugins
-
-EOF
-}
-
-sub basename {
-  my $dest = shift;
-  $dest =~ s#.*/##;
-  $dest;
-}
+# list of standard plugins
+ pins = qw(
+  Perl-Server
+  dataurl
+  colorhtml
+  fade-alpha
+  animate_cells
+  blended2 blowinout bricks burst
+  centerguide
+  ditherize dots dust
+  frame_filter frame_reshuffle
+  glowing_steel goldenmean guidegrid guides_to_selection
+  image_tile innerbevel
+  layerfuncs mirrorsplit
+  perlotine prep4gif
+  repdup roundsel
+  scratches sethspin stamps
+  tex-to-float translogo
+  randomart1 randomblends
+  selective_sharpen
+  warp-sharp webify windify
+  xachlego xachshadow xachvision
+  yinyang
+  gouge
+  redeye
+  pixelmap
+  view3d
+);
 
 sub plugin_target {
   my $plugin = shift;
@@ -95,8 +48,8 @@ EOF
 
 sub MY::postamble {
    my $self=shift;
-   my $GT = "$GIMPTOOL --install-admin-bin";
-   my $UT = "$GIMPTOOL --uninstall-admin-bin";
+   my $GT = "$cfg{GIMPTOOL} --install-admin-bin";
+   my $UT = "$cfg{GIMPTOOL} --uninstall-admin-bin";
    <<EOF;
 
 INST_PLUGINS = ../blib/plugins
@@ -108,6 +61,8 @@ INST_PLUGINS = ../blib/plugins
 
 @{[ join '', map { plugin_target($_) } @pins ]}
 
+install :: install-plugins
+
 pure_all :: pure_plugins
 
 pure_plugins : @{[ map { "\$(INST_PLUGINS)/".basename($_) } @pins ]}
@@ -124,5 +79,7 @@ EOF
 WriteMakefile(
     'NAME'     => 'Gimp',
     'VERSION_FROM' => '../Gimp.pm',
-    'clean'    => { FILES => "Makefile.old" },
+    'clean'    => { FILES => qq(Makefile.old) },
+    NO_MYMETA  => 1,
+    NO_META    => 1,
 );
diff --git a/t/perlplugin.t b/t/perlplugin.t
index 9dc02a5..7d5bf95 100644
--- a/t/perlplugin.t
+++ b/t/perlplugin.t
@@ -1,14 +1,13 @@
 use strict;
 use Test::More;
-our ($dir, $DEBUG, $myplugins);
+our ($dir, $DEBUG);
 BEGIN {
 #  $Gimp::verbose = 1;
   $DEBUG = 0;
   require 't/gimpsetup.pl';
   use Config;
-  my $plugin = "$myplugins/test_perl_filter";
-  write_plugin($DEBUG, $plugin, $Config{startperl}.
-    "\nBEGIN { \$Gimp::verbose = ".int($Gimp::verbose).'; }'.<<'EOF');
+  write_plugin($DEBUG, "test_perl_filter", $Config{startperl}.
+    "\nBEGIN { \$Gimp::verbose = ".int($Gimp::verbose||0).'; }'.<<'EOF');
 
 use strict;
 use Gimp qw(:auto __ N_);


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