A massive amount of link fixes (just links, almost no rewording)
[dbsrgits/DBIx-Class.git] / Makefile.PL
CommitLineData
fe650234 1use strict;
2use warnings;
3
55087b99 4use 5.008001;
6c96d73f 5use inc::Module::Install 1.06;
90706de1 6BEGIN { makemaker_args( NORECURS => 1 ) } # needs to happen early for old EUMM
ce4c07df 7
d1dc7a98 8##
9## DO NOT USE THIS HACK IN YOUR DISTS!!! (it makes #toolchain sad)
10##
fc4b0448 11# get cpanX --installdeps . to behave in a checkout (most users do not expect
12# the deps for a full test suite run, and if they do - there's MI::AutoInstall
13# for that)
14BEGIN {
15 $Module::Install::AUTHOR = 0 if (grep { $ENV{"PERL5_${_}_IS_RUNNING"} } (qw/CPANM CPANPLUS CPAN/) );
16}
4b5544ad 17
d0435d75 18##
19## TEMPORARY (and non-portable)
20## Get trial SQLA
21##
22BEGIN {
23 my $target_libdir = 'lib/DBIx/Class/_TempExtlib';
24
25 if ( ($Module::Install::AUTHOR or $ENV{TRAVIS}) and ! $ENV{MAKELEVEL} ) {
26
27 `rm -rf $target_libdir`;
28 `mkdir $target_libdir`;
29 for (
30 [ 'SQL-Abstract' => 'master' ],
31 ) {
32 my $tdir = "/tmp/dbictemplib/$_->[0]/";
33
34 `rm -rf $tdir`;
35
36 `GIT_SSH=maint/careless_ssh.bash git clone --bare --quiet --branch=$_->[1] --depth=1 git://git.shadowcat.co.uk/dbsrgits/$_->[0] $tdir`;
37 printf "\nIncluding %s git rev %s\n",
38 $_->[0],
39 scalar `GIT_DIR=$tdir git rev-parse $_->[1]`,
40 ;
41 `git archive --format=tar --remote=file://$tdir $_->[1] lib/ | tar --strip-components=1 -xC $target_libdir`;
42
43 #`rm -rf $tdir`;
44 }
45
46 unshift @INC, $target_libdir;
47
48 no_index directory => $target_libdir;
49 }
50}
51
47589465 52homepage 'http://www.dbix-class.org/';
a89c6a79 53resources 'x_IRC' => 'irc://irc.perl.org/#dbix-class';
54resources 'x_WebIRC' => 'https://chat.mibbit.com/#dbix-class@irc.perl.org';
47589465 55resources 'license' => 'http://dev.perl.org/licenses/';
56resources 'repository' => 'https://github.com/dbsrgits/DBIx-Class';
57resources 'MailingList' => 'http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class';
58resources 'bugtracker' => 'http://rt.cpan.org/NoAuth/Bugs.html?Dist=DBIx-Class';
59
ce4c07df 60name 'DBIx-Class';
b50d0dd3 61perl_version '5.008001';
8e0f16f1 62all_from 'lib/DBIx/Class.pm';
294c1f51 63Meta->{values}{x_authority} = 'cpan:RIBASUSHI';
ce4c07df 64
5b0543d6 65# nothing determined at runtime, except for possibly SQLT dep, see
66# comment further down
67dynamic_config 0;
68
fc4b0448 69tests_recursive (qw|
70 t
71|);
8057ed01 72
fc4b0448 73install_script (qw|
74 script/dbicadmin
75|);
90cfe42b 76
fc4b0448 77###
78### DO NOT ADD OPTIONAL DEPENDENCIES HERE, EVEN AS recommends()
79### All of them *MUST* go to DBIx::Class::Optional::Dependencies
80###
8057ed01 81my $runtime_requires = {
fc4b0448 82 # FIXME - temporary, needs throwing out for something more efficient
83 'Data::Compare' => '1.22',
84
85 # DBI itself should be capable of installation and execution in pure-perl
86 # mode. However it has never been tested yet, so consider XS for the time
87 # being
5342cd1a 88###
89### IMPORTANT - do not raise this dependency
90### even though many bugfixes are present in newer versions, the general DBIC
91### rule is to bend over backwards for available DBI versions (given upgrading
92### them is often *not* easy or even possible)
93###
fc4b0448 94 'DBI' => '1.57',
95
a08e7b00 96 # on older versions first() leaks
97 # for the time being make it a hard dep - when we get
98 # rid of Sub::Name will revisit this (possibility is
99 # to use Devel::HideXS to force the pure-perl version
100 # or something like that)
101 'List::Util' => '1.16',
102
fc4b0448 103 # XS (or XS-dependent) libs
104 'Sub::Name' => '0.04',
105
106 # pure-perl (FatPack-able) libs
f390d66d 107 'Class::Accessor::Grouped' => '0.10010',
9c1700e3 108 'Class::C3::Componentised' => '1.0009',
8057ed01 109 'Class::Inspector' => '1.24',
79680fc0 110 'Config::Any' => '0.20',
111 'Context::Preserve' => '0.01',
2b8cc2f2 112 'Data::Dumper::Concise' => '2.020',
8057ed01 113 'Data::Page' => '2.00',
90fb8e19 114 'Devel::GlobalDestruction' => '0.09',
b8d22f13 115 'Hash::Merge' => '0.12',
c480ff4a 116 'Moo' => '1.004005',
90fb8e19 117 'MRO::Compat' => '0.12',
118 'Module::Find' => '0.07',
119 'namespace::clean' => '0.24',
f4d7449c 120 'Path::Class' => '0.18',
b7b18f32 121 'Scope::Guard' => '0.03',
d0435d75 122 'SQL::Abstract' => '1.78',
90fb8e19 123 'Try::Tiny' => '0.07',
45150bc4 124
125 # Technically this is not a core dependency - it is only required
126 # by the MySQL codepath. However this particular version is bundled
127 # since 5.10.0 and is a pure-perl module anyway - let it slide
128 'Text::Balanced' => '2.00',
fc4b0448 129};
cd122820 130
fc4b0448 131my $build_requires = {
7850f06e 132};
133
134my $test_requires = {
135 'File::Temp' => '0.22',
136 'Test::Deep' => '0.101',
137 'Test::Exception' => '0.31',
138 'Test::Warn' => '0.21',
139 'Test::More' => '0.94',
140
fc4b0448 141 # needed for testing only, not for operation
142 # we will move away from this dep eventually, perhaps to DBD::CSV or something
5342cd1a 143###
144### IMPORTANT - do not raise this dependency
145### even though many bugfixes are present in newer versions, the general DBIC
146### rule is to bend over backwards for available DBDs (given upgrading them is
147### often *not* easy or even possible)
148###
fc4b0448 149 'DBD::SQLite' => '1.29',
fc4b0448 150
151 # this is already a dep of n::c, but just in case - used by t/55namespaces_cleaned.t
152 # remove and do a manual glob-collection if n::c is no longer a dep
153 'Package::Stash' => '0.28',
154};
bb7950c0 155
20beaf5f 156# if the user has this env var set and no SQLT installed, tests will fail
5b0543d6 157# Note - this is added as test_requires *directly*, so it gets properly
158# excluded on META.yml cleansing (even though no dist can be created from this)
20beaf5f 159# we force this req regarless of author_deps, worst case scenario it will
160# be specified twice
5b0543d6 161#
162# also note that we *do* set dynamic_config => 0, as this is the only thing
163# that we determine dynamically, and in all fairness if someone sets the
164# envvar *and* is not running a full Makefile/make/maketest cycle - they get
165# to keep the pieces
20beaf5f 166if ($ENV{DBICTEST_SQLT_DEPLOY}) {
167 local @INC = ('lib', @INC);
168 require DBIx::Class::Optional::Dependencies;
169 my $dep_req = DBIx::Class::Optional::Dependencies->req_list_for('deploy');
170 for (keys %$dep_req) {
171 test_requires ($_ => $dep_req->{$_})
172 }
173}
174
8057ed01 175# this is so we can order requires alphabetically
fc4b0448 176# copies are needed for potential author requires injection
8057ed01 177my $reqs = {
178 build_requires => { %$build_requires },
179 requires => { %$runtime_requires },
180 test_requires => { %$test_requires },
181};
3a4251e2 182
c78f9f5b 183# only do author-includes if not part of a `make` run
184if ($Module::Install::AUTHOR and ! $ENV{MAKELEVEL}) {
ffc55e52 185 invoke_author_mode()
186}
187else {
188 # make sure this Makefile can not be used to make a dist
189 # (without the author includes there are no meta cleanup, no sanity checks, etc)
190 postamble <<EOP;
191create_distdir: nonauthor_stop_distdir_creation
192nonauthor_stop_distdir_creation:
193\t\$(NOECHO) \$(ECHO) Creation of dists in non-author mode is not allowed
194\t\$(NOECHO) \$(FALSE)
195EOP
196}
197
198# compose final req list, for alphabetical ordering
199my %final_req;
200for my $rtype (keys %$reqs) {
201 for my $mod (keys %{$reqs->{$rtype}} ) {
202
203 # sanity check req duplications
204 die "$mod specified as both a '$rtype' and a '$final_req{$mod}[0]'\n"
205 if $final_req{$mod};
206
207 $final_req{$mod} = [ $rtype, $reqs->{$rtype}{$mod}||0 ],
208 }
209}
210
211# actual require
212for my $mod (sort keys %final_req) {
213 my ($rtype, $ver) = @{$final_req{$mod}};
214 no strict 'refs';
215 $rtype->($mod, $ver);
216}
217
218# author-mode or not - this is where we show a list of missing deps
219# IFF we are running interactively
220auto_install();
221
222WriteAll();
223
224exit 0;
225
226# needs to be here to keep 5.8 string eval happy
227# (the include of Makefile.PL.inc loop)
228my $mm_proto;
229
230sub invoke_author_mode {
fc4b0448 231 # get options here, make $args available to all snippets
232 require Getopt::Long;
233 my $getopt = Getopt::Long::Parser->new(
234 config => [qw/gnu_getopt bundling_override no_ignore_case pass_through/]
235 );
236 my $args = {
237 skip_author_deps => undef,
238 };
df65d4da 239 $getopt->getoptions($args, qw/
240 skip_author_deps|skip-author-deps
241 /);
fc4b0448 242 if (@ARGV) {
243 warn "\nIgnoring unrecognized option(s): @ARGV\n\n";
0424d17a 244 }
8057ed01 245
3ba58fe4 246 # We need the MM facilities to generate the pieces for the final MM run.
247 # Just instantiate a throaway object here
6b3e3947 248 #
249 # Also EUMM and MI disagree on what is the format of Meta->name, just
250 # punt here until a new M::I is shipped (if at all)
251 my $name = Meta->name || die 'The Module::Install metadata must be available at this point but is not - did you rearrange the Makefile.PL...?';
252 $name =~ s/\-/::/g;
ffc55e52 253 $mm_proto = ExtUtils::MakeMaker->new({
3054407e 254 NORECURS => 1,
6b3e3947 255 NAME => $name,
3ba58fe4 256 });
257
ffce4b65 258 # Crutch for DISTBUILDING_IN_HELL
259 # Spits back a working dos2unix snippet to be used on the supplied path(s)
260 # Ironically EUMM's dos2unix is broken on win32 itself - it does
261 # not take into account the CRLF layer present on win32
262 my $crlf_fixup = sub {
263 return '' unless ($^O eq 'MSWin32' or $^O eq 'cygwin');
264 my $targets = join ', ', map { "q($_)" } @_;
265 "\t" . $mm_proto->oneliner( qq(\$ENV{PERLIO}='unix' and system( \$^X, qw( -MExtUtils::Command -e dos2unix -- ), $targets ) ) );
266 };
267
e01862e4 268 # we are in the process of (re)writing the makefile - some things we
269 # call below very well may fail
270 local $ENV{DBICTEST_NO_MAKEFILE_VERIFICATION} = 1;
271
fc4b0448 272 require File::Spec;
273 # string-eval, not do(), because we need to provide the
3ba58fe4 274 # $mm_proto, $reqs and $*_requires lexicals to the included file
fc4b0448 275 # (some includes *do* modify $reqs above)
8baa2122 276 for my $inc (sort glob ( File::Spec->catfile('maint', 'Makefile.PL.inc', '*') ) ) {
277 my $src = do { local (@ARGV, $/) = $inc; <> } or die $!;
278 eval "use warnings; use strict; $src" or die sprintf
279 "Failed execution of %s: %s\n",
280 $inc,
281 ($@ || $! || 'Unknown error'),
282 ;
0424d17a 283 }
8057ed01 284}