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.

Here is the diff for just the 2 ports with my ok.

Index: boswars/Makefile
===================================================================
RCS file: /cvs/ports/games/boswars/Makefile,v
retrieving revision 1.27
diff -u -p -r1.27 Makefile
--- boswars/Makefile    17 Oct 2021 12:19:12 -0000      1.27
+++ boswars/Makefile    28 Oct 2021 02:36:48 -0000
@@ -7,15 +7,15 @@ DISTNAME=     boswars-${V}-src
 PKGNAME=       boswars-${V}
 CATEGORIES=    games x11
 MASTER_SITES=  http://www.boswars.org/dist/releases/
-REVISION=      2
+REVISION=      3
 
 HOMEPAGE=      http://www.boswars.org/
 
 # GPLv2
 PERMIT_PACKAGE=        Yes
 
-WANTLIB +=     GL SDL X11 c m ogg png pthread ${COMPILER_LIBCXX} theora vorbis 
z
-WANTLIB +=     ${MODLUA_WANTLIB}
+WANTLIB += ${COMPILER_LIBCXX} GL SDL X11 c m ogg png theora vorbis z
+WANTLIB += ${MODLUA_WANTLIB}
 
 COMPILER =             base-clang ports-gcc base-gcc
 
@@ -34,8 +34,11 @@ LIB_DEPENDS= devel/sdl \
 
 NO_TEST=       Yes
 
-DATA_DIR=      campaigns graphics intro languages maps patches scripts sounds 
units
+DATA_DIR=      campaigns graphics intro languages maps patches \
+               scripts sounds units
 
+# the shipped images are considered broken by newer libpng: use opting
+# to fix them
 pre-configure:
        @${SUBST_CMD} ${WRKSRC}/SConstruct \
                ${WRKSRC}/engine/include/stratagus.h
