Cleanup the makefile regen a bit
[dbsrgits/DBIx-Class.git] / Makefile.PL
CommitLineData
4b4f8ae8 1use inc::Module::Install 0.93;
fe650234 2use strict;
3use warnings;
76607ac8 4use POSIX ();
fe650234 5
55087b99 6use 5.008001;
ce4c07df 7
8057ed01 8use FindBin;
9use lib "$FindBin::Bin/lib";
93c50889 10
97f9f16e 11# adjust ENV for $AUTHOR system() calls
12use Config;
13$ENV{PERL5LIB} = join ($Config{path_sep}, @INC);
14
15
4b5544ad 16###
17### DO NOT ADD OPTIONAL DEPENDENCIES HERE, EVEN AS recommends()
18### All of them should go to DBIx::Class::Optional::Dependencies
19###
20
21
ce4c07df 22name 'DBIx-Class';
b50d0dd3 23perl_version '5.008001';
8e0f16f1 24all_from 'lib/DBIx/Class.pm';
ce4c07df 25
8057ed01 26my $build_requires = {
30da8374 27 'DBD::SQLite' => '1.25',
8057ed01 28};
29
30my $test_requires = {
30da8374 31 'File::Temp' => '0.22',
32 'Test::Builder' => '0.33',
33 'Test::Deep' => '0',
34 'Test::Exception' => '0',
35 'Test::More' => '0.92',
36 'Test::Warn' => '0.21',
8057ed01 37};
38
39my $runtime_requires = {
40 # Core
41 'List::Util' => '0',
42 'Scalar::Util' => '0',
43 'Storable' => '0',
44
45 # Dependencies
46 'Carp::Clan' => '6.0',
47 'Class::Accessor::Grouped' => '0.09002',
48 'Class::C3::Componentised' => '1.0005',
49 'Class::Inspector' => '1.24',
50 'Data::Page' => '2.00',
51 'DBI' => '1.609',
8057ed01 52 'MRO::Compat' => '0.09',
53 'Module::Find' => '0.06',
f4d7449c 54 'Path::Class' => '0.18',
8057ed01 55 'Scope::Guard' => '0.03',
56 'SQL::Abstract' => '1.61',
57 'SQL::Abstract::Limit' => '0.13',
58 'Sub::Name' => '0.04',
59 'Data::Dumper::Concise' => '1.000',
60};
61
62# this is so we can order requires alphabetically
63# copies are needed for author requires injection
64my $reqs = {
65 build_requires => { %$build_requires },
66 requires => { %$runtime_requires },
67 test_requires => { %$test_requires },
68};
3a4251e2 69
97f9f16e 70# autogenerate docs and require extra modules for testing if we're in a checkout
8057ed01 71if ($Module::Install::AUTHOR) {
72
73 print "Regenerating README\n";
74 system('pod2text lib/DBIx/Class.pm > README');
97f9f16e 75
8057ed01 76 if (-f 'MANIFEST') {
77 print "Removing MANIFEST\n";
78 unlink 'MANIFEST';
79 }
fe650234 80
97f9f16e 81 print "Regenerating dbicadmin.pod\n";
82 system('perl script/dbicadmin --pod > lib/dbicadmin.pod');
83
f6b26571 84 print "Regenerating Optional/Dependencies.pod\n";
85 require DBIx::Class::Optional::Dependencies;
86 DBIx::Class::Optional::Dependencies->_gen_pod;
87
8057ed01 88# FIXME Disabled due to unsolved issues, ask theorbtwo
89# require Module::Install::Pod::Inherit;
90# PodInherit();
91
92 warn <<'EOW';
93******************************************************************************
94******************************************************************************
95*** ***
96*** AUTHOR MODE: all optional test dependencies converted to hard requires ***
97*** ***
98******************************************************************************
99******************************************************************************
100
101EOW
102
8057ed01 103 $reqs->{test_requires} = {
104 %{$reqs->{test_requires}},
0d4740b3 105 %{DBIx::Class::Optional::Dependencies->_all_optional_requirements},
8057ed01 106 };
107}
108
109# compose final req list, for alphabetical ordering
110my %final_req;
111for my $rtype (keys %$reqs) {
112 for my $mod (keys %{$reqs->{$rtype}} ) {
113
114 # sanity check req duplications
115 if ($final_req{$mod}) {
b718fd0a 116 die "$mod specified as both a '$rtype' and a '$final_req{$mod}[0]'\n";
8057ed01 117 }
118
119 $final_req{$mod} = [ $rtype, $reqs->{$rtype}{$mod}||0 ],
120 }
121}
122
123# actual require
124for my $mod (sort keys %final_req) {
125 my ($rtype, $ver) = @{$final_req{$mod}};
126 no strict 'refs';
127 $rtype->($mod, $ver);
128}
a410299d 129
130install_script (qw|
131 script/dbicadmin
132|);
133
134tests_recursive (qw|
135 t
136|);
137
138resources 'IRC' => 'irc://irc.perl.org/#dbix-class';
139resources 'license' => 'http://dev.perl.org/licenses/';
1d682114 140resources 'repository' => 'http://dev.catalyst.perl.org/repos/bast/DBIx-Class/';
a410299d 141resources 'MailingList' => 'http://lists.scsys.co.uk/cgi-bin/mailman/listinfo/dbix-class';
142
974fe5e8 143# Deprecated/internal modules need no exposure
144no_index directory => $_ for (qw|
145 lib/DBIx/Class/SQLAHacks
281738a4 146 lib/DBIx/Class/PK/Auto
974fe5e8 147|);
148no_index package => $_ for (qw/
149 DBIx::Class::Storage::DBI::AmbiguousGlob
150 DBIx::Class::SQLAHacks DBIx::Class::Storage::DBIHacks
151/);
a410299d 152
269228af 153
7ff18dbd 154auto_install();
09d46657 155
713cc98e 156WriteAll();
09d46657 157
8057ed01 158
80ff5ae0 159# Re-write META.yml to _exclude_ all forced requires (we do not want to ship this)
713cc98e 160if ($Module::Install::AUTHOR) {
713cc98e 161
8057ed01 162 # FIXME test_requires is not yet part of META
163 my %original_build_requires = ( %$build_requires, %$test_requires );
164
165 print "Regenerating META with author requires excluded\n";
281738a4 166 Meta->{values}{build_requires} = [ grep
8057ed01 167 { exists $original_build_requires{$_->[0]} }
168 ( @{Meta->{values}{build_requires}} )
80ff5ae0 169 ];
713cc98e 170
713cc98e 171 Meta->write;
09d46657 172}