While permanentising meta/ 62628242 did not properly noindex it
[dbsrgits/DBIx-Class.git] / Makefile.PL
1 use strict;
2 use warnings;
3
4 use 5.008001;
5 use inc::Module::Install 1.06;
6
7 ##
8 ## DO NOT USE THIS HACK IN YOUR DISTS!!! (it makes #toolchain sad)
9 ##
10 # get cpanX --installdeps . to behave in a checkout (most users do not expect
11 # the deps for a full test suite run, and if they do - there's MI::AutoInstall
12 # for that)
13 BEGIN {
14   $Module::Install::AUTHOR = 0 if (grep { $ENV{"PERL5_${_}_IS_RUNNING"} } (qw/CPANM CPANPLUS CPAN/) );
15 }
16
17 name     'DBIx-Class';
18 perl_version '5.008001';
19 all_from 'lib/DBIx/Class.pm';
20 Meta->{values}{x_authority} = 'cpan:RIBASUSHI';
21
22 tests_recursive (qw|
23     t
24 |);
25
26 install_script (qw|
27     script/dbicadmin
28 |);
29
30 homepage 'http://www.dbix-class.org/';
31 resources 'IRC'         => 'irc://irc.perl.org/#dbix-class';
32 resources 'license'     => 'http://dev.perl.org/licenses/';
33 resources 'repository'  => 'https://github.com/dbsrgits/DBIx-Class';
34 resources 'MailingList' => 'http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class';
35 resources 'bugtracker'  => 'http://rt.cpan.org/NoAuth/Bugs.html?Dist=DBIx-Class';
36
37 ###
38 ### DO NOT ADD OPTIONAL DEPENDENCIES HERE, EVEN AS recommends()
39 ### All of them *MUST* go to DBIx::Class::Optional::Dependencies
40 ###
41 my $runtime_requires = {
42   # FIXME - temporary, needs throwing out for something more efficient
43   'Data::Compare'            => '1.22',
44
45   # DBI itself should be capable of installation and execution in pure-perl
46   # mode. However it has never been tested yet, so consider XS for the time
47   # being
48   'DBI'                      => '1.57',
49
50   # XS (or XS-dependent) libs
51   'Sub::Name'                => '0.04',
52
53   # pure-perl (FatPack-able) libs
54   'Class::Accessor::Grouped' => '0.10007',
55   'Class::C3::Componentised' => '1.0009',
56   'Class::Inspector'         => '1.24',
57   'Config::Any'              => '0.20',
58   'Context::Preserve'        => '0.01',
59   'Data::Dumper::Concise'    => '2.020',
60   'Data::Page'               => '2.00',
61   'Devel::GlobalDestruction' => '0',
62   'Hash::Merge'              => '0.12',
63   'Moo'                      => '1.000006',
64   'MRO::Compat'              => '0.09',
65   'Module::Find'             => '0.06',
66   'namespace::clean'         => '0.20',
67   'Path::Class'              => '0.18',
68   'Scope::Guard'             => '0.03',
69   'SQL::Abstract'            => '1.73',
70   'Try::Tiny'                => '0.04',
71
72   # dual-life corelibs needing a specific bugfixed version
73   'File::Path'               => '2.07',
74 };
75
76 my $build_requires = {
77   # needed for testing only, not for operation
78   # we will move away from this dep eventually, perhaps to DBD::CSV or something
79   'DBD::SQLite'              => '1.29',
80 };
81
82 my $test_requires = {
83   'File::Temp'               => '0.22',
84   'Test::Exception'          => '0.31',
85   'Test::Warn'               => '0.21',
86   'Test::More'               => '0.94',
87   # not sure if this is necessary at all, ask schwern some day
88   'Test::Builder'            => '0.94',
89
90   # this is already a dep of n::c, but just in case - used by t/55namespaces_cleaned.t
91   # remove and do a manual glob-collection if n::c is no longer a dep
92   'Package::Stash'           => '0.28',
93 };
94
95 # make strictures.pm happy (DO NOT LIKE, TOO MUCH XS!)
96 # (i.e. what if the .git/.svn is *not* because of DBIC?)
97 #
98 # Note - this is added as test_requires *directly*, so it gets properly
99 # excluded on META.yml cleansing
100 if (-e '.git' or -e '.svn') {
101   test_requires 'indirect'              => '0.25';
102   test_requires 'multidimensional'      => '0.008';
103   test_requires 'bareword::filehandles' => '0.003';
104 }
105
106 # if the user has this env var set and no SQLT installed, tests will fail
107 # same rationale for direct test_requires as the strictures stuff above
108 # (even though no dist will be created from this)
109 # we force this req regarless of author_deps, worst case scenario it will
110 # be specified twice
111 if ($ENV{DBICTEST_SQLT_DEPLOY}) {
112   local @INC = ('lib', @INC);
113   require DBIx::Class::Optional::Dependencies;
114   my $dep_req = DBIx::Class::Optional::Dependencies->req_list_for('deploy');
115   for (keys %$dep_req) {
116     test_requires ($_ => $dep_req->{$_})
117   }
118 }
119
120 # this is so we can order requires alphabetically
121 # copies are needed for potential author requires injection
122 my $reqs = {
123   build_requires => { %$build_requires },
124   requires => { %$runtime_requires },
125   test_requires => { %$test_requires },
126 };
127
128 # only do author-includes if not part of a `make` run
129 if ($Module::Install::AUTHOR  and ! $ENV{MAKELEVEL}) {
130   # get options here, make $args available to all snippets
131   require Getopt::Long;
132   my $getopt = Getopt::Long::Parser->new(
133     config => [qw/gnu_getopt bundling_override no_ignore_case pass_through/]
134   );
135   my $args = {
136     skip_author_deps => undef,
137   };
138   $getopt->getoptions($args, qw/
139     skip_author_deps|skip-author-deps
140   /);
141   if (@ARGV) {
142     warn "\nIgnoring unrecognized option(s): @ARGV\n\n";
143   }
144
145   require File::Spec;
146   # string-eval, not do(), because we need to provide the
147   # $reqs and $*_requires lexicals to the included file
148   # (some includes *do* modify $reqs above)
149   for my $inc (sort glob ( File::Spec->catfile('maint', 'Makefile.PL.inc', '*') ) ) {
150     my $src = do { local (@ARGV, $/) = $inc; <> } or die $!;
151     eval "use warnings; use strict; $src" or die sprintf
152       "Failed execution of %s: %s\n",
153       $inc,
154       ($@ || $! || 'Unknown error'),
155     ;
156   }
157 }
158 else {
159   # make sure this Makefile can not be used to make a dist
160   # (without the author includes there are no meta cleanup, no sanity checks, etc)
161   postamble <<EOP;
162 .PHONY: nonauthor_stop_distdir_creation
163 create_distdir: nonauthor_stop_distdir_creation
164 nonauthor_stop_distdir_creation:
165 \t\$(NOECHO) \$(ECHO) Creation of dists in non-author mode is not allowed
166 \t\$(NOECHO) \$(FALSE)
167 EOP
168 }
169
170 # compose final req list, for alphabetical ordering
171 my %final_req;
172 for my $rtype (keys %$reqs) {
173   for my $mod (keys %{$reqs->{$rtype}} ) {
174
175     # sanity check req duplications
176     if ($final_req{$mod}) {
177       die "$mod specified as both a '$rtype' and a '$final_req{$mod}[0]'\n";
178     }
179
180     $final_req{$mod} = [ $rtype, $reqs->{$rtype}{$mod}||0 ],
181   }
182 }
183
184 # actual require
185 for my $mod (sort keys %final_req) {
186   my ($rtype, $ver) = @{$final_req{$mod}};
187   no strict 'refs';
188   $rtype->($mod, $ver);
189 }
190
191 # author-mode or not - this is where we show a list of missing deps
192 # IFF we are running interactively
193 auto_install();
194
195 WriteAll();