# Makefile.PL for PGP::Sign module -*- perl -*- # $Id: Makefile.PL 145 2004-08-05 05:27:39Z eagle $ use ExtUtils::MakeMaker; # The build process for PGP::Sign normally will attempt to find programs to # use for signature generation and verification and will set PGPSTYLE based # on what programs are found. We want to allow people to override that # earlier and without requiring interaction, though, so we allow four # additional command line options. We have to pull them out of @ARGV before # handing things over to WriteMakefile(), since otherwise MakeMaker will # complain about them. # # PGP sets both PGPS and PGPV to the same value; PGPS and PGPV can also be # set seperately for separate signing and verification programs. my ($pgps, $pgpv, $pgpstyle); @ARGV = map { if (/^PGP=(.*)/) { $pgps = $pgpv = $1; () } elsif (/^PGPS=(.*)/) { $pgps = $1; () } elsif (/^PGPV=(.*)/) { $pgpv = $1; () } elsif (/^PGPSTYLE=(.*)/) { $pgpstyle = $1; () } else { $_ } } @ARGV; if ($pgps && !$pgpv) { die "Must set PGPV if PGPS is set\n"; } elsif ($pgpv && !$pgps) { die "Must set PGPS if PGPV is set\n"; } # If either PGP or PGPS and PGPV are set, and PGPSTYLE isn't, we try to # figure out PGPSTYLE from the program names. We just base this on the name # of the executable used for signing, which should be reasonably reliable. # If this check fails, people can always set it themselves. Note that this # incorrectly detects PGP v6 as PGP v2; this is based on my assumption that # PGP v2 is still more commonly installed. if ($pgps && !$pgpstyle) { if ($pgps =~ m%pgps[^/]*$%) { $pgpstyle = 'PGP5' } elsif ($pgps =~ m%gpg[^/]*$%) { $pgpstyle = 'GPG' } else { $pgpstyle = 'PGP2' } } # Paranoia. for ($pgps, $pgpv, $pgpstyle) { s/\\/\\\\/g; s/\'/\\\'/g } # If any of these are set, write out the results to paths for makepm.PL to # pick up. if ($pgps) { open (PATHS, '> paths') or die "Can't create file 'paths': $!\n"; print PATHS "# Automatically generated PGP::Sign configuration\n"; print PATHS "\$PGPS = '$pgps';\n"; print PATHS "\$PGPV = '$pgpv';\n"; print PATHS "\$PGPSTYLE = '$pgpstyle';\n"; close PATHS; } # Files that should be removed on make clean, generated by running make test # with various versions of PGP. my @clean = map { 'data/' . $_ } qw(PGPMacBinaryMappings.txt PGPgroup.pgr PGPsdkPreferences pgp.cfg random_seed randseed.bin randseed.rnd pubring-bak-1.pkr secring-bak-1.skr trustdb.gpg); # Now actually build the Makefile. WriteMakefile ( NAME => 'PGP::Sign', DISTNAME => 'PGP-Sign', ($] >= 5.005 ? (ABSTRACT => 'Create and verify PGP/GnuPG signatures, securely', AUTHOR => 'Russ Allbery (rra@stanford.edu)') : ()), PL_FILES => { 'makepm.PL' => 'Sign.pm' }, PM => { 'Sign.pm' => '$(INST_LIBDIR)/Sign.pm' }, VERSION_FROM => 'VERSION.pm', clean => { FILES => "@clean" }, dist => { COMPRESS => 'gzip', SUFFIX => 'gz' }, realclean => { FILES => 'Sign.pm paths' } );