3 declare canon_name="canon-name/src/canon-name"
4 declare archive="work/archive"
6 if [[ ! -x "$canon_name" ]]; then
7 gmake -f mk/canon-name.mk
9 readonly platform=$("$canon_name")
11 echo "This is build-hc-pkg, running on \"$platform\"."
13 if [[ "$1" = "clean" ]]; then
20 if [[ -e "$archive" ]]; then
21 srcpath=$(cat "$archive")
24 if [[ -z "$srcpath" || ! -e "$srcpath" ]]; then
26 read -e -p "Enter the file path to ghc-x.y.z-src.tar.bz2: " srcpath
27 if [[ -e "$srcpath" ]]; then
29 echo "$srcpath" > "$archive"
31 echo "$srcpath not found." >&2
36 # What's the name of our GNU tar?
38 if which gnutar >/dev/null 2>&1; then
40 elif which gtar >/dev/null 2>&1; then
43 echo "We need GNU tar to be installed." >&2
49 PLATFORM="$platform" \
53 echo "If you are done, run \"$0 clean\" to cleanup the working directory."