Files
2026-01-06 22:17:58 -08:00

28 lines
800 B
Bash
Executable File

#!/bin/bash
# Run with ./scripts/build.sh <optional_version>
TELEMETRY_TOKEN=""
if ! [[ "$0" =~ scripts/build.sh ]]; then
echo "must be run from repository root"
exit 1
fi
if [ $# -eq 0 ] ; then
VERSION=$(cat VERSION)
else
VERSION=$1
fi
# Set the CGO flags to use the portable version of BLST
#
# We use "export" here instead of just setting a bash variable because we need
# to pass this flag to all child processes spawned by the shell.
export CGO_CFLAGS="-O -D__BLST_PORTABLE__"
# Suppress duplicate library warnings when CGO is enabled
if [ "$CGO_ENABLED" != "0" ]; then
export CGO_LDFLAGS="-Wl,-no_warn_duplicate_libraries"
fi
go build -v -ldflags="-X 'github.com/luxfi/cli/cmd.Version=$VERSION' -X github.com/luxfi/cli/pkg/utils.telemetryToken=$TELEMETRY_TOKEN" -o bin/lux