openbsd-ports/games/boswars/patches/patch-SConstruct
2012-07-10 15:22:44 +00:00

101 lines
4.1 KiB
Plaintext

$OpenBSD: patch-SConstruct,v 1.6 2012/07/10 15:22:45 jasper Exp $
--- SConstruct.orig Sun Apr 18 20:04:54 2010
+++ SConstruct Mon Jul 9 19:37:51 2012
@@ -32,12 +32,12 @@ SConsignFile()
def DefineOptions(filename, args):
opts = Variables(filename, args)
- opts.Add('CPPPATH', 'Additional preprocessor paths', ['/usr/local/include'])
+ opts.Add('CPPPATH', 'Additional preprocessor paths', ['/usr/local/include'], Split(''))
opts.Add('CPPFLAGS', 'Additional preprocessor flags')
opts.Add('CPPDEFINES', 'defined constants', Split(''))
- opts.Add('LIBPATH', 'Additional library paths', ['/usr/local/lib'])
+ opts.Add('LIBPATH', 'Additional library paths', ['/usr/local/lib'], Split(''))
opts.Add('LIBS', 'Additional libraries')
- opts.Add('CCFLAGS', 'C Compiler flags', Split(ccflags))
+ opts.Add('CCFLAGS', 'C Compiler flags', Split(ccflags), Split(''))
opts.Add('LINKFLAGS', 'Linker Compiler flags')
opts.Add('CC', 'C Compiler')
opts.Add('CXX', 'C++ Compiler')
@@ -51,6 +51,9 @@ def DefineOptions(filename, args):
opts = DefineOptions("build_options.py", ARGUMENTS)
env = Environment(ENV = {'PATH':os.environ['PATH']}) # for an unknown reason Environment(options=opts) doesnt work well
opts.Update(env) # Needed as Environment(options=opts) doesnt seem to work
+env['CCFLAGS'] = Split(ccflags) + Split(env['CCFLAGS'])
+env['CPPPATH'] = Split(env['CPPPATH'])
+env['LIBPATH'] = Split(env['LIBPATH'])
Help(opts.GenerateHelpText(env))
mingw = env.Clone()
optionsChanged = True
@@ -144,6 +147,10 @@ def CheckOpenGL(env, conf):
'LIBS': ['GL'],
'LIBPATH': ['/usr/lib', '/usr/X11R6/lib'],
'CPPPATH': ['/usr/include']}
+ opengl['openbsd'] = {
+ 'LIBS': ['GL'],
+ 'LIBPATH': ['/usr/X11R6/lib'],
+ 'CPPPATH': ['/usr/X11R6/include']}
opengl['cygwin'] = {
'LIBS': ['opengl3']}
opengl['darwin'] = {
@@ -155,6 +162,8 @@ def CheckOpenGL(env, conf):
else:
if sys.platform[:5] == 'linux':
platform = 'linux'
+ if sys.platform[:7] == 'openbsd':
+ platform = 'openbsd'
glconfig = opengl.get(platform, {})
for key in glconfig:
if key != 'LIBS':
@@ -178,7 +187,7 @@ def CheckLuaLib(env, conf):
return 1
if conf.CheckLibWithHeader('lua5.1', 'lua.h', 'c'):
return 1
- if not conf.CheckLibWithHeader('lua', 'lua.h', 'c'):
+ if not conf.CheckLibWithHeader('lua', 'lualib.h', 'c'):
return 0
# make sure we have lualib which is included in lua 5.1
if conf.CheckFunc('luaopen_base'):
@@ -189,13 +198,13 @@ def AutoConfigure(env):
conf = Configure(env)
## check for required libs ##
- if not conf.CheckLibWithHeader('png', 'png.h', 'c'):
- print 'Did not find png library or headers, exiting!'
- Exit(1)
if not conf.CheckLibWithHeader('z', 'zlib.h', 'c'):
print 'Did not find the zlib library or headers, exiting!'
Exit(1)
- if not 'USE_WIN32' in env['CPPDEFINES'] and not sys.platform.startswith('freebsd'):
+ if not conf.CheckLibWithHeader('png', 'png.h', 'c'):
+ print 'Did not find png library or headers, exiting!'
+ Exit(1)
+ if not 'USE_WIN32' in env['CPPDEFINES'] and not sys.platform.startswith('openbsd'):
if not conf.CheckLib('dl'):
print 'Did not find dl library or header which is needed on some systems for lua. Exiting!'
Exit(1)
@@ -207,12 +216,12 @@ def AutoConfigure(env):
Exit(1)
# Check for optional libraries #
+ if conf.CheckLib('ogg'):
+ env.Append(CPPDEFINES = 'USE_OGG')
if conf.CheckLib('vorbis'):
env.Append(CPPDEFINES = 'USE_VORBIS')
if conf.CheckLib('theora'):
env.Append(CPPDEFINES = 'USE_THEORA')
- if conf.CheckLib('ogg'):
- env.Append(CPPDEFINES = 'USE_OGG')
# check for optional functions
if conf.CheckFunc('strcasestr'):
@@ -265,7 +274,7 @@ addBosWarsPaths(env)
# define the different build environments (variants)
release = env.Clone()
-release.Append(CCFLAGS = Split('-O2 -pipe -fomit-frame-pointer -fexpensive-optimizations -ffast-math'))
+release.Append(CCFLAGS = Split('-fomit-frame-pointer -fexpensive-optimizations -ffast-math'))
if mingw['extrapath']:
mingw.Tool('crossmingw', toolpath = ['tools/scons/'])