summaryrefslogtreecommitdiffstats
path: root/RPM4
diff options
context:
space:
mode:
Diffstat (limited to 'RPM4')
-rw-r--r--RPM4/src/Makefile.PL18
1 files changed, 16 insertions, 2 deletions
diff --git a/RPM4/src/Makefile.PL b/RPM4/src/Makefile.PL
index e01eade..133464d 100644
--- a/RPM4/src/Makefile.PL
+++ b/RPM4/src/Makefile.PL
@@ -9,6 +9,20 @@ GetOptions(
'rebuildh' => \my $rebh,
);
+my $rpmheaderlocation;
+
+foreach (qw(
+ /usr/include
+ /usr/local/include
+ )) {
+ if (-d "$_/rpm") {
+ $rpmheaderlocation = "$_/rpm";
+ last;
+ }
+}
+
+$rpmheaderlocation or die "Can't find rpmheader location";
+
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";
@@ -50,7 +64,7 @@ rpmversion.h:
\$(PERL) Makefile.PL --rebuildh
rpmconstanttbl.c: Makefile rpmh2tbl
- perl rpmh2tbl /usr/include/rpm/*.h > \$@
+ perl rpmh2tbl $rpmheaderlocation/*.h > \$@
RPMCONSTTBL
# This code is to reduce duplication of files
@@ -71,7 +85,7 @@ WriteMakefile(
NAME => 'RPM4',
VERSION_FROM => '../lib/RPM4.pm',
OBJECT => "RPM4.o RPM4sign.o $obj",
- INC => '-I/usr/include/rpm',
+ INC => "-I$rpmheaderlocation",
LIBS => "-lrpm -lrpmio -lrpmdb -lrpmbuild -lpopt -lz -lbz2 $ldd",
'CCFLAGS' => $fl,
depend => { "RPM4.xs" => join(" ", @rpmconstantfiles) },