Merge branch 'master' into topic/constructor_rewrite
[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
552b624d 27EOM
28 }
29}
30
31# M::I inserts its own default postamble, so we can't easily override upload
32# but we can still hook postamble in EU::MM
33{
34 package MY;
35
36 sub postamble {
37 my $snippet = shift->SUPER::postamble(@_);
38 return <<"EOM";
39$snippet
40
344f1f52 41upload :: check_create_distdir_prereqs check_upload_dist_prereqs
42
43check_upload_dist_prereqs :
44\t\$(NOECHO) @{[
45 $mm_proto->oneliner("DBIx::Class::Optional::Dependencies->die_unless_req_ok_for(q(dist_upload))", [qw/-Ilib -MDBIx::Class::Optional::Dependencies/])
46]}
47
1b6cbedd 48EOM
49 }
50}
344f1f52 51
a0c96f24 52# EU::MM BUG - workaround
53# somehow the init_PM of EUMM (in MM_Unix) interprets ResultClass.pod.proto
54# as a valid ResultClass.pod. While this has no effect on dist-building
55# it royally screws up the local Makefile.PL $TO_INST_PM and friends,
56# making it impossible to make/make test from a checkout
57# just rip it out here (remember - this is only executed under author mode)
58{
59 package MY;
60 sub init_PM {
61 my $self = shift;
62 my $rv = $self->SUPER::init_PM(@_);
63 delete @{$self->{PM}}{qw(lib/DBIx/Class/Manual/ResultClass.pod lib/DBIx/Class/Manual/ResultClass.pod.proto)};
64 $rv
65 }
66}
67
68# make the install (and friends) target a noop - instead of
69# doing a perl Makefile.PL && make && make install (which will leave pod
70# behind), one ought to assemble a distdir first
71
72{
73 package MY;
74 sub install {
75 (my $snippet = shift->SUPER::install(@_))
76 =~ s/^( (?: install [^\:]+ | \w+_install \s) \:+ )/$1 block_install_from_checkout/mxg;
77 return <<"EOM";
78$snippet
79
80block_install_from_checkout :
81\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.
82\t\$(NOECHO) \$(FALSE)
83
84EOM
85 }
86}
87
88# keep the Makefile.PL eval happy
891;