diff --git a/Makefile b/Makefile index ec89d1ed1..671af31fe 100644 --- a/Makefile +++ b/Makefile @@ -57,15 +57,15 @@ ifndef NO_DOCKER bin_deps += docker-builder endif -docker_build_cmd_amd64 = docker run --rm -v ./:/src --user $(shell id -u):$(shell id -g) -e CGO_ENABLED=1 -e CGO_C_FLAGS="-O -D__BLST_PORTABLE__" \ +docker_build_cmd_amd64 = docker run --rm -v ./:/src --user $(shell id -u):$(shell id -g) -e CGO_ENABLED=1 -e CGO_CFLAGS="-O -D__BLST_PORTABLE__" \ -e GOARCH=amd64 -e GOOS=linux --workdir /src -v ~/.cache:/.cache rocketpool/smartnode-builder:${VERSION} \ go build -local_build_cmd_amd64 = CGO_ENABLED=1 CGO_C_FLAGS="-O -D__BLST_PORTABLE__" GOARCH=amd64 GOOS=linux go build -docker_build_cmd_arm64 = docker run --rm -v ./:/src --user $(shell id -u):$(shell id -g) -e CGO_ENABLED=1 -e CGO_C_FLAGS="-O -D__BLST_PORTABLE__" \ - -e CC=aarch64-linux-gnu-gcc -e CXX=aarch64-linux-gnu-cpp -e CGO_C_FLAGS="-O -D__BLST_PORTABLE__" -e GOARCH=arm64 -e GOOS=linux \ +local_build_cmd_amd64 = CGO_ENABLED=1 CGO_CFLAGS="-O -D__BLST_PORTABLE__" GOARCH=amd64 GOOS=linux go build +docker_build_cmd_arm64 = docker run --rm -v ./:/src --user $(shell id -u):$(shell id -g) -e CGO_ENABLED=1 -e CGO_CFLAGS="-O -D__BLST_PORTABLE__" \ + -e CC=aarch64-linux-gnu-gcc -e CXX=aarch64-linux-gnu-cpp -e CGO_CFLAGS="-O -D__BLST_PORTABLE__" -e GOARCH=arm64 -e GOOS=linux \ --workdir /src -v ~/.cache:/.cache rocketpool/smartnode-builder:${VERSION} \ go build -local_build_cmd_arm64 = CGO_ENABLED=1 CC=aarch64-linux-gnu-gcc CXX=aarch64-linux-gnu-cpp CGO_C_FLAGS="-O -D__BLST_PORTABLE__" GOARCH=arm64 GOOS=linux go build +local_build_cmd_arm64 = CGO_ENABLED=1 CC=aarch64-linux-gnu-gcc CXX=aarch64-linux-gnu-cpp CGO_CFLAGS="-O -D__BLST_PORTABLE__" GOARCH=arm64 GOOS=linux go build # amd64 daemon build .PHONY: ${BIN_DIR}/rocketpool-daemon-linux-amd64 ${BIN_DIR}/rocketpool-daemon-linux-amd64: ${bin_deps} diff --git a/treegen/build-release.sh b/treegen/build-release.sh deleted file mode 100755 index 7fb3b47a2..000000000 --- a/treegen/build-release.sh +++ /dev/null @@ -1,74 +0,0 @@ -#!/bin/bash - -# Builds the binaries -build_binary() { - echo -n "Building binaries... " - docker run --rm -v $PWD:/treegen rocketpool/smartnode-builder:latest /treegen/build_binaries.sh - echo "done!" -} - -# Build the images -build_docker() { - echo -n "Building Docker images... " - docker buildx build --platform=linux/amd64 -t rocketpool/treegen:$VERSION-amd64 --load . - docker buildx build --platform=linux/arm64 -t rocketpool/treegen:$VERSION-arm64 --load . - docker push rocketpool/treegen:$VERSION-amd64 - docker push rocketpool/treegen:$VERSION-arm64 - echo "done!" -} - -# Build the manifest -build_manifest() { - echo -n "Building Docker manifest... " - rm -f ~/.docker/manifests/docker.io_rocketpool_treegen-$VERSION - rm -f ~/.docker/manifests/docker.io_rocketpool_treegen-latest - docker manifest create rocketpool/treegen:$VERSION --amend rocketpool/treegen:$VERSION-amd64 --amend rocketpool/treegen:$VERSION-arm64 - docker manifest create rocketpool/treegen:latest --amend rocketpool/treegen:$VERSION-amd64 --amend rocketpool/treegen:$VERSION-arm64 - echo "done!" - echo -n "Pushing to Docker Hub... " - docker manifest push --purge rocketpool/treegen:$VERSION - docker manifest push --purge rocketpool/treegen:latest - echo "done!" -} - -# Print usage -usage() { - echo "Usage: build-release.sh [options] -v " - echo "This script builds treegen's artifacts." - echo "Options:" - echo $'\t-a\tBuild all of the artifacts.' - echo $'\t-b\tBuild the native binaries for most Linux distributions' - echo $'\t-d\tBuild the Alpine-based Docker containers' - echo $'\t-m\tBuild the Docker manifest' - exit 0 -} - -# ================= -# === Main Body === -# ================= - -# Get the version -while getopts "abdmv:" FLAG; do - case "$FLAG" in - a) BINARIES=true DOCKER=true MANIFEST=true ;; - b) BINARIES=true ;; - d) DOCKER=true ;; - m) MANIFEST=true ;; - v) VERSION="$OPTARG" ;; - *) usage ;; - esac -done -if [ -z "$VERSION" ]; then - usage -fi - -# Build the artifacts -if [ "$BINARIES" = true ]; then - build_binary -fi -if [ "$DOCKER" = true ]; then - build_docker -fi -if [ "$MANIFEST" = true ]; then - build_manifest -fi diff --git a/treegen/build_binaries.sh b/treegen/build_binaries.sh deleted file mode 100755 index 59a44c30b..000000000 --- a/treegen/build_binaries.sh +++ /dev/null @@ -1,11 +0,0 @@ -#!/bin/bash - -cd /treegen - -export CGO_ENABLED=1 - -# Build x64 version -CGO_CFLAGS="-O -D__BLST_PORTABLE__" GOARCH=amd64 GOOS=linux go build -o Releases/treegen-linux-amd64 -buildvcs=false - -# Build the arm64 version -CC=aarch64-linux-gnu-gcc CXX=aarch64-linux-gnu-cpp CGO_CFLAGS="-O -D__BLST_PORTABLE__" GOARCH=arm64 GOOS=linux go build -o Releases/treegen-linux-arm64 -buildvcs=false