FreeBSD build fixes (#517)

This commit is contained in:
wolfy1339
2017-11-23 14:38:47 -05:00
committed by jacob1
parent a12785cd5d
commit d7a27cc682

View File

@@ -59,7 +59,7 @@ AddSconsOption('sse', True, False, "Enable SSE optimizations (default).")
AddSconsOption('sse2', True, False, "Enable SSE2 optimizations (default).") AddSconsOption('sse2', True, False, "Enable SSE2 optimizations (default).")
AddSconsOption('sse3', False, False, "Enable SSE3 optimizations.") AddSconsOption('sse3', False, False, "Enable SSE3 optimizations.")
AddSconsOption('native', False, False, "Enable optimizations specific to your cpu.") AddSconsOption('native', False, False, "Enable optimizations specific to your cpu.")
AddSconsOption('release', True, False, "Enable loop / compiling optimizations (default).") AddSconsOption('release', False, False, "Enable loop / compiling optimizations.")
AddSconsOption('debugging', False, False, "Compile with debug symbols.") AddSconsOption('debugging', False, False, "Compile with debug symbols.")
AddSconsOption('symbols', False, False, "Preserve (don't strip) symbols") AddSconsOption('symbols', False, False, "Preserve (don't strip) symbols")
@@ -79,7 +79,7 @@ AddSconsOption("output", False, True, "Executable output name.")
#detect platform automatically, but it can be overrided #detect platform automatically, but it can be overrided
tool = GetOption('tool') tool = GetOption('tool')
isX86 = platform.machine() in ["AMD64", "i386", "i686", "x86", "x86_64"] isX86 = platform.machine() in ["amd64", "AMD64", "i386", "i686", "x86", "x86_64"]
platform = compilePlatform = platform.system() platform = compilePlatform = platform.system()
if GetOption('win'): if GetOption('win'):
platform = "Windows" platform = "Windows"
@@ -87,7 +87,7 @@ elif GetOption('lin'):
platform = "Linux" platform = "Linux"
elif GetOption('mac'): elif GetOption('mac'):
platform = "Darwin" platform = "Darwin"
elif compilePlatform not in ["Linux", "Windows", "Darwin"]: elif compilePlatform not in ["Linux", "Windows", "Darwin", "FreeBSD"]:
FatalError("Unknown platform: {0}".format(platform)) FatalError("Unknown platform: {0}".format(platform))
msvc = GetOption('msvc') msvc = GetOption('msvc')
@@ -96,11 +96,11 @@ if msvc and platform != "Windows":
#Create SCons Environment #Create SCons Environment
if GetOption('msvc'): if GetOption('msvc'):
env = Environment(tools=['default'], ENV={'PATH' : os.environ['PATH'], 'TMP' : os.environ['TMP']}, TARGET_ARCH='x86') env = Environment(tools=['default'], ENV=os.environ, TARGET_ARCH='x86')
elif platform == "Windows" and not GetOption('msvc'): elif platform == "Windows" and not GetOption('msvc'):
env = Environment(tools=['mingw'], ENV={'PATH' : os.environ['PATH']}) env = Environment(tools=['mingw'], ENV=os.environ)
else: else:
env = Environment(tools=['default'], ENV={'PATH' : os.environ['PATH']}) env = Environment(tools=['default'], ENV=os.environ)
#attempt to automatically find cross compiler #attempt to automatically find cross compiler
if not tool and compilePlatform == "Linux" and compilePlatform != platform: if not tool and compilePlatform == "Linux" and compilePlatform != platform:
@@ -243,7 +243,7 @@ def findLibs(env, conf):
if not GetOption('renderer'): if not GetOption('renderer'):
#Look for SDL #Look for SDL
runSdlConfig = platform == "Linux" or compilePlatform == "Linux" runSdlConfig = platform == "Linux" or compilePlatform == "Linux" or platform == "FreeBSD"
if platform == "Darwin" and conf.CheckFramework("SDL"): if platform == "Darwin" and conf.CheckFramework("SDL"):
runSdlConfig = False runSdlConfig = False
elif not conf.CheckLib("SDL"): elif not conf.CheckLib("SDL"):
@@ -268,7 +268,10 @@ def findLibs(env, conf):
if not GetOption('nolua') and not GetOption('renderer'): if not GetOption('nolua') and not GetOption('renderer'):
#Look for Lua #Look for Lua
luaver = "lua5.1" if platform == "FreeBSD":
luaver = "lua-5.1"
else:
luaver = "lua5.1"
if GetOption('luajit'): if GetOption('luajit'):
if not conf.CheckLib(['luajit-5.1', 'luajit5.1', 'luajit2.0', 'luajit', 'libluajit']): if not conf.CheckLib(['luajit-5.1', 'luajit5.1', 'luajit2.0', 'luajit', 'libluajit']):
FatalError("luajit development library not found or not installed") FatalError("luajit development library not found or not installed")
@@ -278,13 +281,16 @@ def findLibs(env, conf):
if not conf.CheckLib(['lua5.2', 'lua-5.2', 'lua52', 'lua']): if not conf.CheckLib(['lua5.2', 'lua-5.2', 'lua52', 'lua']):
FatalError("lua5.2 development library not found or not installed") FatalError("lua5.2 development library not found or not installed")
env.Append(CPPDEFINES=["LUA_COMPAT_ALL"]) env.Append(CPPDEFINES=["LUA_COMPAT_ALL"])
luaver = "lua5.2" if platform == "FreeBSD":
luaver = "lua-5.2"
else:
luaver = "lua5.2"
else: else:
if not conf.CheckLib(['lua5.1', 'lua-5.1', 'lua51', 'lua']): if not conf.CheckLib(['lua5.1', 'lua-5.1', 'lua51', 'lua']):
if platform != "Darwin" or not conf.CheckFramework("Lua"): if platform != "Darwin" or not conf.CheckFramework("Lua"):
FatalError("lua5.1 development library not found or not installed") FatalError("lua5.1 development library not found or not installed")
foundpkg = False foundpkg = False
if platform == "Linux": if platform == "Linux" or platform == "FreeBSD":
try: try:
env.ParseConfig("pkg-config --cflags {0}".format(luaver)) env.ParseConfig("pkg-config --cflags {0}".format(luaver))
env.ParseConfig("pkg-config --libs {0}".format(luaver)) env.ParseConfig("pkg-config --libs {0}".format(luaver))
@@ -298,9 +304,9 @@ def findLibs(env, conf):
if GetOption('luajit'): if GetOption('luajit'):
foundheader = conf.CheckCHeader('luajit-2.0/lua.h') foundheader = conf.CheckCHeader('luajit-2.0/lua.h')
elif GetOption('lua52'): elif GetOption('lua52'):
foundheader = conf.CheckCHeader('lua5.2/lua.h') foundheader = conf.CheckCHeader('lua5.2/lua.h') or conf.CheckCHeader('lua52/lua.h')
else: else:
foundheader = conf.CheckCHeader('lua5.1/lua.h') foundheader = conf.CheckCHeader('lua5.1/lua.h') or conf.CheckCHeader('lua51/lua.h')
if not foundheader: if not foundheader:
if conf.CheckCHeader('lua.h'): if conf.CheckCHeader('lua.h'):
env.Append(CPPDEFINES=["LUA_R_INCL"]) env.Append(CPPDEFINES=["LUA_R_INCL"])
@@ -341,7 +347,7 @@ def findLibs(env, conf):
#Look for OpenGL libraries #Look for OpenGL libraries
if GetOption('opengl'): if GetOption('opengl'):
if platform == "Linux": if platform == "Linux" or platform == "FreeBSD":
if not conf.CheckLib('GL'): if not conf.CheckLib('GL'):
FatalError("libGL not found or not installed") FatalError("libGL not found or not installed")
try: try:
@@ -358,7 +364,7 @@ def findLibs(env, conf):
if not conf.CheckFramework("OpenGL"): if not conf.CheckFramework("OpenGL"):
FatalError("OpenGL framework not found or not installed") FatalError("OpenGL framework not found or not installed")
if platform == "Linux": if platform == "Linux" or platform == "FreeBSD":
if not conf.CheckLib('X11'): if not conf.CheckLib('X11'):
FatalError("X11 development library not found or not installed") FatalError("X11 development library not found or not installed")
@@ -412,7 +418,7 @@ if platform == "Windows":
env.Append(LINKFLAGS=['/NODEFAULTLIB:msvcrtd.lib']) env.Append(LINKFLAGS=['/NODEFAULTLIB:msvcrtd.lib'])
else: else:
env.Append(LINKFLAGS=['-mwindows']) env.Append(LINKFLAGS=['-mwindows'])
elif platform == "Linux": elif platform == "Linux" or platform == "FreeBSD":
env.Append(CPPDEFINES=['LIN']) env.Append(CPPDEFINES=['LIN'])
elif platform == "Darwin": elif platform == "Darwin":
env.Append(CPPDEFINES=['MACOSX']) env.Append(CPPDEFINES=['MACOSX'])