Skip to content

Commit fb7621b

Browse files
authored
Merge pull request #1 from amrox/feat/linux-ignore-arch
feat: ASDF_CLANG_TOOLS_LINUX_IGNORE_ARCH setting
2 parents 76f1188 + f6b36b9 commit fb7621b

File tree

2 files changed

+18
-7
lines changed

2 files changed

+18
-7
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 & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ 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"
9-
GH_REPO_URL="https://github.com/${GH_REPO}"
1010
PLUGIN_NAME="clang-tools"
1111
USE_KERNEL=
1212
USE_ARCH=
@@ -66,17 +66,27 @@ validate_platform() {
6666
USE_ARCH=amd64
6767
;;
6868
Linux)
69-
case $arch in
70-
x86_64)
71-
USE_KERNEL=linux
69+
USE_KERNEL=linux
70+
if [ "$ASDF_CLANG_TOOLS_LINUX_IGNORE_ARCH" != 0 ]; then
7271
USE_ARCH=amd64
73-
;;
74-
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
7580
;;
7681
esac
7782

7883
if [ -z "${USE_KERNEL}" ] || [ -z "${USE_ARCH}" ]; then
79-
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"
8090
fi
8191

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

0 commit comments

Comments
 (0)