App-GitFind

 view release on metacpan or  search on metacpan

Makefile.PL  view on Meta::CPAN

my $IS_TRIAL = check_trial();
my $secure_perl_path = get_perl_filename();
my @provides = ();

# yapp-generated command-line parser
my $CMDLINE_FROM = File::Spec->catfile(qw(support cmdline.yp));
my $CMDLINE_TO = File::Spec->catfile(qw(lib App GitFind cmdline.pm));
my $CMDLINE_DIR = File::Spec->catfile(qw(lib App GitFind));

# Check if this is a TRIAL version {{{1
sub check_trial {
    TRIAL: {
        # Get the VERSION line
        open my $fd, '<', $VERSION_FROM or last TRIAL;
        my $linetext;
        while(<$fd>) {
            next unless /VERSION/;
            $linetext = $_;
            last;
        }
        close $fd;
        return !!($linetext =~ /\bTRIAL\b/);
    }
    return 0;
} #check_trial()

# }}}1
# Module metadata {{{1
eval {
    require Module::Metadata;
    @provides =
        (provides => Module::Metadata->provides(version => '2', dir => 'lib'));
        # Thanks to https://stackoverflow.com/a/28928985/2877364 by LEONT
        # for suggesting Module::Metadata.
};

# }}}1
# Get the filename of the Perl interpreter running this. {{{1
# Modified from perlvar.
# The -x test is for cygwin or other systems where $Config{perlpath} has no
# extension and $Config{_exe} is nonempty.  E.g., symlink perl->perl5.10.1.exe.
# There is no "perl.exe" on such a system.
sub get_perl_filename {
    my $secure_perl_path = $Config{perlpath};
    if ($^O ne 'VMS') {
        $secure_perl_path .= $Config{_exe}
            unless (-x $secure_perl_path) ||
                            ($secure_perl_path =~ m/$Config{_exe}$/i);
    }
    return $secure_perl_path;
} # get_perl_filename()

# }}}1
# Makefile customization (MY) {{{1
{   package MY;

    # dist_core: make `dist` a :: target rather than a : target,
    # and add distcheck and yapp before dist.
    sub dist_core {
        my $self = shift;
        my $text = $self->SUPER::dist_core(@_);
        $text =~ s/^dist\h*:[^:]/dist:: distcheck $CMDLINE_TO /m;

        return $text;
    } # MY::dist_core

    # Generate README.md; add uninstall target and other test targets
    sub postamble {     # TODO also handle Windows nmake syntax (SET vs. export)

        # Note: pod2markdown is marked with a hyphen so that `make` can
        # succeed and generate META files even if Pod::Markdown is not yet
        # installed.

        my $make_readme_md = File::Spec->catfile(qw(support readme.pl));
        return <<EOT;

# Convenience target to run yapp
yapp: $CMDLINE_TO

# Convenience target to run cover
cover:
\tcover +ignore 'lib/perl5/' -test

$CMDLINE_TO: $CMDLINE_FROM
\t-mkdir "$CMDLINE_DIR"
\tyapp -m "App::GitFind::cmdline" -o "\$@" "\$<"

authortest:
\tRELEASE_TESTING=1 prove -lvj4 xt

testhere:   # Run the tests from lib rather than blib
\tprove -lj4

README.md: $SCRIPT Makefile.PL $make_readme_md
\t-"$secure_perl_path" "$make_readme_md" -i "\$<" -o "\$@" -f md

README: $SCRIPT Makefile.PL $make_readme_md
\t-"$secure_perl_path" "$make_readme_md" -i "\$<" -o "\$@" -f text

# The following command line is rather bizarre so that it can be run on
# bash or cmd.  '\$\$' collapses to a single dollar sign, and the string eval
# is used to separate the dollar signs from the variable names so they will
# not trigger shell interpolation.  Double-quotes only, for compatibility
# with cmd, and no embedded double quotes (q() or qq() instead).

#git-find.packed.pl: $VERSION_FROM $SCRIPT Makefile.PL $CMDLINE_TO
#\t"$secure_perl_path" -Ilib -MApp::FatPacker -MConfig -e "eval q(\$\$) . q(ENV{PERL5LIB}=join \$\$) . q(Config{path_sep}, \@INC;); App::FatPacker->new->run_script([q(pack), q($SCRIPT)])" > "\$@"

all :: README.md README #git-find.packed.pl
dist :: README.md README #git-find.packed.pl

# Uninstallation: mimic what the normal "uninstall" target does, but actually
# carry out the actions.
# Note: this may leave empty directories in place, since the packlist only
# includes files.

ACTUALLY_UNINSTALL = "$secure_perl_path" -MExtUtils::Install -e 'uninstall(shift,1)' --

actually_uninstall :: actually_uninstall_from_\$(INSTALLDIRS)dirs
\t\$(NOECHO) \$(NOOP)



( run in 0.463 second using v1.01-cache-2.11-cpan-8f98c5d2c55 )