From fd696a839f45a7fded336ef49fed9b4eb588cafc Mon Sep 17 00:00:00 2001 From: "CanbiZ (MickLesk)" <47820557+MickLesk@users.noreply.github.com> Date: Wed, 2 Dec 2026 16:10:48 +0100 Subject: [PATCH] Martin: use the legacycpu build on CPUs below x86-64-v3 (#19264) Martin 2.0's x86_64 builds need AVX2 and the rest of x86-64-v3; on older CPUs such as the Celeron J and N series or Xeon E5 v1/v2 the binary would not start after the update. Those now get the -legacycpu build, and an update from 1.x points to the migration guide once. The default config starts unchanged on 2.0. --- ct/martin.sh | 9 ++++++++- install/martin-install.sh | 7 ++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/ct/martin.sh b/ct/martin.sh index d1fdc09ff..43f244cd9 100644 --- a/ct/martin.sh +++ b/ct/martin.sh @@ -36,7 +36,14 @@ function update_script() { systemctl stop martin msg_ok "Stopped Martin" - CLEAN_INSTALL=1 fetch_and_deploy_gh_release "martin" "maplibre/martin" "prebuild" "latest" "/opt/martin" "martin-$(arch_resolve "x86_64" "aarch64")-unknown-linux-musl.tar.gz" + if [[ "$(cat ~/.martin 2>/dev/null)" =~ (^|[^0-9])1\.[0-9] ]]; then + msg_warn "Martin 2.0 drops settings 1.x deprecated and needs PostgreSQL 15 and PostGIS 3.5 for database sources: https://maplibre.org/martin/migration-guide/" + fi + MARTIN_ASSET="martin-$(arch_resolve "x86_64" "aarch64")-unknown-linux-musl.tar.gz" + if [[ "$(arch_resolve)" == "amd64" ]] && ! { grep -qw avx2 /proc/cpuinfo && grep -qw bmi2 /proc/cpuinfo && grep -qw fma /proc/cpuinfo && grep -qw movbe /proc/cpuinfo; }; then + MARTIN_ASSET="martin-x86_64-unknown-linux-musl-legacycpu.tar.gz" + fi + CLEAN_INSTALL=1 fetch_and_deploy_gh_release "martin" "maplibre/martin" "prebuild" "latest" "/opt/martin" "$MARTIN_ASSET" msg_info "Starting Martin" systemctl start martin diff --git a/install/martin-install.sh b/install/martin-install.sh index 2bd3940fe..c11bbb744 100644 --- a/install/martin-install.sh +++ b/install/martin-install.sh @@ -13,7 +13,12 @@ setting_up_container network_check update_os -fetch_and_deploy_gh_release "martin" "maplibre/martin" "prebuild" "latest" "/opt/martin" "martin-$(arch_resolve "x86_64" "aarch64")-unknown-linux-musl.tar.gz" +# Martin 2.x builds for x86_64 need an x86-64-v3 CPU; older ones get the legacycpu build. +MARTIN_ASSET="martin-$(arch_resolve "x86_64" "aarch64")-unknown-linux-musl.tar.gz" +if [[ "$(arch_resolve)" == "amd64" ]] && ! { grep -qw avx2 /proc/cpuinfo && grep -qw bmi2 /proc/cpuinfo && grep -qw fma /proc/cpuinfo && grep -qw movbe /proc/cpuinfo; }; then + MARTIN_ASSET="martin-x86_64-unknown-linux-musl-legacycpu.tar.gz" +fi +fetch_and_deploy_gh_release "martin" "maplibre/martin" "prebuild" "latest" "/opt/martin" "$MARTIN_ASSET" msg_info "Configuring Martin" mkdir -p /opt/martin_data/tiles