]> git.vpit.fr Git - perl/modules/Scalar-Vec-Util.git/blob - Makefile.PL
Slashes are reserved and hence must be encoded in the search part of an URL
[perl/modules/Scalar-Vec-Util.git] / Makefile.PL
1 use 5.006;
2
3 use strict;
4 use warnings;
5 use ExtUtils::MakeMaker;
6
7 BEGIN {
8  eval { require Config };
9  die 'OS unsupported' if $@;
10  Config->import(qw/%Config/);
11  eval { require File::Spec };
12  die 'OS unsupported' if $@;
13 }
14
15 # Inspired from Module::Install::Can
16 print "Checking for a valid C compiler in the PATH... ";
17 my @ccs = ($Config{cc});
18 unshift @ccs, $ENV{CC} if $ENV{CC};
19 my $cc;
20 CC:
21 for my $c (@ccs) {
22  for my $dir (split /$Config{path_sep}/, $ENV{PATH}) {
23   my $abs = File::Spec->catfile($dir, $c);
24   if (-x $abs or MM->maybe_command($abs)) {
25    $cc = $c;
26    last CC;
27   }
28  }
29 }
30 my @C;
31 if ($cc) {
32  push @C, 'Util.c';
33  print $cc, "\n";
34 } else {
35  print "none\n";
36 }
37
38 my $arch = $Config{archname} || '';
39 my ($cpu) = $arch =~ /^([^-]+)/;
40
41 my @DEFINES;
42 my $unit = 8;
43 if (unpack("h*", pack("s", 0x1234)) != 4321) {
44  print "Forcing unit size of 8 on non-little-endian systems.\n";
45 } else {
46  my $align = int($Config{alignbytes} || 0);
47  print "Checking unit size in bits... ";
48  my @s = (8, 16, 32);
49  push @s, 64 unless $^O eq 'MSWin32';
50  for (@s) {
51   my $size = int($Config{'u' . $_ . 'size'} || 0);
52   $unit = $_ if $size && $size <= $align;
53  }
54  print $unit, "\n";
55 }
56 push @DEFINES, DEFINE => '-DBV_UNIT="'
57                                  . ($unit == 64 ? 'uint64_t' : 'U' . $unit)
58                                  . '"'
59                       . ' -DSVU_SIZE=' . $unit;
60
61 my $dist = 'Scalar-Vec-Util';
62
63 my %META = (
64  configure_requires => {
65   'Config'              => 0,
66   'ExtUtils::MakeMaker' => 0,
67   'File::Spec'          => 0,
68  },
69  build_requires => {
70   'Config'              => 0,
71   'ExtUtils::MakeMaker' => 0,
72   'Test::More'          => 0,
73  },
74  resources => {
75   bugtracker => "http://rt.cpan.org/NoAuth/ReportBug.html?Queue=$dist",
76   homepage   => "http://search.cpan.org/dist/$dist/",
77   license    => 'http://dev.perl.org/licenses/',
78   repository => "http://git.profvince.com/?p=perl%2Fmodules%2F$dist.git",
79  },
80 );
81
82 WriteMakefile(
83     NAME             => 'Scalar::Vec::Util',
84     AUTHOR           => 'Vincent Pit <perl@profvince.com>',
85     LICENSE          => 'perl',
86     VERSION_FROM     => 'lib/Scalar/Vec/Util.pm',
87     ABSTRACT_FROM    => 'lib/Scalar/Vec/Util.pm',
88     PL_FILES         => {},
89     C                => \@C,
90     @DEFINES,
91     PREREQ_PM        => {
92         'Exporter' => 0,
93         'Carp'     => 0,
94         'XSLoader' => 0
95     },
96     MIN_PERL_VERSION => 5.006,
97     META_MERGE       => \%META,
98     dist             => {
99         PREOP    => 'pod2text lib/Scalar/Vec/Util.pm > $(DISTVNAME)/README',
100         COMPRESS => 'gzip -9f', SUFFIX => 'gz'
101     },
102     clean            => {
103         FILES => "$dist-* *.gcov *.gcda *.gcno cover_db Debian_CPANTS.txt"
104     },
105 );
106
107 1;
108
109 package MY;
110
111 sub postamble {
112  my $cv = join ' -coverage ', 'cover',
113                             qw/statement branch condition path subroutine time/;
114  <<POSTAMBLE;
115 cover test_cover:
116         $cv -test
117 POSTAMBLE
118 }