File: Makefile.PL

package info (click to toggle)
libdate-simple-perl 3.0300-2
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 188 kB
  • sloc: perl: 570; makefile: 3
file content (44 lines) | stat: -rwxr-xr-x 1,225 bytes parent folder | download | duplicates (5)
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
use ExtUtils::MakeMaker;

$xs = 1;
@noxs = ();
if (@ARGV && $ARGV[0] eq 'noxs') {
    shift (@ARGV);
    print "Disabling XS code.\n";
    # Attempt to disable the C code in three ways, since MakeMaker
    # documentation is unclear.  Set 'XS' to an empty hash.  Set 'C'
    # to an empty array.  As a last resort, strip Simple.* from
    # the constants section.
    # XXX Maybe it would be more robust to simply delete or disguise
    # Simple.xs.  But normally packages don't modify their own files.
    $xs = 0;
    @noxs = ('XS' => {}, 'C' => []);
}
else {
    print "Enabling XS code.\n";
    print "If you get errors, run `make distclean'\n";
    print "and try again using `perl Makefile.PL noxs'.\n";
}

WriteMakefile(
    'NAME'		=> 'Date::Simple',
    'VERSION_FROM'	=> 'lib/Date/Simple.pm',
    'PREREQ_PM'		=> {
                            'Test::More'   => undef,
                            'Scalar::Util' => undef,
                           },
    @noxs,
);

package MY;

sub constants {
    my ($self) = @_;
    my $ret = $self->SUPER::constants;
    unless ($::xs) {
    	$ret =~ s/Simple.(pm|pod)/SimpleFoo.$1/g;
    	$ret =~ s/Simple\.\S+//gs;
    	$ret =~ s/SimpleFoo/Simple/g;
    }
    return $ret;
}