[gimp-perl] Complete move of Perl Server to examples/. Bug 727126
- From: Ed J <edj src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp-perl] Complete move of Perl Server to examples/. Bug 727126
- Date: Wed, 23 Apr 2014 05:11:25 +0000 (UTC)
commit 29c7e1c92ba8a4b7c9a44a52f2d44c4742d03018
Author: Ed J <m8r-35s8eo mailinator com>
Date: Sun Mar 30 14:40:41 2014 +0100
Complete move of Perl Server to examples/. Bug 727126
Makefile.PL | 179 ++++----------------------------------------------
examples/Makefile.PL | 128 +++++++++++++++++++++++++++++++++++
t/gimpsetup.pl | 16 +++--
3 files changed, 150 insertions(+), 173 deletions(-)
---
diff --git a/Makefile.PL b/Makefile.PL
index b5b73db..e400862 100644
--- a/Makefile.PL
+++ b/Makefile.PL
@@ -1,79 +1,9 @@
require 5.008;
-use Config;
-require ExtUtils::PkgConfig;
-require ExtUtils::Depends;
-
$|=1;
-if ($ARGV[0] ne "--writemakefile") {
- # convert any prefix= to --prefix=
- for(@ARGV) {
- s/^prefix=/--prefix=/i;
- }
-
- # run the config.pl to setup enviornment
- do './config.pl' or die $@;
-
- # get compile/link args
- $ENV{CC}=$Config{cc};
- $ENV{LD}=$Config{ld};
- $ENV{prefix}=$Config{prefix};
- $ENV{PERL}=$Config{perlpath};
- $ENV{MAKEFILE_PL}=$0;
-}
-
- otherdeps = qw(
-);
-
-# list of plugins using gtk directly (Gtk absolutely required)
- gtk_pins =
- qw(
- dataurl
- colorhtml
- fade-alpha
- );
-
-# list of standard plugins
- pins =
- qw(
- 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
- );
+# 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.
@@ -92,18 +22,14 @@ EOF
use ExtUtils::MakeMaker;
-push @pins, @pdl_pins if $PDL;
-push @pins, @gtk_pins if $GTK;
-
- INC = grep /^\//,@INC; # comment out as well?
-
sub MY::install {
my $self=shift;
package MY;
my $install = $self->SUPER::install(@_);
- ($install =~ s/\b(un)?install\b/really-$1install/g) or return $install;
- '
-install ::
+ <<'EOF' . $install;
+install :: install-writable
+
+install-writable ::
@for dir in \
$(INSTALLPRIVLIB) \
$(INSTALLARCHLIB) \
@@ -114,37 +40,15 @@ install ::
do \
$(MKPATH) "$$dir"; \
if test -d "$$dir" && test -w "$$dir" ; then : ; else \
- echo ; \
- echo "ERROR: installation directory \"$$dir\"" ; \
+ echo "ERROR: installation directory $$dir" ; \
echo " is not writable, not installing gimp-perl" ; \
- echo ; \
- exit ; \
+ exit 1 ; \
fi ; \
- done ; \
- $(MAKE) really-install install-plugins'."
+ done ;
install-po:
cd po && \$(MAKE) install
-".$install;
-}
-
-sub basename {
- my $dest = shift;
- $dest =~ s#.*/##;
- $dest;
-}
-
-sub plugin_target {
- my $plugin = shift;
- my $dest = '$(INST_PLUGINS)/'.basename($plugin);
- <<EOF;
-$dest : $plugin \$(FIRST_MAKEFILE) \$(INST_PLUGINS)\$(DFSEP).exists
- \$(NOECHO) \$(RM_F) $dest
- \$(CP) $plugin $dest
- \$(FIXIN) $dest
- -\$(NOECHO) \$(CHMOD) \$(PERM_RWX) $dest
-
EOF
}
@@ -152,7 +56,6 @@ sub MY::postamble {
my $self=shift;
my $GT = "$GIMPTOOL --install-admin-bin";
my $UT = "$GIMPTOOL --uninstall-admin-bin";
- my $GT2 = '';
<<EOF;
objclean :: clean
@@ -160,37 +63,11 @@ maintainer-clean :: realclean
distclean :: realclean
check :: test
-INST_PLUGINS = blib/plugins
-
-all ::
-
-\$(INST_PLUGINS)\$(DFSEP).exists :: Makefile.PL
- \$(NOECHO) \$(MKPATH) \$(INST_PLUGINS)
- \$(NOECHO) \$(CHMOD) \$(PERM_DIR) \$(INST_PLUGINS)
- \$(NOECHO) \$(TOUCH) \$(INST_PLUGINS)\$(DFSEP).exists
-
- {[
-join '', map { plugin_target($_) } 'Perl-Server', map { "examples/$_" } @pins
-]}
-
-all :: pure_plugins
-
-pure_plugins : @{[
- map { "\$(INST_PLUGINS)/".basename($_) } 'Perl-Server', @pins
-]}
-
-install-plugins :: pure_plugins
- cd \$(INST_PLUGINS) ; \\
- for plugin in * ; do $GT \"\$\$plugin\" $GT2 ; done
-
-uninstall :: force_uninstall_from_\$(INSTALLDIRS)dirs
- for plugin in Perl-Server @pins; do $UT $GT2\$\$plugin; done
-
force_uninstall_from_perldirs ::
- \$(PERL) -MExtUtils::Install -e 'uninstall(\$\$ARGV[0],1,0)'
".$self->catfile('$(PERL_ARCHLIB)','auto','$(FULLEXT)','.packlist')."
+ \$(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')."
+ \$(PERL) -MExtUtils::Install -e 'uninstall(\$\$ARGV[0],1,0)'
@{[$self->catfile('$(SITEARCHEXP)','auto','$(FULLEXT)','.packlist')]}
# generate tags file
tags: .
@@ -203,8 +80,6 @@ setver:
EOF
}
- DIRS= qw/Gimp Net UI/;
-
print "writing Gimp/Config.pm... ";
{
sub conf_eval {
@@ -248,7 +123,7 @@ WriteMakefile(
},
},
},
- 'DIR' => [ DIRS],
+ 'DIR' => [ qw/Gimp Net UI examples/ ],
'NAME' => 'Gimp',
'VERSION_FROM' => 'Gimp.pm',
'INSTALLBIN'=> $bindir,
@@ -258,33 +133,5 @@ WriteMakefile(
'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" },
+ 'clean' => { FILES => "Makefile.old stamp-h Gimp/Config.pm" },
);
-
-print <<EOF;
-
-Hopefully, Gimp is now correctly configured. you can now enter "make",
-"make test" and "make install".
-
-EOF
-
-__END__
-# write an empty makefile (the last chance to stop)
-# and warn the user.
-sub emergency_stop {
- print STDERR "WARNING: *** perl extension will not be built ($_[0]) ***\n\n";
- open MAKEFILE,">Makefile" or die "unable to create Makefile: $!";
- print MAKEFILE <<EOF;
-all install check:
-
-clean mostlyclean objclean:
-
-distclean maintainer-clean realclean clobber: clean
- \$(RM_F) Makefile config.cache config.log
- \$(RM_F) config.h config.status stamp-h Makefile.old Gimp/Config.pm
- \$(RM_RF) test-dir inst-temp
-
-EOF
- close MAKEFILE;
- exit;
-}
diff --git a/examples/Makefile.PL b/examples/Makefile.PL
new file mode 100644
index 0000000..f42c3b3
--- /dev/null
+++ b/examples/Makefile.PL
@@ -0,0 +1,128 @@
+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;
+
+push @pins, @pdl_pins if $PDL;
+push @pins, @gtk_pins if $GTK;
+
+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;
+}
+
+sub plugin_target {
+ my $plugin = shift;
+ my $dest = '$(INST_PLUGINS)/'.basename($plugin);
+ <<EOF;
+$dest : $plugin \$(FIRST_MAKEFILE) \$(INST_PLUGINS)\$(DFSEP).exists
+ \$(NOECHO) \$(RM_F) $dest
+ \$(CP) $plugin $dest
+ \$(FIXIN) $dest
+ -\$(NOECHO) \$(CHMOD) \$(PERM_RWX) $dest
+
+EOF
+}
+
+sub MY::postamble {
+ my $self=shift;
+ my $GT = "$GIMPTOOL --install-admin-bin";
+ my $UT = "$GIMPTOOL --uninstall-admin-bin";
+ <<EOF;
+
+INST_PLUGINS = ../blib/plugins
+
+\$(INST_PLUGINS)\$(DFSEP).exists :: Makefile.PL
+ \$(NOECHO) \$(MKPATH) \$(INST_PLUGINS)
+ \$(NOECHO) \$(CHMOD) \$(PERM_DIR) \$(INST_PLUGINS)
+ \$(NOECHO) \$(TOUCH) \$(INST_PLUGINS)\$(DFSEP).exists
+
+ {[ join '', map { plugin_target($_) } @pins ]}
+
+pure_all :: pure_plugins
+
+pure_plugins : @{[ map { "\$(INST_PLUGINS)/".basename($_) } @pins ]}
+
+install-plugins :: pure_plugins
+ cd \$(INST_PLUGINS) ; for p in * ; do $GT "\$\$p" ; done
+
+uninstall ::
+ cd \$(INST_PLUGINS); for plugin in *; do $UT "\$\$plugin"; done
+
+EOF
+}
+
+WriteMakefile(
+ 'NAME' => 'Gimp',
+ 'VERSION_FROM' => '../Gimp.pm',
+ 'clean' => { FILES => "Makefile.old" },
+);
diff --git a/t/gimpsetup.pl b/t/gimpsetup.pl
index d3e63eb..cc0e72b 100644
--- a/t/gimpsetup.pl
+++ b/t/gimpsetup.pl
@@ -3,7 +3,7 @@
# use Test::*; # to make available ok()
# use Gimp qw(:auto);
# our $dir;
-# our $myplugins; # if want to write_plugin to right place!
+# our $blibplugins; # where plugins are built to - #! line correct
# if encounters problems, does a die()
use strict;
@@ -20,13 +20,12 @@ my $sysplugins = $cfg{gimpplugindir} . '/plug-ins';
die "plugins dir: $!" unless -d $sysplugins;
die "script-fu not executable: $!" unless-x "$sysplugins/script-fu";
-our $dir = File::Temp->newdir($DEBUG ? (CLEANUP => 0) : ());;#
-our $myplugins = "$dir/plug-ins";
+our $dir = File::Temp->newdir($DEBUG ? (CLEANUP => 0) : ());
+my $myplugins = "$dir/plug-ins";
+our $blibplugins = "blib/plugins";
die "mkdir $myplugins: $!\n" unless mkdir $myplugins;
-my $perlserver = "$myplugins/Perl-Server";
-my $s = io("Perl-Server")->all or die "unable to read the Perl-Server: $!";
-$s =~ s/^(#!).*?(\n)/$Config{startperl}$2/;
-write_plugin($DEBUG, $perlserver, $s);
+my $s = io("$blibplugins/Perl-Server")->all or die "unable to read the Perl-Server: $!";
+write_plugin($DEBUG, 'Perl-Server', $s);
map {
die "symlink $_: $!" unless symlink("$sysplugins/$_", "$myplugins/$_");
} qw(script-fu sharpen);
@@ -50,8 +49,11 @@ sub make_executable {
die "chmod $newfile: $!\n" unless chmod 0700, $newfile;
}
+# prepends $myplugins to filename
sub write_plugin {
my ($debug, $file, $text) = @_;
+ $file =~ s#.*/##;
+ $file = "$myplugins/$file";
# trying to be windows- and unix-compat in how to make things executable
# $file needs to have no extension on it
my $wrapper = "$file-wrap";
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]