aboutsummaryrefslogtreecommitdiffstats
path: root/Makefile.PL
blob: cbcdee50d14c7e0dc6c2a83e28bc120aa8707ada (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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
use strict;
use ExtUtils::MakeMaker;

# where to find the rpm utility

my $rpm_path = $ENV{RPM_PATH}; # this overrides

unless (defined $rpm_path) {
    for (qw(/bin/rpm /usr/bin/rpm)) {
	if (-x) {
	    $rpm_path = $_;
	    last;
	}
    }
}

defined $rpm_path or die "Can't find rpm on this system\n";

my $version = `LC_ALL=C $rpm_path --version`;
$version =~ s/RPM version //;
$version =~ /^(?:4\.[2-9]|[5-9]|\d{2})/ 
    or die "Unable to build URPM with too old (or undetected) rpm version $version\n";

# directory where to build an rpm of this
my $rpmtopdir = `$rpm_path --eval '%{_topdir}'`;
chomp $rpmtopdir;

sub MY::postamble {
    <<"**MM**";
.PHONY: ChangeLog rpmdist srpm rpm

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

rpmdist: dist
	cp -f perl-URPM.spec $rpmtopdir/SPECS
	mv -f URPM-*.tar.bz2 $rpmtopdir/SOURCES

srpm: rpmdist
	rpmbuild -bs --clean --rmsource $rpmtopdir/SPECS/perl-URPM.spec

rpm: rpmdist
	rpmbuild -ba --clean --rmsource $rpmtopdir/SPECS/perl-URPM.spec
**MM**
}

WriteMakefile(
    NAME	=> 'URPM',
    CCFLAGS	=> '-Wall',
    OPTIMIZE	=> '-O3 -fomit-frame-pointer -fno-exceptions -pipe -s -ffast-math -fexpensive-optimizations',
    VERSION_FROM	=> 'URPM.pm',
    LIBS	=> [ '-lrpm -lrpmio -lrpmdb -lpopt -lz -lbz2' ],
    INC		=> '-I/usr/include/rpm',
    dist	=> { COMPRESS => "bzip2", SUFFIX => ".bz2" },
    realclean	=> { FILES => "t/RPMS/noarch/*" },
);