aboutsummaryrefslogtreecommitdiffstats
path: root/Makefile.PL
blob: 93453b0261610f2eb91e30b4ca8f99d5eceb1238 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
use ExtUtils::MakeMaker;
# See lib/ExtUtils/MakeMaker.pm for details of how to influence
# the contents of the Makefile that is written.

my $version = `rpm -q --qf '%{VERSION}\n' rpm`;
$version =~ /^(?:[4-9]|\d{2})/ or die "unable to build URPM with too old (or undetected) rpm version $version";

#- search for correct libraries to use (above 4.0.3 is right).
my $libs = $version =~ /^4\.0(?:\.[012])?$/ ?
    '-lrpm -lrpmio -lpopt -lz -lbz2' : '-lrpm -lrpmio -lrpmdb -lpopt -lz -lbz2';
my $define = $version =~ /^(?:4\.[2-9]|[5-9]|\d{2})/ ? '-DRPM_42' : '';

WriteMakefile(
    'NAME'      => 'URPM',
    'CCFLAGS'   => '-Wall',
    'OPTIMIZE'  => '-O3 -fomit-frame-pointer -fno-exceptions -fno-rtti -pipe -s -ffast-math -fexpensive-optimizations',
    'MAKEFILE'  => 'Makefile',
    'OBJECT'    => 'URPM.o',
    'VERSION_FROM'   => 'URPM.pm',
    'LIBS'      => [ $libs ],   # e.g., '-lm' 
    'DEFINE'    => $define,
    'INC'       => '-I/usr/include/rpm',     # e.g., '-I/usr/include/other' 
);