aboutsummaryrefslogtreecommitdiffstats
path: root/build.sh
blob: 0b865b0f0f1712e13129032fe22a81114ff5c5d0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/bin/bash

# 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

BUILD_DIR=build

# 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

set -euxo pipefail

mkdir -p ${BUILD_DIR}
cd ${BUILD_DIR}

csc ${CSC_FLAGS} -o desmoctl -static ../desmoctl.scm
chmod +x desmoctl