summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorPHO <pho@cielonegro.org>2024-05-17 06:22:49 +0900
committerGitHub <noreply@github.com>2024-05-16 23:22:49 +0200
commit0ba932132e56d30de7af268f3268b3141ad22bc8 (patch)
treeb12391230b3fb18b30327573653d3b7f9f96dfb8
parent2c8551556e5b51b7a7e487b1043b92d4ad34dbf0 (diff)
downloadNim-0ba932132e56d30de7af268f3268b3141ad22bc8.tar.gz
Support NetBSD/aarch64 (#23616)
I could trivially port Nim to NetBSD/aarch64 because it already
supported NetBSD and aarch64. I only needed to generate `c_code` for
this combination.
-rw-r--r--compiler/installer.ini2
-rw-r--r--lib/pure/distros.nim5
-rw-r--r--tools/niminst/buildsh.nimf1
-rw-r--r--tools/niminst/makefile.nimf1
4 files changed, 6 insertions, 3 deletions
diff --git a/compiler/installer.ini b/compiler/installer.ini
index 8569d0ef8..1a998d9ef 100644
--- a/compiler/installer.ini
+++ b/compiler/installer.ini
@@ -10,7 +10,7 @@ Platforms: """
   macosx: i386;amd64;powerpc64;arm64
   solaris: i386;amd64;sparc;sparc64
   freebsd: i386;amd64;powerpc64;arm;arm64;riscv64;sparc64;mips;mipsel;mips64;mips64el;powerpc;powerpc64el
-  netbsd: i386;amd64
+  netbsd: i386;amd64;arm64
   openbsd: i386;amd64;arm;arm64
   dragonfly: i386;amd64
   crossos: amd64
diff --git a/lib/pure/distros.nim b/lib/pure/distros.nim
index 58eacf633..9e71d4ce0 100644
--- a/lib/pure/distros.nim
+++ b/lib/pure/distros.nim
@@ -127,6 +127,7 @@ type
 
     BSD
     FreeBSD
+    NetBSD
     OpenBSD
     DragonFlyBSD
 
@@ -168,7 +169,7 @@ proc detectOsImpl(d: Distribution): bool =
   else:
     when defined(bsd):
       case d
-      of Distribution.FreeBSD, Distribution.OpenBSD:
+      of Distribution.FreeBSD, Distribution.NetBSD, Distribution.OpenBSD:
         result = $d in uname()
       else:
         result = false
@@ -251,7 +252,7 @@ proc foreignDepInstallCmd*(foreignPackageName: string): (string, bool) =
       result = ("nix-env -i " & p, false)
     elif detectOs(Solaris) or detectOs(FreeBSD):
       result = ("pkg install " & p, true)
-    elif detectOs(OpenBSD):
+    elif detectOs(NetBSD) or detectOs(OpenBSD):
       result = ("pkg_add " & p, true)
     elif detectOs(PCLinuxOS):
       result = ("rpm -ivh " & p, true)
diff --git a/tools/niminst/buildsh.nimf b/tools/niminst/buildsh.nimf
index 6b99c49ee..063a02779 100644
--- a/tools/niminst/buildsh.nimf
+++ b/tools/niminst/buildsh.nimf
@@ -122,6 +122,7 @@ case $uos in
   *netbsd* )
     myos="netbsd"
     LINK_FLAGS="$LINK_FLAGS -lm"
+    ucpu=`uname -p`
     ;;
   *darwin* )
     myos="macosx"
diff --git a/tools/niminst/makefile.nimf b/tools/niminst/makefile.nimf
index b392ab472..002bc0592 100644
--- a/tools/niminst/makefile.nimf
+++ b/tools/niminst/makefile.nimf
@@ -45,6 +45,7 @@ endif
 ifeq ($(uos),netbsd)
   myos = netbsd
   LDFLAGS += -lm
+  ucpu = $(shell sh -c 'uname -p')
 endif
 ifeq ($(uos),darwin)
   myos = macosx