#! perl # Makefile.PL -- Makefile for eps2png # Author : Johan Vromans # Created On : Sat Jun 6 16:08:33 1998 # Last Modified By: Johan Vromans # Last Modified On: Mon Jan 6 22:45:34 2020 # Update Count : 88 # Status : Released # Ease the life of the CPAN testers. exit 0 if $ENV{AUTOMATED_TESTING} && $] < 5.010001; use strict; use warnings; use Config; # EU::MM 6.5503 is the first version to understand *_REQUIRES. use ExtUtils::MakeMaker 6.5503; my @scripts = qw( eps2png ); my $usrbin = "/usr/bin"; my $installscript = $Config{installscript}; print STDERR <&1` =~ /pbm version: (.*)/i; if ( $pbm ) { print STDERR ("PBM version $pbm detected.\n"); } else { warn("No PBM found. You won't be able to generate GIF images.\n"); } } my $name = 'eps2png'; my $master = "lib/App/${name}.pm"; my $version = MM->parse_version($master); unless ( -f "${name}.spec" ) { open( my $fd, ">", "${name}.spec" ); print $fd "Placeholder, will be overwritten by Makefile.PL.\n"; close($fd); } WriteMakefile( NAME => $name, AUTHOR => 'Johan Vromans ', VERSION => $version, ABSTRACT => 'convert EPS files to PNG, JPG or GIF images', LICENSE => 'perl', PL_FILES => {}, EXE_FILES => [ map { "script/$_" } @scripts ], MIN_PERL_VERSION => '5.010001', CONFIGURE_REQUIRES => { "ExtUtils::MakeMaker" => 6.5503, }, # BUILD_REQUIRES => { # }, TEST_REQUIRES => { 'Test::More' => 0, }, META_MERGE => { resources => { repository => { type => 'git', web => "https://github.com/sciurius/${name}", url => "https://github.com/sciurius/${name}.git", }, bugtracker => "https://github.com/sciurius/${name}/issues", }, 'meta-spec' => { version => '2', url => 'https://metacpan.org/pod/CPAN::Meta::Spec', }, provides => { 'App::eps2png' => { file => "lib/App/${name}.pm", version => $version }, eps2png => { file => "script/${name}", version => $version }, } } ); warn("Creating script\n"); open(my $src, "<", "lib/App/${name}.pm") or die("script/${name}: $!\n"); open(my $dst, ">", "script/${name}") or die("script/${name}: $!\n"); while ( <$src> ) { s/^\$use_pbm = .;/\$use_pbm = $needpbm;/; print { $dst } $_; } close($dst); close($src); chmod( 0755, "script/${name}" ); WriteSpecfile( $name, $version ); 1; use POSIX 'strftime'; sub WriteSpecfile { my $name = shift; my $version = shift; my @tm = localtime; vcopy( _tag => "RPM spec file", _dst => "$name.spec", pkgname => $name, version => $version, rpmdate => strftime("%a %b %e %Y", @tm), ); } sub vcopy { my (%ctrl) = @_; $ctrl{_src} ||= $ctrl{_dst} . ".in"; return unless open(my $fh, "<", $ctrl{_src}); print("Writing ", $ctrl{_tag}, "...\n") if $ctrl{_tag}; my $newfh; open ($newfh, ">", $ctrl{_dst}) or die($ctrl{_dst}, ": $!\n"); my $pat = "("; foreach ( grep { ! /^_/ } keys(%ctrl) ) { $pat .= quotemeta($_) . "|"; } chop($pat); $pat .= ")"; $pat = qr/\[\%\s+$pat\s+\%\]/; while ( <$fh> ) { s/$pat/$ctrl{$1}/ge; print { $newfh } $_; } close($newfh); }