#!/bin/sh set -euC help_text= help_text="$help_text build\t[]\t\n" dev_config () { mkdir -p blib ./configure -e extractrs -d blib/ } help_text="$help_text unconfigure\t[]\tresets the build\n" unconfigure () { ninja -t clean || true rm build.ninja lib/JWebmail/Config.pm rm -r blib } help_text="$help_text srcdist\t[]\tcreate a source distribution\n" srcdist () { if tar --version | head -n1 | grep -q GNU then tar --posix -czf JWebmail-srcdist.tgz -T MANIFEST else xargs tar -czf JWebmail-srcdist.tgz l(' '{}' '+' find templates -name '*.html.ep' -exec grep "l[ (][\"']" '{}' '+' else p1="$(find lib -name '*.pm' -exec grep '\->l(' '{}' '+' | sed 's/^\(\S*\):.*->l(\([^)]*\)).*$/\1: \2/')" p2="$(find templates -name '*.html.ep' -exec grep "l[ (][\"']" '{}' '+' | sed "s/^\\(\\S*\\):.*l[ (][\"']\\([^\"']*\\)[\"'].*$/\\1: '\\2'/")" echo "$(echo "$p1"; echo "$p2")" | sort | uniq fi } help () { echo "The following actions are available:" echo printf "$help_text\n" | expand -t 21,41 } cmd=${1-help} [ $# -gt 0 ] && shift if LANG=C type "$cmd" 2>/dev/null | grep -q 'function$' then $cmd "$@" else echo "unkown commad '$cmd'" >&2; exit 1 fi