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/NoAuth/ReportBug.html?Queue=$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",
52 my $len = length $version;
54 die "Invalid perl version";
56 $version .= '0' x (7 - $len);
60 my $versioned_file = File::Spec->catfile('src', $version, $file);
62 return -e $versioned_file ? [ $file => $versioned_file ] : undef;
65 unless (defined versioned_file('regcomp.c')) {
67 This version of perl ($]) is not supported by this version of
68 re::engine::Hooks. If your perl has been recently released,
69 make sure there isn't a newer version of the module available
75 my @DEFINES = qw<-DPERL_EXT_RE_BUILD -DPERL_EXT>;
76 @DEFINES = (DEFINE => join ' ', @DEFINES) if @DEFINES;
78 use ExtUtils::Depends;
80 my $ed = ExtUtils::Depends->new($name);
81 $ed->add_c('regcomp.c');
82 $ed->add_c('regexec.c');
83 $ed->add_xs('Hooks.xs');
84 $ed->add_pm($file => do { local $_ = $file; s/^lib/\$(INST_LIB)/; $_ });
85 $ed->install('re_engine_hooks.h');
86 $ed->save_config('Files.pm');
88 my %ed_vars = $ed->get_makefile_vars;
89 $ed_vars{clean}->{FILES} .= ' ' . join ' ', (
92 qw<*.gcov *.gcda *.gcno cover_db Debian_CPANTS.txt>,
93 qw<regcomp.c regexec.c dquote_static.c inline_invlist.c>,
98 AUTHOR => 'Vincent Pit <perl@profvince.com>',
100 VERSION_FROM => $file,
101 ABSTRACT_FROM => $file,
103 BUILD_REQUIRES => \%BUILD_REQUIRES,
104 PREREQ_PM => \%PREREQ_PM,
105 MIN_PERL_VERSION => '5.010001',
106 META_MERGE => \%META,
108 PREOP => "pod2text $file > \$(DISTVNAME)/README",
109 COMPRESS => 'gzip -9f', SUFFIX => 'gz'
111 XSPROTOARG => '-noprototypes',
114 boot_re__engine__Hooks
121 my $args_dat = './args.dat';
123 open my $fh, '>', $args_dat or die "open(>$args_dat): $!";
126 $arg =~ s{\s*(['"])\s*(.*)\s*\1\s*$}{$2}s;
127 $arg =~ s{([^=/.a-zA-Z0-9-])}{sprintf "[%d]", ord $1}ge;
135 my $regcomp_c = main::versioned_file('regcomp.c');
136 my $regexec_c = main::versioned_file('regexec.c');
137 my $dquote_static_c = main::versioned_file('dquote_static.c');
138 my $inline_invlist_c = main::versioned_file('inline_invlist.c');
140 my @all_c = ($regcomp_c, $regexec_c);
141 my @regcomp_c_deps = ('regcomp.c');
142 my @regexec_c_deps = ('regexec.c');
144 for my $extra_c ($dquote_static_c, $inline_invlist_c) {
145 next unless defined $extra_c;
146 push @all_c, $extra_c;
147 push @regcomp_c_deps, $extra_c->[0];
152 for my $file_c (@all_c) {
153 my ($target_file, $versioned_file) = @$file_c;
155 $target_file : $versioned_file
156 - \$(RM_F) $target_file
157 \$(CP) $versioned_file $target_file
163 regcomp\$(OBJ_EXT) : @regcomp_c_deps
165 regexec\$(OBJ_EXT) : @regexec_c_deps
170 configure_test.pl: args.dat
172 t/re-engine-Hooks-TestDist/Makefile: configure_test.pl
173 $(FULLPERLRUN) configure_test.pl
175 all clean:: t/re-engine-Hooks-TestDist/Makefile
176 cd t/re-engine-Hooks-TestDist && $(MAKE) $@