Files
evm/scripts/constants.sh
T
zeekay 458178730d evm: derive plugin VM ID from luxfi/constants.EVMID; bump luxfi/gpu v1.0.1
- cmd/vmid prints constants.EVMID — Go source of truth for the C-Chain VM
  ID. Build scripts and Makefile now call this instead of hardcoding the
  base58 string. Drops a stale subnet-evm ID (ag3GReYP…) from the Makefile.
- scripts/build.sh: default output is build/evm; INSTALL=1 installs under
  the derived VMID at \$LUX_PLUGIN_DIR. Codesigns on darwin in-line so a
  fresh binary doesn't get SIGKILLed by gatekeeper post-cp.
- core/parallel/gpu_bridge.go: build tag flipped from \`!nogpu\` (opt-out)
  to \`gpu\` (opt-in) so default builds don't drag in luxfi/gpu cgo.
- go.mod: luxfi/gpu v0.30.0 → v1.0.1. v0.30.0 referenced removed MLX
  symbols (mlx_from_slice_int64 etc.); v1.0.1 migrated to lux/gpu.h and
  builds cleanly with -tags gpu and -tags \"cevm gpu\".
- LLM.md: build commands updated; \"no canonical / no aliases\" reflects
  reality (single VMID, one filename, derived from Go).
2026-05-11 22:36:46 -07:00

85 lines
3.2 KiB
Bash
Executable File

#!/usr/bin/env bash
# Ignore warnings about variables appearing unused since this file is not the consumer of the variables it defines.
# shellcheck disable=SC2034
set -euo pipefail
# Set the PATHS
GOPATH="$(go env GOPATH)"
# Default install dir for luxd plugins. Overridable.
LUX_PLUGIN_DIR="${LUX_PLUGIN_DIR:-${HOME}/.lux/plugins}"
# Canonical EVM VM ID — derived from luxfi/constants.EVMID (Go source of truth),
# not a hardcoded base58 string. Cached per shell invocation.
if [[ -z "${EVM_VMID:-}" ]]; then
EVM_VMID="$(cd "${EVM_PATH:-$(dirname "${BASH_SOURCE[0]}")/..}" && go run ./cmd/vmid)"
fi
# Lux docker hub
# luxfi/node - defaults to local as to avoid unintentional pushes
# You should probably set it - export IMAGE_NAME='luxfi/evm'
IMAGE_NAME=${IMAGE_NAME:-"evm_luxd"}
# Shared between ./scripts/build_docker_image.sh and ./scripts/tests.build_docker_image.sh
LUXD_IMAGE_NAME="${LUXD_IMAGE_NAME:-luxfi/node}"
# if this isn't a git repository (say building from a release), don't set our git constants.
if [ ! -d .git ]; then
CURRENT_BRANCH=""
EVM_COMMIT=""
else
# Current branch
CURRENT_BRANCH=${CURRENT_BRANCH:-$(git describe --tags --exact-match 2>/dev/null || git symbolic-ref -q --short HEAD || git rev-parse --short HEAD || :)}
# Image build id
#
# Use an abbreviated version of the full commit to tag the image.
# WARNING: this will use the most recent commit even if there are un-committed changes present
EVM_COMMIT="$(git --git-dir="$EVM_PATH/.git" rev-parse HEAD || :)"
fi
# Don't export them as they're used in the context of other calls
if [[ -z ${LUX_VERSION:-} ]]; then
# Get module details from go.mod - try node first, then luxd
MODULE_DETAILS="$(go list -m "github.com/luxfi/node" 2>/dev/null || go list -m "github.com/luxfi/luxd" 2>/dev/null || echo "")"
LUX_VERSION="$(echo "${MODULE_DETAILS}" | awk '{print $2}')"
# Check if the version matches the pattern where the last part is the module hash
# v*YYYYMMDDHHMMSS-abcdef123456
#
# If not, the value is assumed to represent a tag
if [[ "${LUX_VERSION}" =~ ^v.*[0-9]{14}-[0-9a-f]{12}$ ]]; then
MODULE_HASH="$(echo "${LUX_VERSION}" | grep -Eo '[0-9a-f]{12}$')"
# The first 8 chars of the hash is used as the tag of luxd images
LUX_VERSION="${MODULE_HASH::8}"
fi
fi
# Shared between ./scripts/build_docker_image.sh and ./scripts/tests.build_docker_image.sh
DOCKERHUB_TAG="${EVM_COMMIT::8}_${LUX_VERSION}"
# WARNING: this will use the most recent commit even if there are un-committed changes present
BUILD_IMAGE_ID=${BUILD_IMAGE_ID:-"${CURRENT_BRANCH}_${LUX_VERSION}"}
echo "Using branch: ${CURRENT_BRANCH}"
# Static compilation
STATIC_LD_FLAGS=''
if [ "${STATIC_COMPILATION:-}" = 1 ]; then
export CC=musl-gcc
command -v $CC || (echo $CC must be available for static compilation && exit 1)
STATIC_LD_FLAGS=' -extldflags "-static" -linkmode external '
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="-O2 -D__BLST_PORTABLE__"
# CGO_ENABLED is required for multi-arch builds.
export CGO_ENABLED=1