]> git.vpit.fr Git - perl/modules/Sub-Op.git/blob - Makefile.PL
9ad9836d4af634f6deff20b71b4853e841b138ac
[perl/modules/Sub-Op.git] / Makefile.PL
1 use 5.010;
2
3 use strict;
4 use warnings;
5 use ExtUtils::MakeMaker;
6
7 my $dist = 'Sub-Op';
8
9 (my $name = $dist) =~ s{-}{::}g;
10
11 (my $file = $dist) =~ s{-}{/}g;
12 $file = "lib/$file.pm";
13
14 my %PREREQ_PM = (
15  'B::Hooks::EndOfScope' => 0,
16  'DynaLoader'           => 0,
17  'Scalar::Util'         => 0,
18  'Variable::Magic'      => '0.40',
19 );
20
21 my %META = (
22  configure_requires => {
23   'ExtUtils::Depends'   => 0,
24   'ExtUtils::MakeMaker' => 0,
25  },
26  build_requires => {
27   'Cwd'                 => 0,
28   'ExtUtils::Depends'   => 0,
29   'ExtUtils::MakeMaker' => 0,
30   'File::Spec'          => 0,
31   'POSIX'               => 0,
32   'Test::More'          => 0,
33   'blib'                => 0,
34   %PREREQ_PM,
35  },
36  dynamic_config => 1,
37  resources => {
38   bugtracker => "http://rt.cpan.org/NoAuth/ReportBug.html?Queue=$dist",
39   homepage   => "http://search.cpan.org/dist/$dist/",
40   license    => 'http://dev.perl.org/licenses/',
41   repository => "http://git.profvince.com/?p=perl%2Fmodules%2F$dist.git",
42  },
43 );
44
45 use ExtUtils::Depends;
46
47 my $ed = ExtUtils::Depends->new($name);
48 $ed->add_xs('Op.xs');
49 $ed->add_pm($file => do { local $_ = $file; s/^lib/\$(INST_LIB)/; $_ });
50 $ed->install('sub_op.h');
51 $ed->save_config('Files.pm');
52
53 my %ed_vars = $ed->get_makefile_vars;
54 $ed_vars{clean}->{FILES} .= ' ' . join ' ',
55       "$dist-*",
56       'Files.pm',
57       qw{*.gcov *.gcda *.gcno cover_db Debian_CPANTS.txt};
58
59 WriteMakefile(
60  NAME             => $name,
61  AUTHOR           => 'Vincent Pit <perl@profvince.com>',
62  LICENSE          => 'perl',
63  VERSION_FROM     => $file,
64  ABSTRACT_FROM    => $file,
65  PL_FILES         => {},
66  PREREQ_PM        => \%PREREQ_PM,
67  MIN_PERL_VERSION => 5.010,
68  META_MERGE       => \%META,
69  dist             => {
70   PREOP    => "pod2text $file > \$(DISTVNAME)/README",
71   COMPRESS => 'gzip -9f', SUFFIX => 'gz'
72  },
73  FUNCLIST         => [ qw/sub_op_register boot_Sub__Op/ ],
74  %ed_vars,
75 );
76
77 {
78  my $args_dat = './args.dat';
79
80  open my $fh, '>', $args_dat or die "open(>$args_dat): $!";
81  for (@ARGV) {
82   my $arg = $_;
83   $arg =~ s{\s*(['"])\s*(.*)\s*\1\s*$}{$2}s;
84   $arg =~ s{([^=/.a-zA-Z0-9-])}{sprintf "[%d]", ord $1}ge;
85   print $fh "$arg\n";
86  }
87 }
88
89 sub MY::postamble {
90  <<' POSTAMBLE';
91 configure_test.pl: args.dat
92
93 t/Sub-Op-LexicalSub/Makefile: configure_test.pl
94         $(FULLPERLRUN) configure_test.pl
95
96 all clean:: t/Sub-Op-LexicalSub/Makefile
97         cd t/Sub-Op-LexicalSub && $(MAKE) $@
98
99 clean::
100         $(RM_RF) args.dat
101  POSTAMBLE
102 }