summaryrefslogtreecommitdiffstats
path: root/RPM4/src
diff options
context:
space:
mode:
Diffstat (limited to 'RPM4/src')
-rw-r--r--RPM4/src/Makefile.PL31
1 files changed, 31 insertions, 0 deletions
diff --git a/RPM4/src/Makefile.PL b/RPM4/src/Makefile.PL
index 9b9a60f..fe8fbc0 100644
--- a/RPM4/src/Makefile.PL
+++ b/RPM4/src/Makefile.PL
@@ -2,6 +2,35 @@
# use 5.008;
use ExtUtils::MakeMaker;
+use Getopt::Long;
+
+GetOptions(
+ 'rpmversion=s' => \$rpmv,
+ 'rebuildh' => \my $rebh,
+);
+
+my $rpmv ||= (`rpm --version` =~ /([\d\.]+)/)[0];
+open($FH, "> rpmversion.h") or die "Can't open rpmversion.h";
+print $FH "/* File generated by Mafile.PL\n";
+print $FH ' * $Id$' ."\n";
+print $FH " */\n\n";
+print $FH "#ifndef RPMVERSION_H\n#define RPMVERSION_H\n\n";
+foreach (qw(
+ 4.2.0
+ 4.4.1
+ 4.4.2
+ 4.4.3
+ 4.4.4
+ )) {
+ if ($rpmv ge $_) {
+ $v = $_;
+ $v =~ s/\./_/g;
+ print $FH "#define RPM$v\n";
+ }
+}
+print $FH "\n#endif\n";
+close($FH);
+if ($rebh) { exit 0 };
my ($obj, $ldd, $fl) =
-f '/usr/include/rpmconstant/rpmconstant.h' ?
@@ -10,6 +39,8 @@ my ($obj, $ldd, $fl) =
sub MY::postamble {
my $first = <<RPMCONSTTBL;
+rpmversion.h:
+ \$(PERL) Makefile.PL --rebuildh
rpmconstanttbl.c: Makefile rpmh2tbl
perl rpmh2tbl /usr/include/rpm/*.h > \$@