aboutsummaryrefslogtreecommitdiffstats
path: root/Makefile.PL
blob: 8e7cb7f0b67e1d0ab8f3e46919aa6fae1dae5c34 (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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# $Id$

use ExtUtils::MakeMaker;
use MDK::Common qw(cat_);

(my $rpmtools_version) = cat_('rpmtools.spec') =~ /define\s+version\s+(\d+\.\d+\.\d+)/
    or die "no version found\n";

my $tag_version = "v$rpmtools_version";
$tag_version =~ s/\./_/g;

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

\$(FROMCC): %: %.cc
	\$(CXX) \$(CCFLAGS) \$(OPTIMIZE) -DVERSION_STRING=\\"\$(RPMTOOLSVERSION)\\" \$< \$(LIBRPM) \$(INCRPM) -o \$@

\$(FROMC): %: %.c
	\$(CC) \$(CCFLAGS) \$(OPTIMIZE) -DVERSION_STRING=\\"\$(RPMTOOLSVERSION)\\" \$< \$(LIBRPM) \$(INCRPM) -o \$@

buildc: \$(FROMC) \$(FROMCC)

cleanc:
	rm -f \$(FROMC) \$(FROMCC)
	rm -rf *.cz test

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

rpm: dist
	rpm --define "_sourcedir `pwd`" -ba --clean --rmsource rpmtools.spec

tag:
	cvs tag $tag_version

MAKEMAKEFILE
}

WriteMakefile(
    NAME	    => 'rpmtools',
    VERSION	    => $rpmtools_version,
    macro => {
        RPMTOOLSVERSION => $rpmtools_version,
        FROMC => 'parsehdlist rpm2header #rpm-find-leaves',
        FROMCC => '#gendepslist2 hdlist2names hdlist2files hdlist2prereq hdlist2groups',
        LIBRPM => '-lrpm -lrpmio -lrpmdb -lrpmbuild -lz -lbz2 -lpopt',
        INCRPM => '-I/usr/include/rpm',
    },
    depend => {
        clean_subdirs => 'cleanc',
        pm_to_blib => 'buildc',
    },
    PM => {
        'Packdrakeng.pm' => '$(INST_LIBDIR)/Packdrakeng.pm',
        'Packdrakeng/zlib.pm' => '$(INST_LIBDIR)/Packdrakeng/zlib.pm',
        'packdrake.pm' => '$(INST_LIBDIR)/packdrake.pm',
        'Distribconf.pm' => '$(INST_LIBDIR)/Distribconf.pm',
        'Distribconf/Build.pm' => '$(INST_LIBDIR)/Distribconf/Build.pm',
    },
    'EXE_FILES' => [ qw(gendistrib genhdlist packdrake rpm2header parsehdlist rpm2cpio.pl dumpdistribconf) ],
    C => [],
    'OBJECT'        => '',
    CCFLAGS	    => '-Wall',
    OPTIMIZE	    => '-O3 -fomit-frame-pointer -fno-exceptions -pipe -s -ffast-math -fexpensive-optimizations',
    INC		    => '',
    LIBS	    => [ '' ],
    INSTALLDIRS	    => 'vendor',
    dist    => {
        COMPRESS => 'bzip2 --best',
        SUFFIX => '.bz2',
    },
);