Thomas Frohwein <[email protected]> writes:
> I discussed with Omar off-list that it may be worth tackling this in
> chunks. He suggested starting with games/boswars and games/pingus that
> compile with current scons.
>
> On Tue, Oct 26, 2021 at 05:51:45PM +0200, Omar Polo wrote:
> [...]
>> games/boswars
>>
>> 2to3 changes plus:
>>
>> - some love for the makefile (only aesthetic changes)
>> - drop -fexpensive-optimizations: base clang complained that's a
>> "optimization flag not supported". Should be a no-op.
>>
> [...]
>> games/pingus
>>
>> 2to3 then runs fine.
>
> Both ports are without maintainer; I built both with current scons and
> tested quick runtime without problems. I think it may be best to bump
> REVISION even with the changes applying mainly to the build system.
the content of the packages should be the same because the removal of
-fexpensive-optimizations should be a noop on clang (11 at least), but I
agree: let's stay on the safe side and bump the REVISION.
> Here is the diff for just the 2 ports with my ok.
thanks :)
games/dangerdeep also could be committed before the scons update.
The following diff only changes BuildDir to VariantDir (builddir was
deprecated in scons 2 if not even before and removed with 3.x or 4.x)
and fixes the indentation (python3 is picky wrt mixing spaces and tabs.)
The port runs fine and is without a MAINTAINER. I've not bumped the
REVISION this time.
Cheers,
Omar Polo
P.S.: with these three in, the diff for scons 4 is significantly
smaller, thanks again! I should have splitted them from the
start.
Index: patches/patch-SConstruct
===================================================================
RCS file: /home/cvs/ports/games/dangerdeep/patches/patch-SConstruct,v
retrieving revision 1.2
diff -u -p -r1.2 patch-SConstruct
--- patches/patch-SConstruct 12 Jan 2018 20:13:31 -0000 1.2
+++ patches/patch-SConstruct 21 Oct 2021 09:12:50 -0000
@@ -1,6 +1,143 @@
$OpenBSD: patch-SConstruct,v 1.2 2018/01/12 20:13:31 kili Exp $
---- SConstruct.orig Sat May 8 03:41:20 2010
-+++ SConstruct Sat Jun 1 11:12:50 2013
+Index: SConstruct
+--- SConstruct.orig
++++ SConstruct
+@@ -49,7 +49,7 @@ if (env.GetOption('clean') or conf == '0'):
+
+ if sys.platform == 'win32':
+ checkconf = False
+- print "Compiling for Win32 Environment"
++ print("Compiling for Win32 Environment")
+ env = Environment(ENV = os.environ)
+
+ env.Append(CPPDEFINES = ['WIN32','NOMINMAX','DEBUG'])
+@@ -68,7 +68,7 @@ if sys.platform == 'win32':
+ build_dir = 'win32'
+
+ elif sys.platform == 'darwin':
+- print "Compiling for MacOSX"
++ print("Compiling for MacOSX")
+ env = Environment(ENV = os.environ)
+ env.Append(CPPPATH =
['/System/Library/Frameworks/AGL.framework/Headers',
'/System/Library/Frameworks/OpenGL.framework/Headers','/Developer/SDKs/MacOSX10.4u.sdk/usr/X11R6/include'
, './Mac'])
+ libpath = ['/System/Library/Frameworks/OpenGL.framework/Libraries',
'/usr/local/lib', '/usr/lib']
+@@ -79,11 +79,11 @@ elif sys.platform == 'darwin':
+ datadir = './data' # use slashes as separator always. C/C++ want
it so.
+ build_dir = 'macosx'
+ osspecificsrc = Split("""Mac/SDLMain.m""")
+- if (debug == 1):
+- env.Append(CCFLAGS = '-g')
+- env.Append(CPPDEFINES = ['DEBUG'])
++ if (debug == 1):
++ env.Append(CCFLAGS = '-g')
++ env.Append(CPPDEFINES = ['DEBUG'])
+ elif (sys.platform == 'freebsd5') or (sys.platform == 'freebsd6') or
(sys.platform == 'freebsd7'):
+- print "Compiling for FreeBSD Environment"
++ print("Compiling for FreeBSD Environment")
+ env = Environment(ENV = os.environ)
+ LOCALBASE = os.environ['LOCALBASE']
+ X11BASE = os.environ['X11BASE']
+@@ -99,45 +99,45 @@ elif (sys.platform == 'freebsd5') or (sys.platform ==
+ cpuinfol = cpuinfof.readlines()
+ mmxsupported = False
+ ssesupported = False
+- for i in cpuinfol:
++ for i in cpuinfol:
+ if i == '1\n':
+ mmxsupported = True
+ ssesupported = True
+ if (usex86sse == 0) and (mmxsupported and ssesupported):
+- usex86sse = 1
+- if usex86sse >= 1:
++ usex86sse = 1
++ if usex86sse >= 1:
+ env.Append(CCFLAGS = '-msse')
+- env.Append(CPPDEFINES = ['USE_SSE'])
+- osspecificsrc += []
+- print 'Using x86 SSE/MMX optimizations.'
++ env.Append(CPPDEFINES = ['USE_SSE'])
++ osspecificsrc += []
++ print('Using x86 SSE/MMX optimizations.')
+
+- env.Replace(CCFLAGS = os.environ['CFLAGS'])
++ env.Replace(CCFLAGS = os.environ['CFLAGS'])
+ if (debug == 1):
+ env.Append(CCFLAGS = '-g')
+ env.Append(CPPDEFINES = ['DEBUG'])
+- env.Replace(CXXFLAGS = os.environ['CXXFLAGS'] + ' `' + SDL_CONFIG + '
--cflags`')
+- env.Append(LINKFLAGS = '`' + SDL_CONFIG + ' --libs`')
+- datadir = '/usr/local/share/dangerdeep'
+- build_dir = 'freebsd'
++ env.Replace(CXXFLAGS = os.environ['CXXFLAGS'] + ' `' + SDL_CONFIG + '
--cflags`')
++ env.Append(LINKFLAGS = '`' + SDL_CONFIG + ' --libs`')
++ datadir = '/usr/local/share/dangerdeep'
++ build_dir = 'freebsd'
+
+- if (checkconf == True and os.system('grep glBindProgram ' + X11BASE +
'/include/GL/gl*.h > /dev/null') == 0):
+- gllibdirs = [X11BASE + '/lib/', '/usr/lib/', LOCALBASE +
'/lib/']
+- gllibdir = ''
+- for i in gllibdirs:
+- if (os.system('test -f '+i+'libGL.so') == 0):
+- gllibdir = i
+- break
+- if (gllibdir == ''):
+- print 'ERROR: no libGL.so detected!'
+- else:
+- print 'Found GL library "'+gllibdir+'libGL.so"'
+- if (os.system('grep glBindProgram '+gllibdir+'libGL.so >
/dev/null') != 0):
+- print 'GL headers declare glBindProgram, but libGL.so
has no such symbol! Ignoring all undefined symbols...'
+- # I'm not sure which option will hopefully fix the
problem... so i use both...
+- env.Append(LINKFLAGS =
'--unresolved-symbols=ignore-all')
+- env.Append(LINKFLAGS = '-Xlinker --unresolved-symbols
-Xlinker ignore-all')
++ if (checkconf == True and os.system('grep glBindProgram ' + X11BASE +
'/include/GL/gl*.h > /dev/null') == 0):
++ gllibdirs = [X11BASE + '/lib/', '/usr/lib/', LOCALBASE +
'/lib/']
++ gllibdir = ''
++ for i in gllibdirs:
++ if (os.system('test -f '+i+'libGL.so') == 0):
++ gllibdir = i
++ break
++ if (gllibdir == ''):
++ print('ERROR: no libGL.so detected!')
++ else:
++ print('Found GL library "'+gllibdir+'libGL.so"')
++ if (os.system('grep glBindProgram '+gllibdir+'libGL.so >
/dev/null') != 0):
++ print('GL headers declare glBindProgram, but libGL.so
has no such symbol! Ignoring all undefined symbols...')
++ # I'm not sure which option will hopefully fix the
problem... so i use both...
++ env.Append(LINKFLAGS =
'--unresolved-symbols=ignore-all')
++ env.Append(LINKFLAGS = '-Xlinker --unresolved-symbols
-Xlinker ignore-all')
+ elif 0 != mingw32:
+- print "Compiling for mingw32 Environment"
++ print("Compiling for mingw32 Environment")
+ env = Environment(ENV = os.environ, tools = ['mingw'])
+
+ env.Append(CPPPATH = [ mingw32root + '/usr/include/', mingw32root +
'/usr/include/GL/', mingw32root + '/usr/include/SDL/' ] )
+@@ -171,12 +171,12 @@ elif 0 != mingw32:
+ osspecificsrc += []
+ env.Append(CCFLAGS = '-msse')
+ env.Append(CPPDEFINES = ['USE_SSE'])
+- print 'Using x86 SSE/MMX optimizations with GCC intrinsics.'
++ print('Using x86 SSE/MMX optimizations with GCC intrinsics.')
+ datadir = './data' # use slashes as separator always. C/C++ want
it so.
+ build_dir = 'mingw32'
+ else:
+ SConsignFile()
+- print "Compiling for GNU/Linux Environment (" + sys.platform + ")"
++ print("Compiling for GNU/Linux Environment (" + sys.platform + ")")
+ env = Environment(ENV = os.environ)
+
+ env.Append(CPPPATH = ['/usr/include/SDL', '/usr/include/GL'])
+@@ -192,10 +192,10 @@ else:
+
+ # allow arch to be over-ridden if need be.
+ if archflag != '':
+- print 'Using architecture: ' + archflag + ' (Changed from ' +
arch + ')'
++ print('Using architecture: ' + archflag + ' (Changed from ' +
arch + ')')
+ arch = archflag
+ else:
+- print 'Using architecture: ' + arch
++ print('Using architecture: ' + arch)
+
+ # Set libpath accordingly
+ if arch == 'x86_64':
@@ -207,8 +207,6 @@ else:
# Set libpath for real
libpath = [archlib, archlib + '/X11', '/usr/X11R6/lib']
@@ -18,7 +155,28 @@ $OpenBSD: patch-SConstruct,v 1.2 2018/01
env.Append(CPPDEFINES = ['DEBUG'])
elif (debug == -1):
ccflags += ' -g -O3 -mfpmath=sse -mmmx -msse -m3dnow'
-@@ -258,18 +255,18 @@ else:
+@@ -239,10 +236,10 @@ else:
+
+ if (useefence >= 1):
+ extralibs += ['efence']
+- print 'Linking to ElectricFence library!'
++ print('Linking to ElectricFence library!')
+ elif (useduma >= 1):
+ extralibs += ['duma']
+- print 'Linking to DUMA (EletricFence successor) library!'
++ print('Linking to DUMA (EletricFence successor) library!')
+ if (cvedit == 1):
+ env.Append(CPPDEFINES = ['CVEDIT'])
+
+@@ -252,25 +249,25 @@ else:
+ osspecificsrc += []
+ if (usex86sse >= 2):
+ env.Append(CPPDEFINES = ['USE_SSE_ALWAYS'])
+- print 'Using x86 SSE/MMX optimizations with GCC
intrinsics ALWAYS WITHOUT DETECTION!'
++ print('Using x86 SSE/MMX optimizations with GCC
intrinsics ALWAYS WITHOUT DETECTION!')
+ else:
+- print 'Using x86 SSE/MMX optimizations with GCC
intrinsics.'
++ print('Using x86 SSE/MMX optimizations with GCC
intrinsics.')
env.Append(CCFLAGS = ccflags)
# check for broken libGL, ignore undefined symbols then
@@ -32,15 +190,28 @@ $OpenBSD: patch-SConstruct,v 1.2 2018/01
gllibdir = i
break
if (gllibdir == ''):
- print 'ERROR: no libGL.so detected!'
+- print 'ERROR: no libGL.so detected!'
++ print('ERROR: no libGL.so detected!')
else:
- print 'Found GL library "'+gllibdir+'libGL.so"'
+- print 'Found GL library "'+gllibdir+'libGL.so"'
- if (os.system('grep glBindProgram '+gllibdir+'libGL.so >
/dev/null') != 0):
+- print 'GL headers declare glBindProgram, but libGL.so
has no such symbol! Ignoring all undefined symbols...'
++ print('Found GL library "'+gllibdir+'libGL.so"')
+ if (os.system('grep glBindProgram '+gllibdir+'libGL.so* >
/dev/null') != 0):
- print 'GL headers declare glBindProgram, but libGL.so
has no such symbol! Ignoring all undefined symbols...'
++ print('GL headers declare glBindProgram, but libGL.so
has no such symbol! Ignoring all undefined symbols...')
# I'm not sure which option will hopefully fix the
problem... so i use both...
env.Append(LINKFLAGS =
'--unresolved-symbols=ignore-all')
-@@ -289,6 +286,12 @@ target_dir = '#build' + os.sep + build_dir
+ env.Append(LINKFLAGS = '-Xlinker --unresolved-symbols
-Xlinker ignore-all')
+@@ -282,13 +279,19 @@ installbindir = '/usr/local/bin'
+ if ARGUMENTS.get('installbindir', 0):
+ installbindir = ARGUMENTS.get('installbindir', 0)
+
+-print 'Install binary path: ' + installbindir
+-print 'Using data dir: ' + datadir
++print('Install binary path: ' + installbindir)
++print('Using data dir: ' + datadir)
+
+ target_dir = '#build' + os.sep + build_dir
source_base_dir = 'src'
libpath = libpath + [target_dir]
env.Append(LIBPATH = libpath)
@@ -53,3 +224,38 @@ $OpenBSD: patch-SConstruct,v 1.2 2018/01
################ configure
if(checkconf == True):
+@@ -297,20 +300,20 @@ if(checkconf == True):
+ if (devel == 0):
+ for i in ['GL', 'GLU', 'SDL', 'SDL_image', 'SDL_mixer',
'fftw3', 'bz2']:
+ if not conf.CheckLib(i):
+- print 'Library ' + i + ' is missing, it must be
installed!'
++ print('Library ' + i + ' is missing, it must be
installed!')
+ Exit(1)
+ for i in ['gl.h', 'glu.h', 'SDL.h', 'SDL_image.h',
'SDL_mixer.h', 'fftw3.h', 'bzlib.h']:
+ if not conf.CheckHeader(i):
+- print 'Include file ' + i + ' is missing,
install matching development library!'
++ print('Include file ' + i + ' is missing,
install matching development library!')
+ Exit(1)
+ if conf.CheckLibWithHeader('fftw3f', 'fftw3.h', 'C'):
+- print 'fftw3 library supports float type. Using it...'
++ print('fftw3 library supports float type. Using it...')
+ fftwlib = 'fftw3f'
+ conf.env.Append(CPPDEFINES = ['WITH_FLOAT_FFTW'])
+ else:
+- print 'fftw3 library does not support float type.'
++ print('fftw3 library does not support float type.')
+ if conf.CheckLibWithHeader('avutil',
'ffmpeg/libavutil/avutil.h', 'C'):
+- print 'libavutil found...'
++ print('libavutil found...')
+ ffmpeg_available = True
+ else:
+ fftwlib = 'fftw3f'
+@@ -347,7 +350,7 @@ Export('env', 'gfxlibs', 'alllibs', 'installbindir', '
+
+ SConscript(source_base_dir + os.sep + 'SConscript', build_dir = target_dir,
duplicate = 0)
+
+-BuildDir(target_dir, source_base_dir, duplicate=0)
++VariantDir(target_dir, source_base_dir, duplicate=0)
+
+ ############### Helper functions
+ def findSVN(basedir):