$NetBSD: patch-SConscript,v 1.3 2020/12/03 14:37:19 nia Exp $ Support NetBSD. --- SConscript.orig 2020-02-27 03:38:53.000000000 +0000 +++ SConscript @@ -90,7 +90,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') @@ -239,12 +239,7 @@ def findLibs(env, conf): FatalError("libSDL2main not found or not installed") #Look for SDL - runSdlConfig = platform == "Linux" or compilePlatform == "Linux" or platform == "FreeBSD" - if platform == "Darwin" and conf.CheckFramework("SDL2"): - runSdlConfig = False - elif not conf.CheckLib("SDL2"): - FatalError("SDL2 development library not found or not installed") - + runSdlConfig = platform == "Linux" or compilePlatform == "Linux" or platform == "FreeBSD" or platform == "NetBSD" if runSdlConfig: try: env.ParseConfig('sdl2-config --cflags') @@ -263,10 +258,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") @@ -276,16 +268,13 @@ def findLibs(env, conf): if not conf.CheckLib(['lua5.2', 'lua-5.2', 'lua52', 'lua']): FatalError("lua5.2 development library not found or not installed") env.Append(CPPDEFINES=["LUA_COMPAT_ALL"]) - if platform == "FreeBSD": - luaver = "lua-5.2" - else: - luaver = "lua5.2" + luaver = "lua5.2" else: if not conf.CheckLib(['lua5.1', 'lua-5.1', 'lua51', 'lua']): 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)) @@ -333,7 +322,7 @@ def findLibs(env, conf): if useCurl and not conf.CheckLib(['curl', 'libcurl']): FatalError("libcurl not found or not installed") - if useCurl and (platform == "Linux" or compilePlatform == "Linux" or platform == "FreeBSD"): + if useCurl and (platform == "Linux" or compilePlatform == "Linux" or platform == "FreeBSD" or platform == "NetBSD"): if GetOption('static'): env.ParseConfig("curl-config --static-libs") else: @@ -358,7 +347,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: @@ -375,10 +364,12 @@ 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") + env.ParseConfig('pkg-config --libs x11') + if not conf.CheckLib('rt'): FatalError("librt not found or not installed") elif platform == "Windows": @@ -426,7 +417,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']) @@ -481,10 +472,6 @@ elif GetOption('release'): env.Append(CCFLAGS=['/MT']) else: env.Append(CCFLAGS=['/MD']) - else: - env.Append(CCFLAGS=['-O3', '-ftree-vectorize', '-funsafe-math-optimizations', '-ffast-math', '-fomit-frame-pointer']) - if platform != "Darwin": - env.Append(CCFLAGS=['-funsafe-loop-optimizations']) if GetOption('static'): if platform == "Windows":