aboutsummaryrefslogtreecommitdiffstats
path: root/Makefile.PL
blob: 6ef07f249b4d677b031234f1b96b3e2baded940f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
use ExtUtils::MakeMaker;

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

#- 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' : '';

sub MY::postamble {
    <<MAKECHANGELOG;
.PHONY: ChangeLog

ChangeLog:
	cvs2cl -W 400 -I ChangeLog --accum -U ../common/username
	rm -f *.bak
MAKECHANGELOG
}

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