openbsd-ports/games/boswars/patches/patch-SConstruct
ajacoutot acc18e4355 Update to boswars-2.6.
Resign from maintainership.
2010-04-14 18:29:59 +00:00

110 lines
4.5 KiB
Plaintext

$OpenBSD: patch-SConstruct,v 1.5 2010/04/14 18:29:59 ajacoutot Exp $
--- SConstruct.orig Sun Apr 11 14:13:04 2010
+++ SConstruct Mon Apr 12 15:27:22 2010
@@ -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', ['${LOCALBASE}/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', ['${LOCALBASE}/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': ['${X11BASE}/lib'],
+ 'CPPPATH': ['${X11BASE}/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':
@@ -170,7 +179,7 @@ def CheckOpenGL(env, conf):
def CheckLuaLib(env, conf):
if not 'USE_WIN32' in env['CPPDEFINES']:
if env.WhereIs('pkg-config'):
- for packagename in ['lua5.1', 'lua51', 'lua']:
+ for packagename in ['lua']:
exitcode,_ = ParseConfig(env, 'pkg-config --cflags --libs ' + packagename)
if exitcode == 0:
break
@@ -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/'])