Apache-Reload

 view release on metacpan or  search on metacpan

Makefile.PL  view on Meta::CPAN

use strict;

use lib qw(lib);
use Config;
use Symbol qw(gensym);

my %prereqs = ();
my %mp2 = ( mod_perl2 => 1.99022 );
my %mp1 = ( mod_perl  => 0 );
my $at_min_ver = 1.34;

my $mp_gen;
# MOD_PERL_2_BUILD is set from building from mod_perl Makefile.PL which should
# also set MP_APXS
if ($ENV{MOD_PERL_2_BUILD}) {
    push @ARGV, "-apxs", $ENV{MP_APXS};
    $mp_gen = satisfy_mp_generation(2);
}
else {
    $mp_gen = satisfy_mp_generation();
}

%prereqs = ($mp_gen == 1 ? %mp1 : %mp2);

my $HAS_APACHE_TEST = check_for_apache_test();

my $VERSION;
set_apache_reload_version();

my %common_opts = (
                   VERSION         => $VERSION,
                   PREREQ_PM       => \%prereqs,
                   dist            => {
                       COMPRESS => 'gzip -9f', SUFFIX => 'gz',
                       PREOP   => 'find $(DISTVNAME) -type d -print|xargs chmod 0755 && ' .
                                  'find $(DISTVNAME) -type f -print|xargs chmod 0644',
                       TO_UNIX => 'find $(DISTVNAME) -type f -print|xargs dos2unix'
                   },
                   clean           => { FILES => 't/TEST' },
                  );

### MAINTAINER_BUILDING_RELEASE is hack
### for the Release Manager's use only.
### We will set it so that the resulting
### distribution will be called Apache-Reload-\d+.tar.gz
### and NOT Apache2-Reload-\d+.tar.gz
### This is for historical reasons and consistency
if ($mp_gen == 1 || $ENV{MAINTAINER_BUILDING_RELEASE}) {
    require ExtUtils::MakeMaker;
    ExtUtils::MakeMaker::WriteMakefile(
                                       %common_opts,
                                       NAME            => "Apache::Reload",
                                       ABSTRACT_FROM   => 'lib/Apache/Reload.pm',
                                      );

}
else {
    require ModPerl::MM;
    ModPerl::MM::WriteMakefile(
                               %common_opts,
                               NAME            => "Apache2::Reload",
                               ABSTRACT_FROM   => 'lib/Apache2/Reload.pm',
                              );
}

sub check_for_apache_test {
    return unless eval {
        require Apache::Test;
        if ($Apache::Test::VERSION < $at_min_ver) {
            die "Apache::Test version is " . $Apache::Test::VERSION . 
                ", minimum version required is $at_min_ver" . 
                ", tests will be skipped\n";
        }
        require Apache::TestMM;
        require Apache::TestRunPerl;
        1;
    };

    Apache::TestMM::filter_args();

    my %args = @Apache::TestMM::Argv;

    Apache::TestRunPerl->generate_script();

    return 1;
}

sub set_apache_reload_version {
    require Apache::Reload;
    $VERSION = $Apache::Reload::VERSION;

    my $fh = Symbol::gensym();
    open $fh, 'Changes' or die "Can't open Changes: $!";
    while (<$fh>) {
        if(/^=item.*-(dev|rc\d+)/) {
            $VERSION .= "-$1";
            last;



( run in 0.551 second using v1.01-cache-2.11-cpan-39bf76dae61 )