aboutsummaryrefslogtreecommitdiffstats
path: root/Makefile.PL
diff options
context:
space:
mode:
Diffstat (limited to 'Makefile.PL')
-rwxr-xr-xMakefile.PL18
1 files changed, 17 insertions, 1 deletions
diff --git a/Makefile.PL b/Makefile.PL
index 7530397..f96fa87 100755
--- a/Makefile.PL
+++ b/Makefile.PL
@@ -34,7 +34,23 @@ unless (eval { %cfg = ExtUtils::PkgConfig->find("rpm >= $build_reqs{rpm}"); 1 })
warn "*** Ensure that $rpmdev_pkg is installed\n" . $@;
exit 0;
}
-
+my @rpm_version = split /\./, $cfg{modversion};
+open(my $FH, "> rpmversion.h") or die "Can't open rpmversion.h";
+print $FH "/* File generated by Makefile.PL\n";
+print $FH " */\n\n";
+print $FH "#ifndef RPMVERSION_H\n#define RPMVERSION_H\n\n";
+foreach (qw(
+ 4.12.0
+ 4.13.0
+ 4.14.0
+ )) {
+ my $v = $_;
+ $v =~ s/\./_/g;
+ print $FH "#define RPM$v\n";
+ $cfg{modversion} =~ /^\Q$_/ and last;
+}
+print $FH "\n#endif\n";
+close($FH);
my $ccflags = join(' ', '-Wall -Wextra -fno-strict-aliasing', $cfg{cflags});