1999-03-03 15:14:45 +00:00
|
|
|
require 5.004;
|
1998-10-31 23:48:42 +00:00
|
|
|
|
1998-10-23 13:34:08 +00:00
|
|
|
use Config;
|
|
|
|
|
|
|
|
$topdir=".";
|
1999-02-09 20:05:07 +00:00
|
|
|
$|=1;
|
1998-10-23 13:34:08 +00:00
|
|
|
|
1999-03-12 20:37:06 +00:00
|
|
|
@examples =
|
|
|
|
qw(windy.pl prep4gif.pl webify.pl PDB alpha2color.pl tex-to-float ditherize.pl
|
|
|
|
border.pl view3d.pl feedback.pl xachlego.pl xachshadow.pl parasite-editor
|
|
|
|
scratches.pl blowinout.pl terral_text xachvision.pl gimpmagick perlcc
|
1999-03-14 03:41:20 +00:00
|
|
|
sethspin.pl animate_cells image_tile yinyang stamps
|
1999-03-13 20:03:30 +00:00
|
|
|
);
|
1999-03-12 20:37:06 +00:00
|
|
|
@shebang = (map("examples/$_",@examples),
|
1999-03-13 20:03:30 +00:00
|
|
|
qw(Perl-Server examples/example-net.pl examples/homepage-logo.pl
|
|
|
|
examples/example-fu.pl examples/example-oo.pl
|
|
|
|
));
|
1999-03-12 20:37:06 +00:00
|
|
|
|
1998-10-23 13:34:08 +00:00
|
|
|
if ($ARGV[0] ne "--writemakefile") {
|
|
|
|
for(@ARGV) {
|
|
|
|
s/^prefix=/--prefix=/i;
|
|
|
|
}
|
|
|
|
|
|
|
|
do './config.pl';
|
|
|
|
if(defined $EXTENSIVE_TESTS) {
|
|
|
|
print "\nFetched some defaults from an earlier Makefile.PL run.\n";
|
|
|
|
print "Run \"make clean\" if you don't want this\n";
|
|
|
|
} else {
|
|
|
|
print "
|
|
|
|
This module usually does only a very short installation check.
|
|
|
|
Alternatively, it can do more extensive tests, but these tests might fail
|
|
|
|
even if everything is in fact correct. And it has only been tested with
|
|
|
|
gimp-1.1 ;)
|
|
|
|
|
|
|
|
If you decide to run these tests (please!), I'd be glad to hear
|
|
|
|
success stories (and of course any bug-reports ;)
|
|
|
|
|
1999-01-30 22:00:35 +00:00
|
|
|
Do you want me to make these tests [y]? ";
|
1998-10-23 13:34:08 +00:00
|
|
|
|
1999-03-10 21:10:25 +00:00
|
|
|
print "y\n";
|
|
|
|
$EXTENSIVE_TESTS = 1;
|
|
|
|
#$EXTENSIVE_TESTS = (<STDIN> !~ /^[nN]/) ? 1 : 0;
|
1998-10-23 13:34:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
print "\n";
|
|
|
|
|
|
|
|
$ENV{'EXTENSIVE_TESTS'} = $EXTENSIVE_TESTS;
|
|
|
|
$ENV{CC}=$Config{cc};
|
|
|
|
$ENV{LD}=$Config{ld};
|
|
|
|
$ENV{prefix}=$Config{prefix};
|
|
|
|
$ENV{PERL}=$Config{perlpath};
|
|
|
|
$ENV{MAKEFILE_PL}=$0;
|
|
|
|
$ENV{IN_GIMP}=0;
|
|
|
|
exit system("./etc/configure",@ARGV)>>8;
|
|
|
|
} else {
|
|
|
|
do './config.pl';
|
|
|
|
}
|
|
|
|
|
1999-03-13 20:03:30 +00:00
|
|
|
require ExtUtils::MakeMaker;
|
|
|
|
import ExtUtils::MakeMaker;
|
|
|
|
|
1998-10-23 13:34:08 +00:00
|
|
|
eval "use Gtk;"; $GTK = $@ eq "";
|
|
|
|
eval "use PDL;"; $PDL = $@ eq "";
|
|
|
|
eval "use Parse::RecDescent;"; $PRD = $@ eq "";
|
|
|
|
|
|
|
|
$] >= 5.005 or print <<EOF;
|
|
|
|
|
|
|
|
WARNING: you are using a version of perl older than 5.005. While this
|
1999-03-14 20:02:47 +00:00
|
|
|
extension should run on older versions (and I try to keep source
|
|
|
|
compatibility), some people get spurious errors that go away
|
|
|
|
after upgrading to 5.005 (or to gimp-1.1). Therefore, some
|
|
|
|
features of Gimp DO NOT WORK WITH 5.004 or gimp-1.0. Since 5.005
|
|
|
|
is much better and has many many bugs fixed, an upgrade would
|
|
|
|
come in handy...
|
1998-10-23 13:34:08 +00:00
|
|
|
|
|
|
|
EOF
|
|
|
|
|
|
|
|
$GTK or print <<EOF;
|
|
|
|
|
1999-02-09 20:05:07 +00:00
|
|
|
WARNING: unable to use the Perl-Gtk interface. Most features (like
|
1999-03-14 20:02:47 +00:00
|
|
|
Gimp::Fu) rely on this extension. You can try to build without
|
|
|
|
it (and many scripts won't work), but it's better to install
|
|
|
|
it (version 0.3 or higher is required, you can get it from
|
|
|
|
ftp://ftp.gimp.org/pub/gtk/perl/ or any CPAN mirror.
|
1998-10-23 13:34:08 +00:00
|
|
|
|
|
|
|
EOF
|
|
|
|
|
|
|
|
$PDL or print <<EOF;
|
|
|
|
|
1999-02-09 20:05:07 +00:00
|
|
|
WARNING: unable to use PDL (the perl data language). This means that
|
1999-03-14 20:02:47 +00:00
|
|
|
Gimp::PDL is non-functional. Unless you plan to use Tile/PixelRgn
|
|
|
|
functions together with PDL, this is harmless. Gimp::PDL will
|
|
|
|
be installed, just in case you later install PDL. The plug-ins
|
|
|
|
using PDL, however, will NOT WORK. You can get PDL from any CPAN
|
|
|
|
mirror.
|
1998-10-23 13:34:08 +00:00
|
|
|
|
|
|
|
EOF
|
|
|
|
|
|
|
|
!$PDL or $PDL::Version::VERSION > 1.99 or print <<EOF;
|
|
|
|
|
|
|
|
WARNING: PDL version $PDL::Version::VERSION is installed. Gimp::PDL was only
|
1999-03-14 20:02:47 +00:00
|
|
|
tested with 1.99 and higher. In case of problems its advisable to
|
|
|
|
upgrade PDL to at least version 2.
|
1998-10-23 13:34:08 +00:00
|
|
|
|
|
|
|
EOF
|
|
|
|
|
|
|
|
$PRD or print <<EOF;
|
|
|
|
|
|
|
|
WARNING: Parse::RecDescent is not installed (correctly) on your system. This
|
1999-03-14 20:02:47 +00:00
|
|
|
means scm2perl (the Scheme->Perl translator) isn't usable. If you
|
|
|
|
don't need this functionality there is nothing to worry about.
|
|
|
|
Should the need arise you can install Parse::RecDescent later; it
|
|
|
|
is available from any CPAN mirror.
|
1998-10-23 13:34:08 +00:00
|
|
|
|
|
|
|
EOF
|
|
|
|
|
|
|
|
($major,$minor,$patch)=split /[._]/,$Gtk::VERSION;
|
|
|
|
|
|
|
|
unless ($major > 0
|
1999-03-14 20:02:47 +00:00
|
|
|
|| ($major == 0 && $minor > 3)
|
|
|
|
|| ($major == 0 && $minor == 3 && $patch >= -1)) {
|
1999-03-11 20:08:58 +00:00
|
|
|
$GTK && print <<EOF;
|
1998-10-23 13:34:08 +00:00
|
|
|
|
1999-01-30 22:00:35 +00:00
|
|
|
WARNING: version 0.3 of Gtk is _required_ for this module to
|
1999-03-14 20:02:47 +00:00
|
|
|
build properly. You can get the newest version from
|
|
|
|
ftp://ftp.gimp.org/pub/gtk/perl/ or any CPAN mirror. Older
|
|
|
|
versions may work, but I have warned you!
|
1998-10-23 13:34:08 +00:00
|
|
|
|
|
|
|
EOF
|
|
|
|
}
|
|
|
|
|
1999-03-14 15:30:26 +00:00
|
|
|
eval { $Gimp::no_SIG=1; require Gimp };
|
|
|
|
unless($@) {
|
|
|
|
$old_prefix = eval { Gimp::_gimp_prefix() };
|
|
|
|
if ($@) {
|
|
|
|
print <<EOF;
|
|
|
|
|
|
|
|
WARNING: I've detected an old version of Gimp-Perl installed
|
1999-03-14 20:02:47 +00:00
|
|
|
already. Since I cannot detect the prefix used to install
|
|
|
|
it I will just overwrite it. If you happen to use two
|
|
|
|
different and incompatible versions of the Gimp with differing
|
|
|
|
prefixes you should call configure with the --disable-perl
|
|
|
|
switch to disable the perl extension, or consider installing
|
|
|
|
the perl module elsewhere, using the environment variables
|
|
|
|
PERL5LIB=/my/module/dir and PERL_MM_OPTS="PREFIX=\$PERL5LIB" to
|
|
|
|
overwrite the installation directory (PERL_MM_OPTS) and run the
|
|
|
|
Gimp (PERL5LIB). See "perldoc ExtUtils::MakeMaker" for a full
|
|
|
|
discussion of your options.
|
1999-03-14 15:30:26 +00:00
|
|
|
|
|
|
|
EOF
|
|
|
|
} else {
|
|
|
|
if ($GIMP_PREFIX ne $old_prefix) {
|
1999-03-14 20:02:47 +00:00
|
|
|
print <<EOF;
|
1999-03-14 15:30:26 +00:00
|
|
|
|
|
|
|
WARNING: I've detected another installaion of the Gimp-Perl extension.
|
1999-03-14 20:02:47 +00:00
|
|
|
|
|
|
|
This version uses the prefix '$GIMP_PREFIX'.
|
|
|
|
The already installed version uses the prefix '$old_prefix'.
|
1999-03-14 15:30:26 +00:00
|
|
|
|
1999-03-14 20:02:47 +00:00
|
|
|
They don't match, which indicates that installing Gimp-Perl might
|
|
|
|
overwrite an old but still used installation. Gimp-Perl will
|
|
|
|
therefore be disabled, and not be installed.
|
1999-03-14 15:30:26 +00:00
|
|
|
|
|
|
|
EOF
|
1999-03-14 20:02:47 +00:00
|
|
|
not_halt("prefix mismatch");
|
1999-03-14 15:30:26 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
1999-03-13 20:03:30 +00:00
|
|
|
# wo do no longer do these dirty things
|
|
|
|
#for(@shebang) {
|
|
|
|
# system ($Config{perlpath},"-pi","-e","\$. == 1 and \$_ = '#!$Config{perlpath}\n'",$_);
|
|
|
|
#}
|
1999-02-09 20:05:07 +00:00
|
|
|
|
1999-03-12 03:21:04 +00:00
|
|
|
sub MY::install {
|
|
|
|
package MY;
|
|
|
|
my $install = shift->SUPER::install(@_);
|
|
|
|
($install =~ s/^install\b/really-install/m) or return $install;
|
|
|
|
'
|
|
|
|
install ::
|
|
|
|
@for dir in \
|
|
|
|
$(INSTALLPRIVLIB) \
|
|
|
|
$(INSTALLARCHLIB) \
|
|
|
|
$(INSTALLBIN) \
|
|
|
|
$(INSTALLSCRIPT) \
|
|
|
|
$(INSTALLMAN1DIR) \
|
|
|
|
$(INSTALLMAN3DIR) ; \
|
|
|
|
do \
|
|
|
|
$(MKPATH) "$$dir"; \
|
|
|
|
if test -d "$$dir" && test -w "$$dir" ; then : ; else \
|
|
|
|
echo ; \
|
|
|
|
echo "ERROR: installation directory \"$$dir\"" ; \
|
|
|
|
echo " is not writable, not installing gimp-perl" ; \
|
|
|
|
echo ; \
|
|
|
|
exit ; \
|
|
|
|
fi \
|
|
|
|
done ; \
|
1999-03-14 20:02:47 +00:00
|
|
|
$(MAKE) UNINST=1 really-install install-plugins
|
1999-03-12 03:21:04 +00:00
|
|
|
|
|
|
|
'.$install;
|
|
|
|
}
|
|
|
|
|
1998-10-23 13:34:08 +00:00
|
|
|
sub MY::postamble {
|
1999-03-14 20:02:47 +00:00
|
|
|
my $GT = $IN_GIMP ? "../$GIMPTOOL" : $GIMPTOOL;
|
1999-03-13 20:03:30 +00:00
|
|
|
my $postamble="
|
1998-10-23 13:34:08 +00:00
|
|
|
|
1999-01-30 22:00:35 +00:00
|
|
|
objclean :: clean
|
1998-10-23 13:34:08 +00:00
|
|
|
maintainer-clean :: realclean
|
|
|
|
distclean :: realclean
|
1998-10-25 21:13:08 +00:00
|
|
|
check :: test
|
1998-10-23 13:34:08 +00:00
|
|
|
|
1999-01-30 22:00:35 +00:00
|
|
|
clean ::
|
|
|
|
test -f Makefile || mv -f Makefile.old Makefile
|
1999-03-14 20:02:47 +00:00
|
|
|
\$(RM_RF) inst-temp
|
|
|
|
|
|
|
|
install-plugins ::
|
|
|
|
\$(RM_RF) inst-temp
|
|
|
|
\$(MKPATH) inst-temp
|
|
|
|
cd inst-temp ; \\
|
|
|
|
\$(UMASK_NULL) ; \\
|
|
|
|
\$(CP) ".join(' ',map("'../examples/$_'",@examples))." ../Perl-Server . ; \\
|
|
|
|
\$(CHMOD) 755 * ; \\
|
|
|
|
\$(FIXIN) * ; \\
|
|
|
|
for plugin in * ; do \\
|
|
|
|
$GT --install-admin-bin \"\$\$plugin\" ; \\
|
|
|
|
done
|
|
|
|
\$(RM_RF) inst-temp
|
|
|
|
";
|
1998-10-23 13:34:08 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
WriteMakefile(
|
|
|
|
'dist' => {
|
1999-03-14 20:02:47 +00:00
|
|
|
'PREOP' => 'chmod -R u=rwX,go=rX . ;',
|
|
|
|
'COMPRESS' => 'gzip -9v',
|
|
|
|
'SUFFIX' => '.gz',
|
|
|
|
},
|
1998-10-23 13:34:08 +00:00
|
|
|
'PREREQ_PM' => {
|
|
|
|
"Gtk" => 0.3,
|
|
|
|
"Data::Dumper" => 2,
|
|
|
|
},
|
|
|
|
'DIR' => ['Gimp'],
|
|
|
|
'NAME' => 'Gimp',
|
|
|
|
'VERSION_FROM' => 'Gimp.pm',
|
|
|
|
'PM' => {
|
|
|
|
'Gimp.pm' => '$(INST_LIBDIR)/Gimp.pm',
|
|
|
|
'Gimp/Data.pm' => '$(INST_LIBDIR)/Gimp/Data.pm',
|
|
|
|
'Gimp/Fu.pm' => '$(INST_LIBDIR)/Gimp/Fu.pm',
|
|
|
|
'Gimp/Lib.pm' => '$(INST_LIBDIR)/Gimp/Lib.pm',
|
|
|
|
'Gimp/UI.pm' => '$(INST_LIBDIR)/Gimp/UI.pm',
|
|
|
|
'Gimp/Net.pm' => '$(INST_LIBDIR)/Gimp/Net.pm',
|
|
|
|
'Gimp/PDL.pm' => '$(INST_LIBDIR)/Gimp/PDL.pm',
|
1999-01-16 23:01:19 +00:00
|
|
|
'Gimp/Util.pm' => '$(INST_LIBDIR)/Gimp/Util.pm',
|
1999-03-11 20:08:58 +00:00
|
|
|
'Gimp/Feature.pm' => '$(INST_LIBDIR)/Gimp/Feature.pm',
|
1998-10-23 13:34:08 +00:00
|
|
|
},
|
|
|
|
'LIBS' => [''],
|
|
|
|
'INC' => "$CPPFLAGS $CFLAGS $GIMP_INC_NOUI $DEFS",
|
1999-03-12 03:21:04 +00:00
|
|
|
'DEFINE' => ($IN_GIMP ? " -DIN_GIMP " : ""),
|
1999-02-15 19:27:13 +00:00
|
|
|
'EXE_FILES' => ['scm2perl','scm2scm'],
|
1998-10-25 21:13:08 +00:00
|
|
|
'realclean' => { FILES => "config.status config.cache config.log config.pl config.h" },
|
1999-01-30 22:00:35 +00:00
|
|
|
'clean' => { FILES => "Makefile.old stamp-h" },
|
1998-10-23 13:34:08 +00:00
|
|
|
);
|
|
|
|
|
|
|
|
$IN_GIMP or print <<EOF;
|
|
|
|
|
|
|
|
|
1999-01-30 22:00:35 +00:00
|
|
|
Hopefully, Gimp is now correctly configured. you can now enter "make",
|
|
|
|
"make test" and "make install".
|
1998-10-23 13:34:08 +00:00
|
|
|
|
|
|
|
EOF
|
|
|
|
|
1999-03-12 03:21:04 +00:00
|
|
|
# write an empty makefile (the last chance to stop)
|
|
|
|
# and warn the user.
|
|
|
|
sub not_halt {
|
|
|
|
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: clean
|
|
|
|
rm -f Makefile config.cache config.pl config.log config.h config.status stamp-h Makefile.old
|
|
|
|
EOF
|
|
|
|
close MAKEFILE;
|
|
|
|
exit;
|
|
|
|
}
|
|
|
|
|
1998-10-23 13:34:08 +00:00
|
|
|
|
|
|
|
|