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