build: add evmone-build.sh for CI keeper builds

Add a build script that invokes CMake to build the evmone library.
The script handles native, arm64, and mipsle targets, gracefully
skipping cross-compilation targets when the cross-compiler is not
available.

Move the script reference in ci.go from ./evmone/build.sh (inside
the submodule, not tracked) to ./build/evmone-build.sh (tracked
in the main repo).
This commit is contained in:
tellabg 2026-03-06 23:56:23 +01:00
parent 73f4ec86e7
commit 6217baf2f6
2 changed files with 55 additions and 1 deletions

View file

@ -334,7 +334,7 @@ func doInstallKeeper(cmdline []string) {
continue
}
log.Printf("Building evmone library for %s", evmoneTarget)
build.MustRun(exec.Command("./evmone/build.sh", evmoneTarget))
build.MustRun(exec.Command("./build/evmone-build.sh", evmoneTarget))
builtEvmone[evmoneTarget] = true
}

54
build/evmone-build.sh Executable file
View file

@ -0,0 +1,54 @@
#!/bin/bash
# Build evmone library for go-ethereum integration
# Usage: evmone-build.sh [native|amd64|arm64|mipsle]
set -e
TARGET="${1:-native}"
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
EVMONE_DIR="$SCRIPT_DIR/../evmone"
# Map Go arch names to build directories and CMake settings
case "$TARGET" in
native|amd64)
BUILD_DIR="$EVMONE_DIR/build"
CMAKE_EXTRA=""
;;
arm64)
if ! command -v aarch64-linux-gnu-gcc &>/dev/null; then
echo "Skipping arm64 build: cross-compiler not found"
exit 0
fi
BUILD_DIR="$EVMONE_DIR/build-arm64"
CMAKE_EXTRA="-DCMAKE_SYSTEM_PROCESSOR=aarch64 -DCMAKE_C_COMPILER=aarch64-linux-gnu-gcc -DCMAKE_CXX_COMPILER=aarch64-linux-gnu-g++"
;;
mipsle)
if ! command -v mipsel-linux-gnu-gcc &>/dev/null; then
echo "Skipping mipsle build: cross-compiler not found"
exit 0
fi
BUILD_DIR="$EVMONE_DIR/build-mipsle"
CMAKE_EXTRA="-DCMAKE_SYSTEM_PROCESSOR=mipsel -DCMAKE_C_COMPILER=mipsel-linux-gnu-gcc -DCMAKE_CXX_COMPILER=mipsel-linux-gnu-g++ -DCMAKE_SYSTEM_NAME=Linux"
;;
*)
echo "Unknown target: $TARGET" >&2
exit 1
;;
esac
mkdir -p "$BUILD_DIR"
cd "$BUILD_DIR"
cmake "$EVMONE_DIR" \
-DCMAKE_BUILD_TYPE=Release \
-DBUILD_SHARED_LIBS=ON \
-DEVMONE_TESTING=OFF \
-DEVMONE_FUZZING=OFF \
-DCMAKE_INSTALL_LIBDIR=lib \
$CMAKE_EXTRA
cmake --build . --parallel
# Ensure lib/ exists (some distros use lib64/)
if [ -d "$BUILD_DIR/lib64" ] && [ ! -d "$BUILD_DIR/lib" ]; then
ln -sf lib64 "$BUILD_DIR/lib"
fi