ceremonyclient/node/build.sh
Cassandra Heart 35561a9e41
v1.4.19-p1 (#235)
* v1.4.19-p1

* remove integrity check from startup
2024-06-15 11:05:06 -05:00

37 lines
1.2 KiB
Bash
Executable File

#!/bin/bash
set -euxo pipefail
# This script builds the node binary for the current platform and statically links it with VDF static lib.
# Assumes that the VDF library has been built by running the generate.sh script in the `../vdf` directory.
ROOT_DIR="${ROOT_DIR:-$( cd "$(dirname "$(realpath "$( dirname "${BASH_SOURCE[0]}" )")")" >/dev/null 2>&1 && pwd )}"
NODE_DIR="$ROOT_DIR/node"
BINARIES_DIR="$ROOT_DIR/target/release"
pushd "$NODE_DIR" > /dev/null
export CGO_ENABLED=1
export GOEXPERIMENT=arenas
os_type="$(uname)"
case "$os_type" in
"Darwin")
# Check if the architecture is ARM
if [[ "$(uname -m)" == "arm64" ]]; then
# MacOS ld doesn't support -Bstatic and -Bdynamic, so it's important that there is only a static version of the library
go build -ldflags "-linkmode 'external' -extldflags '-L$BINARIES_DIR -lvdf -lbls48581 -ldl -lm'" "$@"
else
echo "Unsupported platform"
exit 1
fi
;;
"Linux")
go build -ldflags "-linkmode 'external' -extldflags '-L$BINARIES_DIR -Wl,-Bstatic -lvdf -lbls48581 -Wl,-Bdynamic -ldl -lm'" "$@"
;;
*)
echo "Unsupported platform"
exit 1
;;
esac