From f14f74db3b500c14524312c0bb8e9d73c4c52162 Mon Sep 17 00:00:00 2001 From: nanardon Date: Tue, 20 Dec 2005 11:30:54 +0000 Subject: - try to autodetect rpm headers location git-svn-id: svn+ssh://haiku.zarb.org/home/projects/rpm4/svn/trunk@81 971eb68f-4bfb-0310-8326-d2484c010a4c --- RPM4/src/Makefile.PL | 18 ++++++++++++++++-- 1 file 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) }, -- cgit v1.2.1