@@ -50,7 +53,8 @@ do-install:
        ${INSTALL_PROGRAM} ${WRKSRC}/build/boswars-release \
            ${PREFIX}/bin/boswars
        ${INSTALL_DATA} ${WRKSRC}/doc/*.html ${PREFIX}/share/doc/boswars/html
-       ${INSTALL_DATA} ${WRKSRC}/doc/scripts/{*.html,*.py} 
${PREFIX}/share/doc/boswars/html/scripts
+       ${INSTALL_DATA} ${WRKSRC}/doc/scripts/{*.html,*.py} \
+               ${PREFIX}/share/doc/boswars/html/scripts
 .for i in ${DATA_DIR}
        cp -R ${WRKSRC}/${i} ${PREFIX}/share/boswars
 .endfor
Index: boswars/patches/patch-SConstruct
===================================================================
RCS file: /cvs/ports/games/boswars/patches/patch-SConstruct,v
retrieving revision 1.7
diff -u -p -r1.7 patch-SConstruct
--- boswars/patches/patch-SConstruct    24 Sep 2013 04:53:18 -0000      1.7
+++ boswars/patches/patch-SConstruct    28 Oct 2021 02:36:48 -0000
@@ -1,6 +1,7 @@
 $OpenBSD: patch-SConstruct,v 1.7 2013/09/24 04:53:18 brad Exp $
---- SConstruct.orig    Sun Jun  2 08:41:11 2013
-+++ SConstruct Sat Sep 14 21:46:08 2013
+Index: SConstruct
+--- SConstruct.orig
++++ SConstruct
 @@ -32,12 +32,12 @@ SConsignFile()
  
  def DefineOptions(filename, args):
@@ -27,6 +28,15 @@ $OpenBSD: patch-SConstruct,v 1.7 2013/09
  Help(opts.GenerateHelpText(env))
  mingw = env.Clone()
  optionsChanged = True
+@@ -122,7 +125,7 @@ def ParseConfig(env, command, function=None):
+                 flags['LINKFLAGS'].append(arg)
+             else:
+                 flags['CCFLAGS'].append(arg)
+-        apply(env.Append, (), flags)
++        env.Append(*(), **flags)
+         return static_libs
+ 
+     if function is None:
 @@ -144,6 +147,10 @@ def CheckOpenGL(env, conf):
        'LIBS': ['GL'], 
        'LIBPATH': ['/usr/lib', '/usr/X11R6/lib'],
@@ -47,7 +57,18 @@ $OpenBSD: patch-SConstruct,v 1.7 2013/09
       glconfig = opengl.get(platform, {})
    for key in glconfig:
        if key != 'LIBS':
-@@ -178,7 +187,7 @@ def CheckLuaLib(env, conf):
+@@ -168,17 +177,12 @@ def CheckOpenGL(env, conf):
+   return True
+ 
+ def CheckLuaLib(env, conf):
+-  if not 'USE_WIN32' in env['CPPDEFINES']:
+-     if env.WhereIs('pkg-config'):
+-        for packagename in ['lua5.1', 'lua51', 'lua']:
+-           exitcode,_ = ParseConfig(env, 'pkg-config --cflags --libs ' + 
packagename)
+-           if exitcode == 0:
+-              break
++  env.ParseConfig('pkg-config --cflags --libs lua51')
+   if conf.CheckLibWithHeader('lua51', 'lua.h', 'c'):
      return 1
    if conf.CheckLibWithHeader('lua5.1', 'lua.h', 'c'):
      return 1
@@ -56,7 +77,7 @@ $OpenBSD: patch-SConstruct,v 1.7 2013/09
      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):
+@@ -189,30 +193,30 @@ def AutoConfigure(env):
    conf = Configure(env)
  
    ## check for required libs ##
@@ -64,17 +85,25 @@ $OpenBSD: patch-SConstruct,v 1.7 2013/09
 -     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!'
+-     print 'Did not find the zlib library or headers, exiting!'
++     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!'
++     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!'
+-        print 'Did not find dl library or header which is needed on some 
systems for lua. Exiting!'
++        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):
+   if not CheckLuaLib(env, conf):
+-     print 'Did not find required lua library. Exiting!'
++     print('Did not find required lua library. Exiting!')
+      Exit(1)
+   if not CheckOpenGL(env, conf):
+-     print 'Did not find required OpenGL library. Exiting!'
++     print('Did not find required OpenGL library. Exiting!')
       Exit(1)
  
    # Check for optional libraries #
@@ -89,12 +118,48 @@ $OpenBSD: patch-SConstruct,v 1.7 2013/09
  
    # check for optional functions
    if conf.CheckFunc('strcasestr'):
-@@ -265,7 +274,7 @@ addBosWarsPaths(env)
+@@ -232,7 +236,7 @@ def AutoConfigure(env):
+     env.ParseConfig('sdl-config --libs')
+     if sys.platform != "darwin" and not '-Dmain=SDL_main' in env['CCFLAGS']:
+        if not conf.CheckLibWithHeader('SDL', 'SDL.h', 'c'):
+-          print 'Did not find SDL library or headers, exiting!'
++          print('Did not find SDL library or headers, exiting!')
+           Exit(1)
+ 
+   env = conf.Finish()
+@@ -245,14 +249,14 @@ def AutoConfigureIfNeeded(env, name):
+             # Remove outdated cache file
+             os.remove(cachename)
+    if optionsChanged or not os.path.exists(cachename):
+-      print cachename + " doesn't exist or out of date."
+-      print "Generating new build config cache ..."
++      print(cachename + " doesn't exist or out of date.")
++      print("Generating new build config cache ...")
+       cache = DefineOptions(cachename, {})
+       AutoConfigure(env)
+       cache.Save(cachename, env)
+    else:
+       cache = DefineOptions(cachename, {})
+-      print "Using " + cachename
++      print("Using " + cachename)
+       cache.Update(env)
+ 
+ AutoConfigureIfNeeded(env, '')
+@@ -265,7 +269,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'))
++release.Append(CCFLAGS = Split('-fomit-frame-pointer -ffast-math'))
  
  if mingw['extrapath']:
    mingw.Tool('crossmingw', toolpath = ['tools/scons/'])
+@@ -311,7 +315,7 @@ if sys.platform.startswith('linux') or sys.platform.st
+ def DefineVariant(venv, v, vv = None):
+    if vv == None:
+       vv = '-' + v
+-   BuildDir('build/' + v, engineSourceDir, duplicate = 0)
++   VariantDir('build/' + v, engineSourceDir, duplicate = 0)
+    r = venv.Program('build/boswars' + vv, buildSourcesList('build/' + v))
+    Alias(v, 'boswars' + vv)
+    return r 
Index: pingus/Makefile
===================================================================
RCS file: /cvs/ports/games/pingus/Makefile,v
retrieving revision 1.23
diff -u -p -r1.23 Makefile
--- pingus/Makefile     21 Oct 2020 00:05:36 -0000      1.23
+++ pingus/Makefile     28 Oct 2021 02:36:49 -0000
@@ -3,7 +3,7 @@
 COMMENT=       free Lemmings-like game
 
 DISTNAME=      pingus-0.7.6
-REVISION=      6
+REVISION=      7
 CATEGORIES=    games x11
 
 EXTRACT_SUFX=  .tar.bz2
Index: pingus/patches/patch-SConscript
===================================================================
RCS file: /cvs/ports/games/pingus/patches/patch-SConscript,v
retrieving revision 1.3
diff -u -p -r1.3 patch-SConscript
--- pingus/patches/patch-SConscript     21 Oct 2020 00:05:36 -0000      1.3
+++ pingus/patches/patch-SConscript     28 Oct 2021 02:36:49 -0000
@@ -13,6 +13,23 @@ Index: SConscript
          self.opts.Add('LINKFLAGS',  'Linker Compiler flags', [])
  
          self.opts.Add(BoolVariable('with_opengl',        'Build with OpenGL 
support', True))
+@@ -126,12 +125,12 @@ class Project:
+     def configure_end(self):
+         self.env = self.conf.Finish()
+ 
+-        print "Reports:"
+-        print self.reports
++        print("Reports:")
++        print(self.reports)
+ 
+         if not self.fatal_error == "":
+-            print "Fatal Errors:"
+-            print self.fatal_error
++            print("Fatal Errors:")
++            print(self.fatal_error)
+             Exit(1)
+ 
+     def configure_gxx(self): 
 @@ -182,14 +181,13 @@ class Project:
          else:
              self.reports += "  * XInput support: yes\n"

Reply via email to