From 227b135b658816dcce068237dfbde0b3eaf8f725 Mon Sep 17 00:00:00 2001 From: battlmonstr Date: Mon, 4 Dec 2023 12:49:14 +0100 Subject: [PATCH] silkworm: disable on incompatible Linux versions --- Makefile | 5 ++++ turbo/silkworm/silkworm_compat_check.sh | 33 +++++++++++++++++++++++++ 2 files changed, 38 insertions(+) create mode 100755 turbo/silkworm/silkworm_compat_check.sh diff --git a/Makefile b/Makefile index 01c7b21c152..44b292cbbb2 100644 --- a/Makefile +++ b/Makefile @@ -28,6 +28,11 @@ CGO_CFLAGS += -Wno-unknown-warning-option -Wno-enum-int-mismatch -Wno-strict-pro # about netgo see: https://github.com/golang/go/issues/30310#issuecomment-471669125 and https://github.com/golang/go/issues/57757 BUILD_TAGS = nosqlite,noboltdb + +ifneq ($(shell "$(CURDIR)/turbo/silkworm/silkworm_compat_check.sh"),) + BUILD_TAGS := "$(BUILD_TAGS),nosilkworm" +endif + PACKAGE = github.com/ledgerwatch/erigon GO_FLAGS += -trimpath -tags $(BUILD_TAGS) -buildvcs=false diff --git a/turbo/silkworm/silkworm_compat_check.sh b/turbo/silkworm/silkworm_compat_check.sh new file mode 100755 index 00000000000..15f45d9ee83 --- /dev/null +++ b/turbo/silkworm/silkworm_compat_check.sh @@ -0,0 +1,33 @@ +#!/bin/bash + +set -e +set -u +set -o pipefail + +OS_RELEASE_PATH=/etc/os-release + +case $(uname -s) in + Linux) + if [[ ! -f "$OS_RELEASE_PATH" ]] + then + echo "not supported Linux without $OS_RELEASE_PATH" + exit 1 + fi + + source "$OS_RELEASE_PATH" + + if [[ "$ID" == "debian" ]] && [[ "$VERSION_ID" == "12" ]] + then + exit 0 + else + echo "not supported Linux version: $ID $VERSION_ID" + exit 1 + fi + + ;; + Darwin) + exit 0;; + *) + echo "unsupported OS" + exit 1;; +esac