aboutsummaryrefslogtreecommitdiffstats
path: root/build.sh
diff options
context:
space:
mode:
Diffstat (limited to 'build.sh')
-rwxr-xr-xbuild.sh31
1 files changed, 22 insertions, 9 deletions
diff --git a/build.sh b/build.sh
index 1f36c6f..0b865b0 100755
--- a/build.sh
+++ b/build.sh
@@ -1,18 +1,31 @@
#!/bin/bash
-set -euxo pipefail
+# if the first flag is -h or --help, then show usage
+if [[ $1 == "-h" || $1 == "--help" ]]; then
+ echo "Usage: build.sh [OPTION]"
+ echo "Builds the desmoctl binary."
+ echo ""
+ echo "Options:"
+ echo " -h, --help Show this help message"
+ echo " -d, --debug Enable debugging"
+ exit 0
+fi
-CSC_FLAGS=-O3
BUILD_DIR=build
-mkdir -p ${BUILD_DIR}
-cd ${BUILD_DIR}
+# if the first flag is --debug or -d, then set CHICKEN_DEBUGGER=localhost:9999 and add -d3 to CSC_FLAGS
+if [[ $1 == "--debug" || $1 == "-d" ]]; then
+ export CHICKEN_DEBUGGER=localhost:9999
+ export CSC_FLAGS="-d3"
+else
+ export CHICKEN_DEBUGGER=
+ export CSC_FLAGS=-O3
+fi
-modules=$(cat ../modules.list)
+set -euxo pipefail
-for mod in $modules; do
- csc ${CSC_FLAGS} -c -static -J ../${mod}.scm -unit ${mod} -o ${mod}.o
-done
+mkdir -p ${BUILD_DIR}
+cd ${BUILD_DIR}
-csc ${CSC_FLAGS} -o desmoctl -static -uses desmo-apply ../desmoctl.scm
+csc ${CSC_FLAGS} -o desmoctl -static ../desmoctl.scm
chmod +x desmoctl