From 0bc80beb699000826b8e9415a7b254c92dc86a5a Mon Sep 17 00:00:00 2001 From: Jan Tuomi Date: Wed, 24 Jan 2024 16:57:56 +0200 Subject: Do things --- build.sh | 31 ++++++++++++++++++++++--------- 1 file changed, 22 insertions(+), 9 deletions(-) (limited to 'build.sh') 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 -- cgit v1.3