From f2fe5140e13d2cff34dc8aaab440a90a7ff2f829 Mon Sep 17 00:00:00 2001
From: kytv <kytv@mail.i2p>
Date: Sun, 18 Sep 2011 16:59:24 +0000
Subject: [PATCH] Add NetBSD support

---
 core/c/jcpuid/mbuild.sh | 24 ++++++++++++++++++++----
 core/c/mbuild.sh        |  2 +-
 2 files changed, 21 insertions(+), 5 deletions(-)

diff --git a/core/c/jcpuid/mbuild.sh b/core/c/jcpuid/mbuild.sh
index 0dfbdaca3b..a69cbdf53f 100755
--- a/core/c/jcpuid/mbuild.sh
+++ b/core/c/jcpuid/mbuild.sh
@@ -2,13 +2,15 @@
 
 case `uname -sr` in
 MINGW*)
-	echo "Building windows .dll's";;
+	echo "Building windows .dlls";;
 CYGWIN*)
-	echo "Building windows .dll's";;
+	echo "Building windows .dlls";;
 Linux*)
-	echo "Building linux .so's";;
+	echo "Building linux .sos";;
+NetBSD*)
+	echo "Building netbsd .sos";;
 FreeBSD*)
-	echo "Building freebsd .so's";;
+	echo "Building freebsd .sos";;
 Darwin*)
 	echo "Building OSX jnilibs";;
 *)
@@ -37,6 +39,20 @@ Darwin*)
         INCLUDES="-I. -Iinclude -I$JAVA_HOME/include/"
         LINKFLAGS="-dynamiclib -framework JavaVM"
         LIBFILE="lib/freenet/support/CPUInformation/libjcpuid-x86-darwin.jnilib";;
+NetBSD*)
+	case `uname -m` in
+		amd64)
+			LINKFLAGS="-shared -Wl,-soname,libjcpuid-x86_64-netbsd.so"
+			LIBFILE="lib/netnet/support/CPUInformation/libjcpuid-x86_64-netbsd.so";;
+		i?86*)
+			LINKFLAGS="-shared -Wl,-soname,libjcpuid-x86-netbsd.so"
+			LIBFILE="lib/netnet/support/CPUInformation/libjcpuid-x86-netbsd.so";;
+		*)
+			echo "Unknown build environment"
+			exit;;
+	esac
+	COMPILEFLAGS="-fPIC -Wall"
+	INCLUDES="-I. -Iinclude -I$JAVA_HOME/include/ -I$JAVA_HOME/include/netbsd/";;
 FreeBSD*)
 	case `uname -m` in
 		amd64)
diff --git a/core/c/mbuild.sh b/core/c/mbuild.sh
index 95d3eb98d5..c81c3929b8 100755
--- a/core/c/mbuild.sh
+++ b/core/c/mbuild.sh
@@ -1,4 +1,4 @@
-#/bin/bash
+#/usr/bin/env bash
 # Automatic build of so files, ignores failed builds.
 # Place latest gmp tarball in the jbigi dir, and exec this script.
 
-- 
GitLab