aboutsummaryrefslogtreecommitdiffstats
path: root/Makefile.PL
diff options
context:
space:
mode:
authorThierry Vignaud <thierry.vignaud@gmail.com>2017-10-29 09:01:36 +0100
committerThierry Vignaud <thierry.vignaud@gmail.com>2017-11-06 20:53:39 +0100
commitfb43f786ea2bb06a1a5e3c7629dcf5bbe1270205 (patch)
tree48c8b77f94deeecab2f07141d5339c0497ae41a0 /Makefile.PL
parent9051d2588fcaeccab68f5f74ae0e419fa21c9557 (diff)
downloadperl-URPM-fb43f786ea2bb06a1a5e3c7629dcf5bbe1270205.tar
perl-URPM-fb43f786ea2bb06a1a5e3c7629dcf5bbe1270205.tar.gz
perl-URPM-fb43f786ea2bb06a1a5e3c7629dcf5bbe1270205.tar.bz2
perl-URPM-fb43f786ea2bb06a1a5e3c7629dcf5bbe1270205.tar.xz
perl-URPM-fb43f786ea2bb06a1a5e3c7629dcf5bbe1270205.zip
enable to detect rpm version
(needed for next commit)
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});