$NetBSD: patch-SConscript,v 1.1 2019/04/13 12:08:04 nia Exp $

Support NetBSD.

--- SConscript.orig	2019-02-21 05:23:45.000000000 +0000
+++ SConscript
@@ -88,7 +88,7 @@ elif GetOption('lin'):
 	platform = "Linux"
 elif GetOption('mac'):
 	platform = "Darwin"
-elif compilePlatform not in ["Linux", "Windows", "Darwin", "FreeBSD"]:
+elif compilePlatform not in ["Linux", "Windows", "Darwin", "FreeBSD", "NetBSD"]:
 	FatalError("Unknown platform: {0}".format(platform))
 
 msvc = GetOption('msvc')
@@ -243,11 +243,11 @@ def findLibs(env, conf):
 			FatalError("libSDL2main not found or not installed")
 
 	#Look for SDL
-	runSdlConfig = platform == "Linux" or compilePlatform == "Linux" or platform == "FreeBSD"
+	runSdlConfig = platform == "Linux" or compilePlatform == "Linux" or platform == "FreeBSD" or platform == "NetBSD"
 	#if platform == "Darwin" and conf.CheckFramework("SDL"):
 	#	runSdlConfig = False
-	if not conf.CheckLib("SDL2"):
-		FatalError("SDL2 development library not found or not installed")
+	#if not conf.CheckLib("SDL2"):
+	#	FatalError("SDL2 development library not found or not installed")
 
 	if runSdlConfig:
 		try:
@@ -267,10 +267,7 @@ def findLibs(env, conf):
 
 	if not GetOption('nolua') and not GetOption('renderer') and not GetOption('font'):
 		#Look for Lua
-		if platform == "FreeBSD":
-			luaver = "lua-5.1"
-		else:
-			luaver = "lua5.1"
+		luaver = "lua-5.1"
 		if GetOption('luajit'):
 			if not conf.CheckLib(['luajit-5.1', 'luajit5.1', 'luajit2.0', 'luajit', 'libluajit']):
 				FatalError("luajit development library not found or not installed")
@@ -289,7 +286,7 @@ def findLibs(env, conf):
 				if platform != "Darwin" or not conf.CheckFramework("Lua"):
 					FatalError("lua5.1 development library not found or not installed")
 		foundpkg = False
-		if platform == "Linux" or platform == "FreeBSD":
+		if platform == "Linux" or platform == "FreeBSD" or platform == "NetBSD":
 			try:
 				env.ParseConfig("pkg-config --cflags {0}".format(luaver))
 				env.ParseConfig("pkg-config --libs {0}".format(luaver))
@@ -346,7 +343,7 @@ def findLibs(env, conf):
 
 	#Look for OpenGL libraries
 	if GetOption('opengl'):
-		if platform == "Linux" or platform == "FreeBSD":
+		if platform == "Linux" or platform == "FreeBSD" or platform == "NetBSD":
 			if not conf.CheckLib('GL'):
 				FatalError("libGL not found or not installed")
 			try:
@@ -363,7 +360,7 @@ def findLibs(env, conf):
 			if not conf.CheckFramework("OpenGL"):
 				FatalError("OpenGL framework not found or not installed")
 
-	if platform == "Linux" or platform == "FreeBSD":
+	if platform == "Linux" or platform == "FreeBSD" or platform == "NetBSD":
 		if not conf.CheckLib('X11'):
 			FatalError("X11 development library not found or not installed")
 
@@ -418,7 +415,7 @@ if platform == "Windows":
 			env.Append(LINKFLAGS=['/NODEFAULTLIB:msvcrtd.lib'])
 	else:
 		env.Append(LINKFLAGS=['-mwindows'])
-elif platform == "Linux" or platform == "FreeBSD":
+elif platform == "Linux" or platform == "FreeBSD" or platform == "NetBSD":
 	env.Append(CPPDEFINES=['LIN'])
 elif platform == "Darwin":
 	env.Append(CPPDEFINES=['MACOSX'])
