Make pod generation more palatable to the existing toolchain
[dbsrgits/DBIx-Class.git] / maint / Makefile.PL.inc / 50_redefine_makefile_flow.pl
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
10 create_distdir : clonedir_generate_files clonedir_post_generate_files fresh_manifest create_distdir_copy_manifested clonedir_cleanup_generated_files
11 \t\$(NOECHO) \$(NOOP)
12
13 clonedir_generate_files :
14 \t\$(NOECHO) \$(NOOP)
15
16 clonedir_post_generate_files :
17 \t\$(NOECHO) \$(NOOP)
18
19 clonedir_cleanup_generated_files :
20 \t\$(NOECHO) \$(NOOP)
21
22 EOM
23   }
24 }
25
26 # EU::MM BUG - workaround
27 # somehow the init_PM of EUMM (in MM_Unix) interprets ResultClass.pod.proto
28 # as a valid ResultClass.pod. While this has no effect on dist-building
29 # it royally screws up the local Makefile.PL $TO_INST_PM and friends,
30 # making it impossible to make/make test from a checkout
31 # just rip it out here (remember - this is only executed under author mode)
32 {
33   package MY;
34   sub init_PM {
35     my $self = shift;
36     my $rv = $self->SUPER::init_PM(@_);
37     delete @{$self->{PM}}{qw(lib/DBIx/Class/Manual/ResultClass.pod lib/DBIx/Class/Manual/ResultClass.pod.proto)};
38     $rv
39   }
40 }
41
42 # make the install (and friends) target a noop - instead of
43 # doing a perl Makefile.PL && make && make install (which will leave pod
44 # behind), one ought to assemble a distdir first
45
46 {
47   package MY;
48   sub install {
49     (my $snippet = shift->SUPER::install(@_))
50       =~ s/^( (?: install [^\:]+ | \w+_install \s) \:+ )/$1 block_install_from_checkout/mxg;
51     return <<"EOM";
52 $snippet
53
54 block_install_from_checkout :
55 \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.
56 \t\$(NOECHO) \$(FALSE)
57
58 EOM
59   }
60 }
61
62 # keep the Makefile.PL eval happy
63 1;