mattolenik / hclq

Command-line processor for HashiCorp config files, like sed for HCL — Terraform, Consul, Nomad, Vault
https://hclq.sh
The Unlicense
254 stars 23 forks source link

ENH: Support arm64 on Darwin (Apple M1) #24

Open davidjeddy opened 2 years ago

davidjeddy commented 2 years ago
~ % sh install.sh                       
sh: install.sh: No such file or directory
~ % # Download the script
curl -sSLo install.sh https://install.hclq.sh

# Inspect the script before executing, as is good practice
# for code from the internet, regardless of trust!
less install.sh
...
# Run it!
sh install.sh
Unsupported or undetected platform: 'arm64'
 ~ % 

Edited platform_check() in install.sh

platform_check() {
  # OS and ARCH variables also used to download binary in main function
  OS="$(uname | awk '{print tolower($0)}')"
  ARCH="$(uname -m)"
  case "$ARCH" in
    amd64) ARCH=amd64;;
    x86_64) ARCH=amd64;;
    i386) ARCH=386;;
    i686) ARCH=386;;
    arm) ARCH=arm;;
    arm64) ARCH=arm;;
    *) fail "Unsupported or undetected platform: '$ARCH'";;
  esac
}

Tried install process again:

sh install.sh
Installing /usr/local/bin/hclq
hclq is not available for OS 'darwin' on architecture 'arm'
kamilgregorczyk commented 2 years ago

mac arm support would be great

jelel-fliss commented 1 year ago

need MAC support too

RTae commented 1 year ago

M1 support please

mcolussi-bigw commented 1 year ago

You can still use the darwin amd64 binary since it will execute under Rosetta compatibility layer

msarmadi commented 1 year ago

in theory, pls test and add new make build target for MacOS M1 (can update install.sh downloaded on your own)

dist/hclq-macos-arm64:
  export GOOS=darwin GOARCH=arm64; $(BUILD_CMD) -o "$@"
  cd "$(@D)" && shasum -a 256 "$@" >> hclq-shasums