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