DFLTARCHS="\"x86_64\""
RUN_HAKE="Yes"
+TOOLCHAIN="ubuntu"
+HAKEDIR=$(dirname $0)
usage() {
echo "Usage: $0 <options>"
echo " $DFLTARCHS"
echo " -n|--no-hake: just rebuild hake itself, don't run it (only useful"
echo " for debugging hake)"
+ echo " -t|--toolchain: toolchain to use when bootstrapping a new"
+ echo " build tree (-t list for available options)."
echo ""
echo " The way you use this script is to create a new directory for your"
echo " build tree, cd into it, and run this script with the --source-dir"
exit 1;
}
+toolchains() {
+ TOOLCHAINS=$(ls ${HAKEDIR}/Config.hs.* | sed s/.*Config\.hs\.//)
+ echo "Available toolchains:"
+ for tc in ${TOOLCHAINS}; do
+ echo " $tc"
+ done
+ exit 1
+}
+
#
# Legacy compatibility to avoid breaking the harness...
#
case $1 in
"-a"|"--architecture")
if [ -z "$NEWARCHS" ] ; then
- NEWARCHS="\"$2\""
+ NEWARCHS="\"$2\""
else
- NEWARCHS="$NEWARCHS, \"$2\""
+ NEWARCHS="$NEWARCHS, \"$2\""
fi
+ shift
;;
"-i"|"--install-dir")
INSTALLDIR="$2"
+ shift
;;
"-s"|"--source-dir")
SRCDIR="$2"
+ shift
;;
"-n"|"--no-hake")
RUN_HAKE="No"
;;
+ "-t"|"--toolchain")
+ TOOLCHAIN="$2"
+ shift
+ if [ "${TOOLCHAIN}" == "list" ]; then
+ toolchains
+ fi
+ if [ ! -f ${HAKEDIR}/Config.hs.${TOOLCHAIN} ]; then
+ echo "Unknown toolchain \"${TOOLCHAIN}\""
+ exit 1
+ fi
+ ;;
*)
usage
;;
esac
- shift
shift
done
echo "Setting up hake build directory..."
if [ ! -f hake/Config.hs ]; then
- cp $SRCDIR/hake/Config.hs.template hake/Config.hs
+ echo "Bootstrapping with toolchain \"${TOOLCHAIN}\""
+ cp $SRCDIR/hake/Config.hs.${TOOLCHAIN} hake/Config.hs
cat >> hake/Config.hs <<EOF
-- Automatically added by hake.sh. Do NOT copy these definitions to the defaults
echo "Building hake..."
ghc -O --make -XDeriveDataTypeable \
-package ghc \
+ -package ghc-mtl \
-package ghc-paths \
-o hake/hake \
-outputdir hake \
-ihake \
-rtsopts=all \
-threaded \
- -with-rtsopts="-K32m" \
$SRCDIR/hake/Main.hs $LDFLAGS || exit 1
# -eventlog \
echo "Running hake..."
#./hake/hake --output-filename Makefile --source-dir "$SRCDIR" +RTS -s -N -K64M -A64M -ls -lf || exit
-./hake/hake --output-filename Makefile --source-dir "$SRCDIR" +RTS -N -K64M -A64M || exit
+#./hake/hake --output-filename Makefile --source-dir "$SRCDIR" +RTS -N -K64M -A64M || exit
+./hake/hake --output-filename Makefile --source-dir "$SRCDIR" +RTS -T || exit
echo "Now running initial make to build dependencies."
echo " (remove the '-j 4' if your system has trouble handling this"