Stuart Henderson <s...@spacehopper.org> writes: > On 2021/10/28 12:00, Omar Polo wrote: >> >> Thomas Frohwein <tfrohw...@fastmail.com> 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. > > Maybe just run 2to3 in the port rather than adding a 2to3-generated > patch? (If more changes are needed on top of 2to3's output, running 2to3 > in pre-patch lets you do that without having the whole lot in patches).
I like the idea. Diff below does that for boswars and pingus (to apply from /usr/ports/games.) It reduces the churn and for pingus patching is not even needed anymore. The drawback is that for 2to3 I have to add a BDEP on python3.8 on those two ports, but we can remove that after the scons 4 update eventually. Index: boswars/Makefile =================================================================== RCS file: /home/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 13:29:07 -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 @@ -25,7 +25,8 @@ MODSCONS_FLAGS= CPPPATH="${LOCALBASE}/in opengl=1 BUILD_DEPENDS= devel/sdl-image \ - graphics/optipng + graphics/optipng \ + lang/python/3.8 LIB_DEPENDS= devel/sdl \ multimedia/libtheora \ audio/libvorbis \ @@ -34,8 +35,14 @@ 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 +pre-patch: + 2to3 -w ${WRKSRC}/SConstruct + +# 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 +57,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: /home/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 13:27:16 -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): @@ -47,7 +48,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,25 +68,25 @@ $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,13 +193,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!' +- 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!') 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!') Exit(1) -@@ -207,12 +216,12 @@ def AutoConfigure(env): +@@ -207,12 +211,12 @@ def AutoConfigure(env): Exit(1) # Check for optional libraries # @@ -89,12 +101,21 @@ $OpenBSD: patch-SConstruct,v 1.7 2013/09 # check for optional functions if conf.CheckFunc('strcasestr'): -@@ -265,7 +274,7 @@ addBosWarsPaths(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: /home/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 13:31:26 -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 @@ -21,7 +21,8 @@ MODULES= devel/scons COMPILER = base-clang ports-gcc -BUILD_DEPENDS= devel/boost +BUILD_DEPENDS= devel/boost \ + lang/python/3.8 LIB_DEPENDS= converters/libiconv \ devel/sdl-mixer \ devel/sdl-image @@ -30,6 +31,9 @@ NO_TEST= Yes pre-configure: ${SUBST_CMD} ${WRKSRC}/src/pingus/pingus_main.cpp + +pre-patch: + 2to3 -w ${WRKSRC}/SConscript do-build: cd ${WRKSRC} && ${SETENV} ${MAKE_ENV} ${MODSCONS_BIN} \