diff options
author | nanardon <nanardon@971eb68f-4bfb-0310-8326-d2484c010a4c> | 2005-12-14 16:59:25 +0000 |
---|---|---|
committer | nanardon <nanardon@971eb68f-4bfb-0310-8326-d2484c010a4c> | 2005-12-14 16:59:25 +0000 |
commit | ba6046b0f441d1c3edc0281dfa146cc4037958dc (patch) | |
tree | 84166640cea4f8905caa430d1f0e48f1ddb505d5 | |
parent | ab03f85de55c81bfe44e7ef587db20f98183e872 (diff) | |
download | perl-RPM4-ba6046b0f441d1c3edc0281dfa146cc4037958dc.tar perl-RPM4-ba6046b0f441d1c3edc0281dfa146cc4037958dc.tar.gz perl-RPM4-ba6046b0f441d1c3edc0281dfa146cc4037958dc.tar.bz2 perl-RPM4-ba6046b0f441d1c3edc0281dfa146cc4037958dc.tar.xz perl-RPM4-ba6046b0f441d1c3edc0281dfa146cc4037958dc.zip |
- generate a .h to find what rpm can do
git-svn-id: svn+ssh://haiku.zarb.org/home/projects/rpm4/svn/trunk@51 971eb68f-4bfb-0310-8326-d2484c010a4c
-rw-r--r-- | RPM4/src/Makefile.PL | 31 |
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 > \$@ |