mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-06-12 01:41:36 +00:00
build: install cross-compiler deps for keeper CI builds
Update the GitHub Actions workflow to install cmake and mipsel cross-compiler before building keeper targets. Update evmone-build.sh to detect available mipsel cross-compilers: prefer mipsel-linux-gnu-gcc (Debian/Ubuntu), fall back to mips64-linux-gnu-gcc with -EL -mabi=32 flags (Fedora).
This commit is contained in:
parent
6217baf2f6
commit
d5c12be442
2 changed files with 40 additions and 5 deletions
6
.github/workflows/go.yml
vendored
6
.github/workflows/go.yml
vendored
|
|
@ -49,6 +49,12 @@ jobs:
|
|||
go-version: '1.25'
|
||||
cache: false
|
||||
|
||||
- name: Install build dependencies
|
||||
run: |
|
||||
apt-get update
|
||||
apt-get -yq --no-install-suggests --no-install-recommends install \
|
||||
cmake g++ gcc-mipsel-linux-gnu g++-mipsel-linux-gnu
|
||||
|
||||
- name: Build
|
||||
run: go run build/ci.go keeper
|
||||
|
||||
|
|
|
|||
|
|
@ -7,6 +7,28 @@ TARGET="${1:-native}"
|
|||
SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"
|
||||
EVMONE_DIR="$SCRIPT_DIR/../evmone"
|
||||
|
||||
# Detect mipsel cross-compiler: prefer mipsel-linux-gnu-gcc,
|
||||
# fall back to mips64-linux-gnu-gcc with -EL -mabi=32 flags.
|
||||
find_mipsel_cc() {
|
||||
if command -v mipsel-linux-gnu-gcc &>/dev/null; then
|
||||
echo "mipsel-linux-gnu-gcc"
|
||||
elif command -v mips64-linux-gnu-gcc &>/dev/null; then
|
||||
echo "mips64-linux-gnu-gcc"
|
||||
else
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
find_mipsel_cxx() {
|
||||
if command -v mipsel-linux-gnu-g++ &>/dev/null; then
|
||||
echo "mipsel-linux-gnu-g++"
|
||||
elif command -v mips64-linux-gnu-g++ &>/dev/null; then
|
||||
echo "mips64-linux-gnu-g++"
|
||||
else
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
# Map Go arch names to build directories and CMake settings
|
||||
case "$TARGET" in
|
||||
native|amd64)
|
||||
|
|
@ -22,12 +44,19 @@ case "$TARGET" in
|
|||
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
|
||||
MIPSEL_CC=$(find_mipsel_cc) || { echo "Skipping mipsle build: cross-compiler not found"; exit 0; }
|
||||
MIPSEL_CXX=$(find_mipsel_cxx) || { echo "Skipping mipsle build: cross-compiler not found"; exit 0; }
|
||||
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"
|
||||
MIPS_FLAGS=""
|
||||
# mips64 compiler needs explicit flags for little-endian 32-bit
|
||||
if [[ "$MIPSEL_CC" == *mips64* ]]; then
|
||||
MIPS_FLAGS="-EL -mabi=32"
|
||||
fi
|
||||
CMAKE_EXTRA="-DCMAKE_SYSTEM_NAME=Linux -DCMAKE_SYSTEM_PROCESSOR=mipsel"
|
||||
CMAKE_EXTRA="$CMAKE_EXTRA -DCMAKE_C_COMPILER=$MIPSEL_CC -DCMAKE_CXX_COMPILER=$MIPSEL_CXX"
|
||||
if [ -n "$MIPS_FLAGS" ]; then
|
||||
CMAKE_EXTRA="$CMAKE_EXTRA -DCMAKE_C_FLAGS=$MIPS_FLAGS -DCMAKE_CXX_FLAGS=$MIPS_FLAGS"
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
echo "Unknown target: $TARGET" >&2
|
||||
|
|
|
|||
Loading…
Reference in a new issue