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