Skip to content

Commit f6b36b9

Browse files
committed
feat: add ASDF_CLANG_TOOLS_LINUX_IGNORE_ARCH setting
1 parent a9839e6 commit f6b36b9

File tree

2 files changed

+18
-6
lines changed

2 files changed

+18
-6
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,7 @@ install & manage versions.
7070
## Environment Variables
7171

7272
- `ASDF_CLANG_TOOLS_MACOS_DEQUARANTINE`: set to "1" to automatically de-quarantine binaries. Otherwise, it will interactively ask to do so.
73+
- `ASDF_CLANG_TOOLS_LINUX_IGNORE_ARCH`: set to "1" to install the `amd64` binary regardless of the host architecture. The [clang-tools](https://github.com/muttleyxd/clang-tools-static-binaries) project does not currently provide `arm64`/`aarch64` Linux binaries. This assumes that you have set up [QEMU User Emulation](https://wiki.debian.org/QemuUserEmulation) (or similar) to run foreign binaries under emulation.
7374

7475
# Acknowledgements
7576

lib/utils.bash

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ set -euo pipefail
44

55
# Settings
66
ASDF_CLANG_TOOLS_MACOS_DEQUARANTINE=${ASDF_CLANG_TOOLS_MACOS_DEQUARANTINE:-0}
7+
ASDF_CLANG_TOOLS_LINUX_IGNORE_ARCH=${ASDF_CLANG_TOOLS_LINUX_IGNORE_ARCH:-0}
78

89
GH_REPO="muttleyxd/clang-tools-static-binaries"
910
PLUGIN_NAME="clang-tools"
@@ -65,17 +66,27 @@ validate_platform() {
6566
USE_ARCH=amd64
6667
;;
6768
Linux)
68-
case $arch in
69-
x86_64)
70-
USE_KERNEL=linux
69+
USE_KERNEL=linux
70+
if [ "$ASDF_CLANG_TOOLS_LINUX_IGNORE_ARCH" != 0 ]; then
7171
USE_ARCH=amd64
72-
;;
73-
esac
72+
log "ASDF_CLANG_TOOLS_LINUX_IGNORE_ARCH is set - using '$USE_ARCH' binary."
73+
else
74+
case $arch in
75+
x86_64)
76+
USE_ARCH=amd64
77+
;;
78+
esac
79+
fi
7480
;;
7581
esac
7682

7783
if [ -z "${USE_KERNEL}" ] || [ -z "${USE_ARCH}" ]; then
78-
fail "Unsupported platform '${kernel}-${arch}'"
84+
local msg="Unsupported platform '${kernel}-${arch}'."
85+
if [ "$USE_KERNEL" = "linux" ]; then
86+
msg="${msg}\n\nSee the 'ASDF_CLANG_TOOLS_LINUX_IGNORE_ARCH' setting."
87+
fi
88+
89+
fail "$msg"
7990
fi
8091

8192
USE_PLATFORM="${USE_KERNEL}-${USE_ARCH}"

0 commit comments

Comments
 (0)