5 use ExtUtils::MakeMaker;
7 my $dist = 're-engine-Hooks';
9 (my $name = $dist) =~ s{-}{::}g;
11 (my $file = $dist) =~ s{-}{/}g;
12 $file = "lib/$file.pm";
19 my %BUILD_REQUIRES = (
20 'ExtUtils::Depends' => 0,
21 'ExtUtils::MakeMaker' => 0,
30 configure_requires => {
31 'ExtUtils::Depends' => 0,
32 'ExtUtils::MakeMaker' => 0,
40 bugtracker => "http://rt.cpan.org/Dist/Display.html?Name=$dist",
41 homepage => "http://search.cpan.org/dist/$dist/",
42 license => 'http://dev.perl.org/licenses/',
43 repository => "http://git.profvince.com/?p=perl%2Fmodules%2F$dist.git",
47 my $latest_dev_rev = 19;
49 sub is_outdated_dev_perl {
50 my ($rev) = "$]" =~ /^5\.([0-9]{2}[13579])/;
52 return unless defined $rev;
54 return $rev < $latest_dev_rev;
57 if (is_outdated_dev_perl) {
59 This version of perl ($]) is an outdated development release.
60 re::engine::Hooks supports all stable releases since 5.10.1, and
61 development releases after 5.$latest_dev_rev.0 only. Please consider upgrading
62 your perl to a more recent release.
72 my $len = length $version;
74 die "Invalid perl version";
76 $version .= '0' x (7 - $len);
80 my $versioned_file = File::Spec->catfile('src', $version, $file);
82 return -e $versioned_file ? [ $file => $versioned_file ] : undef;
85 unless (defined versioned_file('regcomp.c')) {
87 This version of perl ($]) is not yet supported by this version of
88 re::engine::Hooks. If your perl has been recently released, make
89 sure there isn't a newer version of the module available on the CPAN.
94 my @DEFINES = qw<-DPERL_EXT_RE_BUILD -DPERL_EXT>;
95 @DEFINES = (DEFINE => join ' ', @DEFINES) if @DEFINES;
97 use ExtUtils::Depends;
99 my $ed = ExtUtils::Depends->new($name);
100 $ed->add_c('regcomp.c');
101 $ed->add_c('regexec.c');
102 $ed->add_xs('Hooks.xs');
103 $ed->add_pm($file => do { local $_ = $file; s/^lib/\$(INST_LIB)/; $_ });
104 $ed->install('re_engine_hooks.h');
105 $ed->save_config('Files.pm');
107 my %ed_vars = $ed->get_makefile_vars;
108 $ed_vars{clean}->{FILES} .= ' ' . join ' ', (
111 qw<*.gcov *.gcda *.gcno cover_db Debian_CPANTS.txt>,
112 qw<regcomp.c regexec.c dquote_static.c inline_invlist.c>,
117 AUTHOR => 'Vincent Pit <perl@profvince.com>',
119 VERSION_FROM => $file,
120 ABSTRACT_FROM => $file,
122 BUILD_REQUIRES => \%BUILD_REQUIRES,
123 PREREQ_PM => \%PREREQ_PM,
124 MIN_PERL_VERSION => '5.010001',
125 META_MERGE => \%META,
127 PREOP => "pod2text -u $file > \$(DISTVNAME)/README",
128 COMPRESS => 'gzip -9f', SUFFIX => 'gz'
130 XSPROTOARG => '-noprototypes',
133 boot_re__engine__Hooks
140 my $args_dat = './args.dat';
142 open my $fh, '>', $args_dat or die "open(>$args_dat): $!";
145 $arg =~ s{\s*(['"])\s*(.*)\s*\1\s*$}{$2}s;
146 $arg =~ s{([^=/.a-zA-Z0-9-])}{sprintf "[%d]", ord $1}ge;
154 my $regcomp_c = main::versioned_file('regcomp.c');
155 my $regexec_c = main::versioned_file('regexec.c');
156 my $dquote_static_c = main::versioned_file('dquote_static.c');
157 my $inline_invlist_c = main::versioned_file('inline_invlist.c');
159 my @all_c = ($regcomp_c, $regexec_c);
160 my @regcomp_c_deps = ('regcomp.c');
161 my @regexec_c_deps = ('regexec.c');
163 for my $extra_c ($dquote_static_c, $inline_invlist_c) {
164 next unless defined $extra_c;
165 push @all_c, $extra_c;
166 push @regcomp_c_deps, $extra_c->[0];
171 for my $file_c (@all_c) {
172 my ($target_file, $versioned_file) = @$file_c;
174 $target_file : $versioned_file
175 - \$(RM_F) $target_file
176 \$(CP) $versioned_file $target_file
182 regcomp\$(OBJ_EXT) : @regcomp_c_deps
184 regexec\$(OBJ_EXT) : @regexec_c_deps
189 configure_test.pl: args.dat
191 t/re-engine-Hooks-TestDist/Makefile: configure_test.pl
192 $(FULLPERLRUN) configure_test.pl
194 all clean:: t/re-engine-Hooks-TestDist/Makefile
195 cd t/re-engine-Hooks-TestDist && $(MAKE) $@