X-Git-Url: http://git.cielonegro.org/gitweb.cgi?p=build-hc-pkg.git;a=blobdiff_plain;f=build-hc-pkg;fp=build-hc-pkg;h=81dcea4c97ed0650f1ed4cf38c59f4c981e43ef3;hp=0000000000000000000000000000000000000000;hb=2a032631b7bfccfa2044dd50863d0e1c119c8b2e;hpb=7b8684199160e0da113ddeb5a1b13afb5a415d32 diff --git a/build-hc-pkg b/build-hc-pkg new file mode 100755 index 0000000..81dcea4 --- /dev/null +++ b/build-hc-pkg @@ -0,0 +1,38 @@ +#!/usr/bin/env bash +set -e +declare canon_name="canon-name/src/canon-name" +declare archive="work/archive" + +if [[ ! -x "$canon_name" ]]; then + gmake -f mk/canon-name.mk +fi +readonly platform=$("$canon_name") + +echo "This is build-hc-pkg, running on \"$platform\"." + +if [[ "$1" = "clean" ]]; then + echo "Cleaning..." + rm -rf work + exit +fi + +declare srcpath="" +if [[ -e "$archive" ]]; then + srcpath=$(cat "$archive") +fi + +if [[ -z "$srcpath" || ! -e "$srcpath" ]]; then + mkdir -p work + read -e -p "Enter the file path to ghc-x.y.z-src.tar.bz2: " srcpath + if [[ -e "$srcpath" ]]; then + mkdir -p work + echo "$srcpath" > "$archive" + else + echo "$srcpath not found." >&2 + exit 1 + fi +fi + +gmake -f mk/main.mk SRCPATH="$srcpath" PLATFORM="$platform" SHELL="$SHELL" + +echo "If you are done, run \"$0 clean\" to cleanup the working directory."