From af0ae5830f4e62c48938093e82e8db708f47b81e Mon Sep 17 00:00:00 2001 From: John Paul Adrian Glaubitz Date: Sat, 1 Jun 2019 10:45:44 +0200 Subject: [PATCH] Add build support for Linux/sparc64 (#11365) * compiler: Add sparc64 as target architecture on Linux * build.sh: Use getconf for bitness detection on Linux/sparc The isainfo utility is specific to Solaris and not available on Linux/sparc. While getconf exists on Solaris as well, it does not always seem to match the bitness reported by isainfo on Solaris and isainfo should therefore be preferred on Solaris. --- compiler/installer.ini | 2 +- tools/niminst/buildsh.nimf | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/compiler/installer.ini b/compiler/installer.ini index 63790d90f5..d7b19ec29e 100644 --- a/compiler/installer.ini +++ b/compiler/installer.ini @@ -6,7 +6,7 @@ Name: "Nim" Version: "$version" Platforms: """ windows: i386;amd64 - linux: i386;amd64;powerpc64;arm;sparc;mips;mipsel;mips64;mips64el;powerpc;powerpc64el;arm64;riscv64 + linux: i386;amd64;powerpc64;arm;sparc;sparc64;mips;mipsel;mips64;mips64el;powerpc;powerpc64el;arm64;riscv64 macosx: i386;amd64;powerpc64 solaris: i386;amd64;sparc;sparc64 freebsd: i386;amd64 diff --git a/tools/niminst/buildsh.nimf b/tools/niminst/buildsh.nimf index 04ef356535..2a762d8d18 100644 --- a/tools/niminst/buildsh.nimf +++ b/tools/niminst/buildsh.nimf @@ -140,8 +140,12 @@ case $ucpu in mycpu="amd64" ;; *sparc*|*sun* ) mycpu="sparc" - if [ "$(isainfo -b)" = "64" ]; then - mycpu="sparc64" + if [ "$myos" = "linux" ] ; then + if [ "$(getconf LONG_BIT)" = "64" ]; then + mycpu="sparc64" + elif [ "$(isainfo -b)" = "64" ]; then + mycpu="sparc64" + fi fi ;; *ppc64le* )