You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 

36 lines
1.0 KiB

#!/usr/bin/env bash
# bin/compile BUILD_DIR CACHE_DIR
set -e
source $(dirname $0)/../scripts/functions
BUILD_DIR=$1
echo "Info: BUILD_DIR=$BUILD_DIR"
CACHE_DIR=$2
echo "Info: CACHE_DIR=$CACHE_DIR"
## CHECK BUILDPACK_GHC_BASE_URL is set
if [ "$BUILDPACK_GHC_BASE_URL" != "" ]; then
arch=$(uname -m)
ghcver=$GHC_BOOTSTRAP_VERSION
if [ "$ghcver" == "" ]; then
echo "Error: please set GHC_BOOTSTRAP_VERSION";
exit 1;
fi;
bsdir=$CACHE_DIR/bootstrap
ghcurl="$BUILDPACK_GHC_BASE_URL/$ghcver/ghc-$ghcver-$arch-unknown-linux.tar.bz2"
echo "Info: bootstrap directory: ${bsdir}";
echo "Info: bootstrap URL: $ghcurl";
if [ -f "$bsdir.completed" ]; then
echo "Info: already downloaded GHC bootstrap version ${ghcver}";
else
echo "Info: downloading GHC $ghcver form $ghcurl";
$(downloadAndExtract $bsdir $ghcurl);
$(configureMakeInstall $bsdir/ghc-$ghcver $BUILD_DIR/bootstrap/ghc-$ghcver);
touch $bsdir.completed
fi;
else
echo "Error: please set BUILDPACK_GHC_BASE_URL";
exit 1;
fi