]> gitweb @ CieloNegro.org - build-hc-pkg.git/blob - build-hc-pkg
build-hc-pkg seems to be mature now.
[build-hc-pkg.git] / build-hc-pkg
1 #!/usr/bin/env bash
2 set -e
3 declare canon_name="canon-name/src/canon-name"
4 declare archive="work/archive"
5
6 if [[ ! -x "$canon_name" ]]; then
7     gmake -f mk/canon-name.mk
8 fi
9 readonly platform=$("$canon_name")
10
11 echo "This is build-hc-pkg, running on \"$platform\"."
12
13 if [[ "$1" = "clean" ]]; then
14     echo "Cleaning..."
15     rm -rf work
16     exit
17 fi
18
19 declare srcpath=""
20 if [[ -e "$archive" ]]; then
21     srcpath=$(cat "$archive")
22 fi
23
24 if [[ -z "$srcpath" || ! -e "$srcpath" ]]; then
25     mkdir -p work
26     read -e -p "Enter the file path to ghc-x.y.z-src.tar.bz2: " srcpath
27     if [[ -e "$srcpath" ]]; then
28         mkdir -p work
29         echo "$srcpath" > "$archive"
30     else
31         echo "$srcpath not found." >&2
32         exit 1
33     fi
34 fi
35
36 gmake -f mk/main.mk SRCPATH="$srcpath" PLATFORM="$platform" SHELL="$SHELL"
37
38 echo "If you are done, run \"$0 clean\" to cleanup the working directory."