Skip to content

Commit beb8764

Browse files
authored
Merge pull request #1033 from andrjohns/feature/multiarch_linux
Pull correct linux arch for stanc3
2 parents d73ac7c + 69b7947 commit beb8764

File tree

1 file changed

+18
-2
lines changed

1 file changed

+18
-2
lines changed

make/stanc

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,22 @@ else ifeq ($(OS),Darwin)
2222
STANC_XATTR := $(shell xattr bin/mac-stanc 2>/dev/null)
2323
else ifeq ($(OS),Linux)
2424
OS_TAG := linux
25+
ifeq ($(shell uname -m),mips64)
26+
ARCH_TAG := -mips64el
27+
else ifeq ($(shell uname -m),ppc64le)
28+
ARCH_TAG := -ppc64el
29+
else ifeq ($(shell uname -m),s390x)
30+
ARCH_TAG := -s390x
31+
else ifeq ($(shell uname -m),aarch64)
32+
ARCH_TAG := -arm64
33+
else ifeq ($(shell uname -m),armv7l)
34+
ifeq ($(shell readelf -A /usr/bin/file | grep Tag_ABI_VFP_args),)
35+
ARCH_TAG := -armel
36+
else
37+
ARCH_TAG := -armhf
38+
endif
39+
endif
40+
2541
else ifeq ($(OS),missing-submodules)
2642
CMDSTAN_SUBMODULES = 0
2743
else
@@ -45,7 +61,7 @@ ifeq ($(OS_TAG),windows)
4561
else
4662
bin/stanc$(EXE) :
4763
@mkdir -p $(dir $@)
48-
curl -L $(STANC3_TEST_BIN_URL)/bin/$(OS_TAG)-stanc -o bin/stanc$(EXE) --retry $(STANC_DL_RETRY) --retry-delay $(STANC_DL_DELAY)
64+
curl -L $(STANC3_TEST_BIN_URL)/bin/$(OS_TAG)$(ARCH_TAG)-stanc -o bin/stanc$(EXE) --retry $(STANC_DL_RETRY) --retry-delay $(STANC_DL_DELAY)
4965
chmod +x bin/stanc$(EXE)
5066
endif
5167

@@ -72,7 +88,7 @@ else
7288
# get latest stanc3 - Linux & MacOS
7389
bin/stanc$(EXE) :
7490
@mkdir -p $(dir $@)
75-
curl -L https://github.com/stan-dev/stanc3/releases/download/$(STANC3_VERSION)/$(OS_TAG)-stanc -o bin/stanc$(EXE) --retry $(STANC_DL_RETRY) --retry-delay $(STANC_DL_DELAY)
91+
curl -L https://github.com/stan-dev/stanc3/releases/download/$(STANC3_VERSION)/$(OS_TAG)$(ARCH_TAG)-stanc -o bin/stanc$(EXE) --retry $(STANC_DL_RETRY) --retry-delay $(STANC_DL_DELAY)
7692
chmod +x bin/stanc$(EXE)
7793
endif
7894
endif

0 commit comments

Comments
 (0)