File: Makefile.PL

package info (click to toggle)
rapache 1.2.10-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 6,368 kB
  • sloc: sh: 18,629; ansic: 10,417; perl: 5,675; javascript: 2,800; makefile: 307
file content (74 lines) | stat: -rw-r--r-- 2,155 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
require 5.006;
use strict;
use warnings;

use Getopt::Long qw(GetOptions);
use Config;

use constant PERL_PATH => $Config{perlpath}; # XXX
use constant WIN32 => ($^O =~ /Win32/);

sub test_prereq {
    system (PERL_PATH, "build/version_check.pl", @_) == 0
        or warn "Please upgrade $_[0] first.\n";
}

test_prereq perl => PERL_PATH;

my %opts;
undef @opts{qw(with-apache2-apxs with-apache1-apxs with-apache2-src
               with-perl with-apache2-httpd
               with-apr-config with-apu-config apxs)};
undef $opts{'with-apache2'} if (WIN32);

my @flags = qw/enable-maintainer-mode enable-perl-glue disable-perl-glue/;
my %args;
# grab from @ARGV only the options that we expect
GetOptions(\%args, (map "$_=s", keys %opts), @flags);

$args{"with-perl"} = PERL_PATH;
my $opts = "";
$opts .= "--enable-maintainer-mode " if $args{"enable-maintainer-mode"};

unless (exists $args{"disable-perl-glue"}) {
    $opts .= "--enable-perl-glue ";
    test_prereq "mod_perl";
    test_prereq "Apache::Test";
    test_prereq "ExtUtils::MakeMaker";
    test_prereq "ExtUtils::XSBuilder";
    test_prereq "Test::More";
}

delete @args{@flags};
$args{"with-apache2-apxs"} = delete $args{apxs}
    if exists $args{apxs} and not exists $args{"with-apache2-apxs"};

$args{"with-perl-opts"} = "@ARGV" if @ARGV;

if (WIN32) {
    require File::Basename;
    unless ($args{'with-apache2'}) {
        my @candidates = qw(with-apache2-apxs with-apache2-httpd
                            with-apr-config with-apu-config);
        foreach my $opt(@candidates) {
            next unless $args{$opt};
            (my $d = File::Basename::dirname($args{$opt})) =~ s{(\\|/)bin}{};
            if (-d $d) {
                delete $args{$opt};
                $args{'with-apache2'} = $d;
                last;
            }
        }
    }
    my @opts = map{qq/--$_="$args{$_}"/} keys %args;
    my @args = (PERL_PATH, 'win32/Configure.pl', @opts);
    print "@args\n";
    system(@args) == 0 or die "system @args failed: $?";
}
else {
    $opts .= join " ", map {qq/--$_="$args{$_}"/} keys %args;

    my $cmd = "./configure $opts";
    print "$cmd\n";
    exec  $cmd;
}