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";
20 configure_requires => {
21 'ExtUtils::Depends' => 0,
22 'ExtUtils::MakeMaker' => 0,
26 'ExtUtils::Depends' => 0,
27 'ExtUtils::MakeMaker' => 0,
36 bugtracker => "http://rt.cpan.org/NoAuth/ReportBug.html?Queue=$dist",
37 homepage => "http://search.cpan.org/dist/$dist/",
38 license => 'http://dev.perl.org/licenses/',
39 repository => "http://git.profvince.com/?p=perl%2Fmodules%2F$dist.git",
48 my $len = length $version;
50 die "Invalid perl version";
52 $version .= '0' x (7 - $len);
56 my $versioned_file = File::Spec->catfile('src', $version, $file);
58 return -e $versioned_file ? [ $file => $versioned_file ] : undef;
61 unless (defined versioned_file('regcomp.c')) {
63 This version of perl ($]) is not supported by this version of
64 re::engine::Hooks. If your perl has been recently released,
65 make sure there isn't a newer version of the module available
71 my @DEFINES = qw<-DPERL_EXT_RE_BUILD -DPERL_EXT>;
72 @DEFINES = (DEFINE => join ' ', @DEFINES) if @DEFINES;
74 use ExtUtils::Depends;
76 my $ed = ExtUtils::Depends->new($name);
77 $ed->add_c('regcomp.c');
78 $ed->add_c('regexec.c');
79 $ed->add_xs('Hooks.xs');
80 $ed->add_pm($file => do { local $_ = $file; s/^lib/\$(INST_LIB)/; $_ });
81 $ed->install('re_engine_hooks.h');
82 $ed->save_config('Files.pm');
84 my %ed_vars = $ed->get_makefile_vars;
85 $ed_vars{clean}->{FILES} .= ' ' . join ' ', (
88 qw<*.gcov *.gcda *.gcno cover_db Debian_CPANTS.txt>,
89 qw<regcomp.c regexec.c dquote_static.c inline_invlist.c>,
94 AUTHOR => 'Vincent Pit <perl@profvince.com>',
96 VERSION_FROM => $file,
97 ABSTRACT_FROM => $file,
99 PREREQ_PM => \%PREREQ_PM,
100 MIN_PERL_VERSION => '5.010001',
101 META_MERGE => \%META,
103 PREOP => "pod2text $file > \$(DISTVNAME)/README",
104 COMPRESS => 'gzip -9f', SUFFIX => 'gz'
106 XSPROTOARG => '-noprototypes',
109 boot_re__engine__Hooks
116 my $args_dat = './args.dat';
118 open my $fh, '>', $args_dat or die "open(>$args_dat): $!";
121 $arg =~ s{\s*(['"])\s*(.*)\s*\1\s*$}{$2}s;
122 $arg =~ s{([^=/.a-zA-Z0-9-])}{sprintf "[%d]", ord $1}ge;
130 my $regcomp_c = main::versioned_file('regcomp.c');
131 my $regexec_c = main::versioned_file('regexec.c');
132 my $dquote_static_c = main::versioned_file('dquote_static.c');
133 my $inline_invlist_c = main::versioned_file('inline_invlist.c');
135 my @all_c = ($regcomp_c, $regexec_c);
136 my @regcomp_c_deps = ('regcomp.c');
137 my @regexec_c_deps = ('regexec.c');
139 for my $extra_c ($dquote_static_c, $inline_invlist_c) {
140 next unless defined $extra_c;
141 push @all_c, $extra_c;
142 push @regcomp_c_deps, $extra_c->[0];
147 for my $file_c (@all_c) {
148 my ($target_file, $versioned_file) = @$file_c;
150 $target_file : $versioned_file
151 - \$(RM_F) $target_file
152 \$(CP) $versioned_file $target_file
158 regcomp\$(OBJ_EXT) : @regcomp_c_deps
160 regexec\$(OBJ_EXT) : @regexec_c_deps
165 configure_test.pl: args.dat
167 t/re-engine-Hooks-TestDist/Makefile: configure_test.pl
168 $(FULLPERLRUN) configure_test.pl
170 all clean:: t/re-engine-Hooks-TestDist/Makefile
171 cd t/re-engine-Hooks-TestDist && $(MAKE) $@