aboutsummaryrefslogtreecommitdiffstats
path: root/Makefile.PL
blob: 0b03aa23b590034e9fbc18aa6165583841fffdc7 (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
use strict;
use ExtUtils::MakeMaker;
use ExtUtils::PkgConfig;

# minimum required version of dependencies we need to build
our %build_reqs = (
	'rpm' => '4.12.0',
);
our %CONFIGURE_REQUIRES = (
	'ExtUtils::Depends'   => '0.300',
	'ExtUtils::MakeMaker' => '6.64',
	'ExtUtils::PkgConfig' => '1.00', # for finding rpm-devel
);

# Writing a fake Makefile ensures that CPAN will pick up the correct
# dependencies and install them.
unless (eval "use ExtUtils::Depends '$CONFIGURE_REQUIRES{'ExtUtils::Depends'}';"
           . "use ExtUtils::PkgConfig '$CONFIGURE_REQUIRES{'ExtUtils::PkgConfig'}';"
           . "1") {
   warn "$@\n";
   WriteMakefile(
         NAME         => 'URPM',
         PREREQ_FATAL => 1,
         PREREQ_PM    => \%CONFIGURE_REQUIRES,
   );
   exit 1; # not reached
}

my %cfg;
unless (eval { %cfg = ExtUtils::PkgConfig->find("rpm >= $build_reqs{rpm}"); 1 })
{
	warn $@;
	exit 0;
}


my $ccflags = join(' ', '-Wall -Wextra -fno-strict-aliasing');

print "Found RPM version $cfg{modversion} (compiling with flags: $ccflags)\n";

WriteMakefile(
    NAME	=> 'URPM',
    ABSTRACT_FROM => 'URPM.pm',
    AUTHOR	=> 'Thierry Vignaud',
    LICENSE     => 'perl_5',
    CONFIGURE_REQUIRES => \%CONFIGURE_REQUIRES,
    PREREQ_PM	=> {
	'MDV::Packdrakeng' => '1.00', # for URPM::Build
    },
    'TEST_REQUIRES' => {
	'Test::Pod' => '1.00',
    },
    META_MERGE => {
	'meta-spec' => { version => 2 },
        resources => {
            repository  => {
		type => 'git',
		url => 'git://git.mageia.org/software/rpm/perl-URPM/',
		web =>  'http://gitweb.mageia.org/software/rpm/perl-URPM/',
	    },
        },
	release_status => 'stable'
    },
    MIN_PERL_VERSION => '5.008001',
    CCFLAGS	=> $ccflags,
    VERSION_FROM	=> 'URPM.pm',
    LIBS	=> [ $cfg{libs} . ' -lrpmbuild' ],
    INC		=> '-I/usr/include/rpm',
    dist	=> { COMPRESS => "xz -f", SUFFIX => ".xz" },
    realclean	=> { FILES => "t/RPMS/noarch/*" },
);