Skip to content

Instantly share code, notes, and snippets.

@arodland
Created March 9, 2018 21:17
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save arodland/a502601ee88c345c3990c969432d5568 to your computer and use it in GitHub Desktop.
Save arodland/a502601ee88c345c3990c969432d5568 to your computer and use it in GitHub Desktop.
#!/bin/sh
export PERL_USE_UNSAFE_INC=1
# Pull cpm from github. There will now be a fatpacked binary in cpm/cpm.
git submodule update --init
perl cpm/cpm install -L local --target-perl 5.14.0 --with-develop --without-test || exit 1
export PERL5LIB=$PWD/lib:$PWD/local/lib/perl5
export PATH=$PWD/local/bin:$PATH
export PERL_JSON_BACKEND=JSON::PP
export B_HOOKS_ENDOFSCOPE_IMPLEMENTATION=PP
export PACKAGE_STASH_IMPLEMENTATION=PP
export PARAMS_VALIDATE_IMPLEMENTATION=PP
export LIST_MOREUTILS_PP=1
export MOO_XS_DISABLE=1
perl -c trailbreaker.pl || exit 1
trap 'rm -rf .build fatlib fatpacker.trace fatpacker.trace.bak packlists' EXIT
fatpack trace trailbreaker.pl || exit 1
fatpack packlists-for $(cat fatpacker.trace) > packlists || exit 1
fatpack tree $(cat packlists) || exit 1
# Copy in the app libs
cp -r lib/* fatlib
# Sometimes arch stuff ends up in the trace despite our best efforts, but if we
# did our job right then the modules will work even without it (and might break
# on a different arch with it). So nuke it all.
rm -rf fatlib/$(perl -MConfig -e 'print $Config{archname}')
# Delete stuff that takes up space and makes perlstrip whine
find fatlib -name \*.pod -delete
find fatlib -name \*.pl -delete
find fatlib -type f -exec perlstrip {} +
fatpack file trailbreaker.pl > trailbreaker
# Add the config file
echo '__DATA__' >> trailbreaker
cat default_config.yaml >> trailbreaker
chmod +x trailbreaker
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment