Do not auto-install dist-building dependencies in author mode
[dbsrgits/DBIx-Class.git] / maint / Makefile.PL.inc / 50_redefine_makefile_flow.pl
CommitLineData
a0c96f24 1# Split create_distdir into several subtargets, allowing us to generate
2# stuff, inject it into lib/, manifest it, and then clean all of it up
3{
4 package MY;
5 sub distdir {
6 (my $snippet = shift->SUPER::distdir(@_)) =~ s/^create_distdir :/create_distdir_copy_manifested :/;
7 return <<"EOM";
8$snippet
9
344f1f52 10create_distdir : check_create_distdir_prereqs clonedir_generate_files clonedir_post_generate_files fresh_manifest create_distdir_copy_manifested clonedir_cleanup_generated_files
a0c96f24 11\t\$(NOECHO) \$(NOOP)
12
13clonedir_generate_files :
14\t\$(NOECHO) \$(NOOP)
15
16clonedir_post_generate_files :
17\t\$(NOECHO) \$(NOOP)
18
19clonedir_cleanup_generated_files :
20\t\$(NOECHO) \$(NOOP)
21
344f1f52 22check_create_distdir_prereqs :
23\t\$(NOECHO) @{[
24 $mm_proto->oneliner("DBIx::Class::Optional::Dependencies->die_unless_req_ok_for(q(dist_dir))", [qw/-Ilib -MDBIx::Class::Optional::Dependencies/])
25]}
26
a0c96f24 27EOM
28 }
29}
30
344f1f52 31# add an upload target check as a *preamble*
32# will ensure things being assembled in the right order
33preamble <<"EOP";
34
35upload :: check_create_distdir_prereqs check_upload_dist_prereqs
36
37check_upload_dist_prereqs :
38\t\$(NOECHO) @{[
39 $mm_proto->oneliner("DBIx::Class::Optional::Dependencies->die_unless_req_ok_for(q(dist_upload))", [qw/-Ilib -MDBIx::Class::Optional::Dependencies/])
40]}
41
42EOP
43
a0c96f24 44# EU::MM BUG - workaround
45# somehow the init_PM of EUMM (in MM_Unix) interprets ResultClass.pod.proto
46# as a valid ResultClass.pod. While this has no effect on dist-building
47# it royally screws up the local Makefile.PL $TO_INST_PM and friends,
48# making it impossible to make/make test from a checkout
49# just rip it out here (remember - this is only executed under author mode)
50{
51 package MY;
52 sub init_PM {
53 my $self = shift;
54 my $rv = $self->SUPER::init_PM(@_);
55 delete @{$self->{PM}}{qw(lib/DBIx/Class/Manual/ResultClass.pod lib/DBIx/Class/Manual/ResultClass.pod.proto)};
56 $rv
57 }
58}
59
60# make the install (and friends) target a noop - instead of
61# doing a perl Makefile.PL && make && make install (which will leave pod
62# behind), one ought to assemble a distdir first
63
64{
65 package MY;
66 sub install {
67 (my $snippet = shift->SUPER::install(@_))
68 =~ s/^( (?: install [^\:]+ | \w+_install \s) \:+ )/$1 block_install_from_checkout/mxg;
69 return <<"EOM";
70$snippet
71
72block_install_from_checkout :
73\t\$(NOECHO) \$(ECHO) Installation directly from a checkout is not possible. You need to prepare a distdir, enter it, and run the installation from within.
74\t\$(NOECHO) \$(FALSE)
75
76EOM
77 }
78}
79
80# keep the Makefile.PL eval happy
811;