summaryrefslogtreecommitdiffstats
path: root/Makefile.PL
diff options
context:
space:
mode:
authorDylan William Hardison <dylan@hardison.net>2016-07-01 05:32:40 +0200
committerDylan William Hardison <dylan@hardison.net>2016-09-12 19:03:27 +0200
commite6bf4cacb10f86077fe898349485f5c7ab9fb4b6 (patch)
tree24a4973f71f38e0cd7788a25817142ab6c05ed3e /Makefile.PL
parent591e2dabe136e9a9190f3a67c89349cb794ae9a9 (diff)
downloadbugzilla-e6bf4cacb10f86077fe898349485f5c7ab9fb4b6.tar.gz
bugzilla-e6bf4cacb10f86077fe898349485f5c7ab9fb4b6.tar.xz
Bug 1283930 - Add Makefile.PL & local/lib/perl5 support to bmo/master + local symlink to data/ directory
Diffstat (limited to 'Makefile.PL')
-rw-r--r--Makefile.PL387
1 files changed, 387 insertions, 0 deletions
diff --git a/Makefile.PL b/Makefile.PL
new file mode 100644
index 000000000..3d6857bc3
--- /dev/null
+++ b/Makefile.PL
@@ -0,0 +1,387 @@
+#!/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.
+
+# This file has detailed POD docs, do "perldoc checksetup.pl" to see them.
+
+######################################################################
+# Initialization
+######################################################################
+
+use 5.10.1;
+use strict;
+use warnings;
+use lib qw(. lib local/lib/perl5);
+
+use ExtUtils::MakeMaker 6.55;
+use constant BUGZILLA_VERSION => $ENV{BUGZILLA_VERSION} // 42;
+use File::Basename;
+use File::Spec;
+
+# META.json and META.yml exist only for the benefit of older
+# installs where cpanm can't get the optional features out of Makefile.PL
+# Unfortunately having META.json and META.yml commited to the repo is weird
+# and MakeMaker always prefers their content to the internal data (unless CPAN::META
+# is not installed).
+# Since we (Bugzilla) require this cludge, we hide the files from MakeMaker.
+BEGIN {
+ warn "Hiding META.{json,yml} from MakeMaker...\n";
+ rename( 'META.json', 'META.json.hide' ) || unlink("META.json");
+ rename( 'META.yml', 'META.yml.hide' ) || unlink("META.yml");
+
+ if (!eval { ExtUtils::MakeMaker->VERSION('6.57_07') }) {
+ warn "WARNING: ExtUtils::MakeMaker should be at least 6.57_07 in order to support updating META.json files\n";
+ }
+}
+
+END {
+ warn "Unhiding META.{json,yml}...\n";
+ rename( 'META.json.hide', 'META.json' );
+ rename( 'META.yml.hide', 'META.yml' );
+}
+
+# PREREQ_PM
+my %requires = (
+ 'CGI' => '3.51',
+ 'DBI' => '1.614',
+ 'Date::Format' => '2.23',
+ 'DateTime' => '0.75',
+ 'DateTime::TimeZone' => '1.64',
+ 'Digest::SHA' => 0,
+ 'Email::MIME' => '1.904',
+ 'Email::Send' => '1.911',
+ 'File::Slurp' => '9999.13',
+ 'JSON::XS' => '2.01',
+ 'List::MoreUtils' => '0.22',
+ 'Math::Random::ISAAC' => '1.0.1',
+ 'Template' => '2.24',
+ 'URI' => '1.55',
+ 'version' => '0.87',
+ 'Parse::CPAN::Meta' => '1.44',
+ 'CPAN::Meta::Prereqs' => '2.132830',
+ 'CPAN::Meta::Requirements' => '2.121',
+ 'Module::Metadata' => '1.000033',
+ 'Module::Runtime' => 0,
+);
+my %build_requires = (
+ 'ExtUtils::MakeMaker' => '6.57_07',
+);
+my %test_requires = (
+ 'Test::More' => 0,
+ 'Pod::Coverage' => 0,
+ 'Test::WWW::Selenium' => 0.
+);
+my %recommends = ( Safe => '2.30' );
+
+# Windows requires some additional modules.
+if ( $^O eq 'MSWin32' ) {
+ $requires{'Win32'} = '0.35';
+ $requires{'Win32::API'} = '0.55';
+ $requires{'DateTime::TimeZone::Local::Win32'} = '1.64';
+}
+
+my %optional_features = (
+ smtp_auth => {
+ prereqs => { runtime => { requires => { 'Authen::SASL' => 0 } } },
+ description => 'SMTP Authentication'
+ },
+ detect_charset => {
+ prereqs => {
+ runtime =>
+ { requires => { 'Encode::Detect' => 0, Encode => '2.21' } }
+ },
+ description => 'Automatic charset detection for text attachments'
+ },
+ new_charts => {
+ description => 'New Charts',
+ prereqs => {
+ runtime =>
+ { requires => { 'Chart::Lines' => 'v2.4.10', GD => '1.20' } }
+ }
+ },
+ html_desc => {
+ description => 'More HTML in Product/Group Descriptions',
+ prereqs => {
+ runtime => {
+ requires =>
+ { 'HTML::Parser' => '3.67', 'HTML::Scrubber' => 0 }
+ }
+ }
+ },
+ pg => {
+ prereqs => { runtime => { requires => { 'DBD::Pg' => 'v2.19.3' } } },
+ description => 'Postgres database support'
+ },
+ memcached => {
+ description => 'Memcached Support',
+ prereqs => {
+ runtime => { requires => { 'Cache::Memcached' => '0.17' } }
+ }
+ },
+ auth_delegation => {
+ description => 'Auth Delegation',
+ prereqs => { runtime => { requires => { 'LWP::UserAgent' => 0 } } }
+ },
+ updates => {
+ description => 'Automatic Update Notifications',
+ prereqs => {
+ runtime =>
+ { requires => { 'LWP::UserAgent' => 0, 'XML::Twig' => 0 } }
+ }
+ },
+ auth_radius => {
+ description => 'RADIUS Authentication',
+ prereqs => { runtime => { requires => { 'Authen::Radius' => 0 } } }
+ },
+ documentation => {
+ prereqs => {
+ runtime => {
+ requires =>
+ { 'File::Which' => 0, 'File::Copy::Recursive' => 0 }
+ }
+ },
+ description => 'Documentation',
+ },
+ xmlrpc => {
+ description => 'XML-RPC Interface',
+ prereqs => {
+ runtime => {
+ requires => {
+ 'XMLRPC::Lite' => '0.712',
+ 'SOAP::Lite' => '0.712',
+ 'Test::Taint' => '1.06'
+ }
+ }
+ }
+ },
+ auth_ldap => {
+ prereqs => { runtime => { requires => { 'Net::LDAP' => 0 } } },
+ description => 'LDAP Authentication'
+ },
+ old_charts => {
+ prereqs => {
+ runtime =>
+ { requires => { GD => '1.20', 'Chart::Lines' => 'v2.4.10' } }
+ },
+ description => 'Old Charts'
+ },
+ moving => {
+ prereqs => {
+ runtime => {
+ requires => { 'MIME::Parser' => '5.406', 'XML::Twig' => 0 }
+ }
+ },
+ description => 'Move Bugs Between Installations'
+ },
+ oracle => {
+ description => 'Oracle database support',
+ prereqs => { runtime => { requires => { 'DBD::Oracle' => '1.19' } } }
+ },
+ typesniffer => {
+ prereqs => {
+ runtime => {
+ requires =>
+ { 'IO::Scalar' => 0, 'File::MimeInfo::Magic' => 0 }
+ }
+ },
+ description => 'Sniff MIME type of attachments'
+ },
+ sqlite => {
+ prereqs => { runtime => { requires => { 'DBD::SQLite' => '1.29' } } },
+ description => 'SQLite database support'
+ },
+ mysql => {
+ description => 'MySQL database support',
+ prereqs => { runtime => { requires => { 'DBD::mysql' => '4.001' } } }
+ },
+ jsonrpc => {
+ description => 'JSON-RPC Interface',
+ prereqs => {
+ runtime =>
+ { requires => { 'JSON::RPC' => 0, 'Test::Taint' => '1.06' } }
+ }
+ },
+ graphical_reports => {
+ description => 'Graphical Reports',
+ prereqs => {
+ runtime => {
+ requires => {
+ 'GD::Text' => 0,
+ 'Template::Plugin::GD::Image' => 0,
+ 'GD::Graph' => 0,
+ GD => '1.20',
+ }
+ }
+ }
+ },
+ mfa => {
+ description => 'Multi-Factor Authentication',
+ prereqs => {
+ runtime => {
+ requires => {
+ 'Auth::GoogleAuth' => '1.01',
+ 'GD::Barcode::QRcode' => '0',
+ },
+ }
+ },
+ },
+ mod_perl => {
+ description => 'mod_perl support under Apache',
+ prereqs => {
+ runtime => {
+ requires => {
+ 'mod_perl2' => '1.999022',
+ 'Apache2::SizeLimit' => '0.96',
+ }
+ }
+ }
+ },
+ inbound_email => {
+ prereqs => {
+ runtime => {
+ requires => {
+ 'Email::MIME::Attachment::Stripper' => 0,
+ 'Email::Reply' => 0,
+ }
+ }
+ },
+ description => 'Inbound Email'
+ },
+ patch_viewer => {
+ description => 'Patch Viewer',
+ prereqs => { runtime => { requires => { PatchReader => '0.9.6' } } }
+ },
+ rest => {
+ description => 'REST Interface',
+ prereqs => {
+ runtime => {
+ requires => {
+ 'Test::Taint' => '1.06',
+ 'JSON::RPC' => 0,
+ }
+ }
+ }
+ },
+ jobqueue => {
+ description => 'Mail Queueing',
+ prereqs => {
+ runtime => {
+ requires => { TheSchwartz => '1.10', 'Daemon::Generic' => 0 }
+ }
+ }
+ },
+);
+
+for my $file ( glob("extensions/*/Config.pm") ) {
+ my $dir = dirname($file);
+ my $name = basename($dir);
+
+ next if -f File::Spec->catfile( $dir, "disabled" );
+ require $file;
+ my $class = "Bugzilla::Extension::$name";
+ if ( $class->can("REQUIRED_MODULES") ) {
+ foreach my $required_module ( @{ $class->REQUIRED_MODULES() } ) {
+ $requires{ $required_module->{module} }
+ = $required_module->{version};
+ }
+ }
+
+ if ( $class->can('OPTIONAL_MODULES') ) {
+ my $default_feature = 'extension_' . lc($name) . '_optional';
+ foreach my $mod ( @{ $class->OPTIONAL_MODULES } ) {
+ my @features
+ = $mod->{feature} ? @{ $mod->{feature} } : ($default_feature);
+ foreach my $feature (@features) {
+ $optional_features{$feature}{prereqs}{runtime}{requires}
+ { $mod->{module} } = $mod->{version} // 0;
+ }
+ }
+ }
+}
+
+# BMO Customization
+my @bmo_features = grep {
+ !m{
+ ^
+ (?: pg
+ | oracle
+ | mod_perl
+ | sqlite
+ | auth_ldap
+ | auth_radius
+ | smtp_auth
+ | updates)
+ $
+ }mxs;
+} keys %optional_features;
+
+$optional_features{bmo} = {
+ description => 'features that bmo needs',
+ prereqs => {
+ runtime => {
+ requires => {
+ map { %{$optional_features{$_}{prereqs}{runtime}{requires}} } @bmo_features
+ },
+ },
+ },
+};
+
+WriteMakefile(
+ NAME => 'Bugzilla',
+ AUTHOR => q{Bugzilla Developers <developers@bugzilla.org>},
+ VERSION => BUGZILLA_VERSION,
+ ABSTRACT => 'Bugzilla Bug Tracking System',
+ LICENSE => 'Mozilla_2_0',
+ MIN_PERL_VERSION => '5.10.1',
+ CONFIGURE_REQUIRES => { 'ExtUtils::MakeMaker' => $build_requires{'ExtUtils::MakeMaker'} },
+ PREREQ_PM => { %requires },
+ BUILD_REQUIRES => { %build_requires },
+ TEST_REQUIRES => { %test_requires },
+ META_MERGE => {
+ "meta-spec" => {
+ url => "http://search.cpan.org/perldoc?CPAN::Meta::Spec",
+ version => "2"
+ },
+ dynamic_config => 1,
+ prereqs => {
+ build => { requires => { %build_requires } },
+ runtime => { requires => { %requires }, recommends => { %recommends } },
+ test => { requires => { %test_requires } },
+ },
+ optional_features => \%optional_features,
+ },
+);
+
+sub MY::postamble {
+ my $modules = join(' ',
+ qw(
+ CPAN::Meta
+ CPAN::Meta::Requirements
+ Parse::CPAN::Meta
+ Module::Metadata
+ )
+ );
+ return <<MAKE;
+GEN_CPANFILE_ARGS = -A -U mod_perl -U oracle
+cpanfile: MYMETA.json
+\t\$(PERLRUN) gen-cpanfile.pl \$(GEN_CPANFILE_ARGS)
+
+checksetup_lib: Makefile.PL
+\tcpanm -l .checksetup_lib $modules
+\t-rm -fr .checksetup_lib/man
+\t-rm -fr .checksetup_lib/lib/perl5/*/.meta
+\t-rm -fr .checksetup_lib/lib/perl5/Test
+\t-rm -fr .checksetup_lib/lib/perl5/ok.pm
+\t-find .checksetup_lib '(' -name '*.pod' -or -name .packlist ')' -print0 | xargs -0 rm -f
+
+META.json: Makefile.PL
+\tmake distmeta 2>&1 /dev/null; mv */META.json .
+
+META.yml: Makefile.PL
+\tmake distmeta 2>&1 /dev/null; mv */META.yml .
+MAKE
+}