summaryrefslogtreecommitdiff
blob: 32da029ba2d7b0b96ac7cfa4d31b708fb5190259 (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
#!/usr/bin/perl
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
#
# This Source Code Form is "Incompatible With Secondary Licenses", as
# defined by the Mozilla Public License, v. 2.0.

use 5.10.1;
use strict;
use warnings;

use FindBin qw($RealBin);
use lib ($RealBin, "$RealBin/lib");

use Module::Build 0.36_14;

use Bugzilla::Install::Requirements qw(REQUIRED_MODULES OPTIONAL_MODULES);
use Bugzilla::Constants qw(BUGZILLA_VERSION);

sub requires {
    my $requirements = REQUIRED_MODULES();
    my $hrequires = {};
    foreach my $module (@$requirements) {
        $hrequires->{$module->{module}} = $module->{version};
    }
    return $hrequires;
};

sub build_requires {
    my $brs = requires();
    $brs->{'Module::Build'} = 0;
    return $brs;
}

sub recommends {
    my $recommends = OPTIONAL_MODULES();
    my @blacklist = ('Apache-SizeLimit', 'mod_perl'); # Does not compile properly on Travis
    my $hrecommends = {};
    foreach my $module (@$recommends) {
        next if grep($_ eq $module->{package}, @blacklist);
        $hrecommends->{$module->{module}} = $module->{version};
    }
    return $hrecommends;
}

my $build = Module::Build->new(
    module_name        => 'Bugzilla',
    dist_abstract      => <<END,
Bugzilla is a free bug-tracking system that is developed by an active
community of volunteers. You can install and use it without having to
pay any license fee.
END
    dist_version_from  => 'Bugzilla/Constants.pm',
    dist_version       => BUGZILLA_VERSION,
    requires           => requires(),
    recommends         => recommends(),
    license            => 'Mozilla_2_0',
    create_readme      => 0,
    create_makefile_pl => 0,
    configure_requires => { 'Module::Build' => 0 },
);

$build->create_build_script;