In-House patch.
Making sure Perl-Tk does not build its own copy of libpng and libz, instead links against these libraries already present in Solaris in /usr/lib.
--- Tk-804.033/PNG/Makefile.PL.orig 2015-05-01 10:47:20.131896716 -0700
+++ Tk-804.033/PNG/Makefile.PL 2015-05-01 10:52:57.599540636 -0700
@@ -2,19 +2,6 @@
use strict;
use Tk::MMutil;
use Tk::Config ();
-use Tk::MMtry;
-use File::Copy;
-
-my $l = $Config::Config{'lib_ext'};
-my $cc = $Config::Config{'cc'};
-my $zlib = "libz$l";
-
-foreach my $file (qw(zlib/Makefile.PL libpng/Makefile.PL))
- {
- next unless -f $file;
- chmod(0666,$file) unless -w $file;
- unlink($file);
- }
my $all_cflags;
my $all_libs;
@@ -27,12 +14,6 @@
chomp($libpng_cflags = `pkg-config --cflags libpng`);
chomp($libpng_libs = `pkg-config --libs libpng`);
}
- else
- {
- warn "'pkg-config libpng' failed, continue with fallback values for cflags and libs...\n";
- $libpng_cflags = '-I/usr/local/include';
- $libpng_libs = '-lpng -lm';
- }
my $zlib_cflags;
my $zlib_libs;
@@ -51,65 +32,18 @@
$all_cflags = "$libpng_cflags $zlib_cflags";
$all_libs = "$libpng_libs $zlib_libs";
+
+ Tk::MMutil::TkExtMakefile(
+ NAME => 'Tk::PNG',
+ VERSION_FROM => 'PNG.pm',
+ XS_VERSION => $Tk::Config::VERSION,
+ dist => { COMPRESS => 'gzip -f9', SUFFIX => '.gz' },
+ OBJECT => '$(O_FILES)',
+ INC => $libpng_cflags,
+ LIBS => [$libpng_libs],
+ );
}
-if ($Tk::MMtry::VERSION ge '4.007' &&
- try_run("config/has_png.c",[$all_cflags],[$all_libs]))
- {
- warn "Using system's -lpng\n";
- Tk::MMutil::TkExtMakefile(
- NAME => 'Tk::PNG',
- VERSION_FROM => 'PNG.pm',
- XS_VERSION => $Tk::Config::VERSION,
- dist => { COMPRESS => 'gzip -f9', SUFFIX => '.gz' },
- OBJECT => '$(O_FILES)',
- INC => $all_cflags,
- LIBS => [$all_libs],
- );
- }
-else
- {
- my $ok = 1;
- unless (copy("Makefile.libpng.maybe","libpng/Makefile.PL"))
- {
- warn "Cannot copy Makefile.libpng.maybe => libpng/Makefile.PL ($!)";
- $ok = 0;
- }
- unless (copy("Makefile.zlib.maybe","zlib/Makefile.PL"))
- {
- warn "Cannot copy Makefile.zlib.maybe => zlib/Makefile.PL ($!)";
- $ok = 0;
- }
- if ($ok)
- {
- warn "Building libpng$l\n";
- my $extlib = "libpng/libpng$l";
- if ($cc eq 'cl')
- {
- $extlib .= " zlib/zlib$l";
- $zlib = "zlib$l";
- }
- else
- {
- $extlib .= " zlib/libz$l";
- }
- Tk::MMutil::TkExtMakefile(
- NAME => 'Tk::PNG',
- VERSION_FROM => 'PNG.pm',
- XS_VERSION => $Tk::Config::VERSION,
- dist => { COMPRESS => 'gzip -f9', SUFFIX => '.gz' },
- OBJECT => '$(O_FILES)',
- INC => '-Ilibpng -Izlib',
- MYEXTLIB => $extlib,
- LIBS => ['-lm'],
- );
- }
- else
- {
- warn "Cannot build libpng$l\n";
- ExtUtils::MakeMaker::WriteEmptyMakefile();
- }
- }
sub MY::test_via_harness
{
@@ -134,48 +68,3 @@
qq[PASTHRU="CC=$Config::Config{cc} $Config::Config{cccdlflags}" RANLIB=\"$Config::Config{ranlib}\"];
}
}
-
-sub postamble {
- my $s = '';
- if (-f "libpng/Makefile.PL")
- {
- $s .=
-"
-libpng/libpng$l : zlib/$zlib
- cd libpng && \$(MAKE) libpng".$l.' $(PASTHRU)
-';
-
- }
- if (-f "zlib/Makefile.PL")
- {
- $s .=
-"
-zlib/$zlib : FORCE
- cd zlib && \$(MAKE) $zlib".' $(PASTHRU)
-';
-
- }
- return $s;
-}
-
-sub realclean {
- my $self = shift;
- my $str = $self->MM::realclean(@_);
- $str =~ s/(::\s*clean)/$1 realclean2/;
- $str .= "\nrealclean2 ::\n";
- $str .= "\t\$(RM_F) ".join(" \\\n\t","libpng/Makefile","libpng/Makefile.PL","zlib/Makefile","zlib/Makefile.PL")."\n";
- $str .= "\t\$(RM_F) ".join(" \\\n\t", map { "libpng/$_" } qw(
- config.h
- config.log
- config.status
- libpng-config
- libpng.pc
- libtool
- stamp-h1
- ))."\n";
- $str .= "\t\$(RM_RF) ".join(" \\\n\t","libpng/.deps")."\n";
- return $str;
-}
-
-
-