| 1 | #!/usr/bin/env perl | ||||||||||
| 2 | # Thanks to App::cpanminus | ||||||||||
| 3 | # See: https://github.com/miyagawa/cpanminus.git:script/build.PL | ||||||||||
| 4 | 1 | ▶ | use English; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | |||||||||||
| 6 | 1 | my $baseDir = '.'; | |||||||||
| 7 | 1 | ▶ | if (scalar(@ARGV) > 0) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 8 | 1 | $baseDir = $ARGV[0]; | |||||||||
| 9 | } | ||||||||||
| 10 | |||||||||||
| 11 | # build/cmddirs.PL is the command-line framework (option parsing, etc.) | ||||||||||
| 12 | 1 | ▶ | open my $in, "<", "build/cmddirs.PL" or die $!; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 13 | # The fatpacked binary we are building | ||||||||||
| 14 | 1 | ▶ | open my $out, ">", "$baseDir/cmddirs.tmp" or die $!; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 15 | |||||||||||
| 16 | 1 | print STDERR "Generating cmddirs from script/cmddirs.PL\n"; | |||||||||
| 17 | |||||||||||
| 18 | # FatPacker wants it's lib | ||||||||||
| 19 | 1 | mkdir "fatlib"; | |||||||||
| 20 | 1 | ▶ | while (<$in>) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 21 | # Remove & replace things from bin/cmddirs.PL | ||||||||||
| 22 | 90 | ▶ | next if /Auto-removed/; | ||||||||
|
Branch: 1 branch
| |||||||||||
| 23 | 88 | s/DEVELOPERS:.*/DO NOT EDIT -- this is an auto generated file/; | |||||||||
| 24 | 88 | s/.*__FATPACK__/`$EXECUTABLE_NAME -e "use App::FatPacker -run_script" file`/e; | |||||||||
| 25 | 88 | print $out $_; | |||||||||
| 26 | } | ||||||||||
| 27 | |||||||||||
| 28 | 1 | close $out; | |||||||||
| 29 | |||||||||||
| 30 | # Cleanup, make our fatpacked binary executable | ||||||||||
| 31 | 1 | unlink "$baseDir/cmddirs"; | |||||||||
| 32 | 1 | rename "$baseDir/cmddirs.tmp", "$baseDir/cmddirs"; | |||||||||
| 33 | 1 | chmod 0755, "$baseDir/cmddirs"; | |||||||||
| 34 | |||||||||||
| 35 | 1 | ▶ | END { unlink "$baseDir/cmddirs.tmp" } | ||||||||
|
Subroutine
END: called CC=1 SCAR=0.0
| |||||||||||