gnu: btanks: Switch to scons-python.

* gnu/packages/patches/btanks-scons-python.patch: Add file.
* gnu/packages/patches/btanks-sl08-python.patch: Add file.
* gnu/local.mk: Record patches
* gnu/packages/games.scm (btanks):
  [source]{patches}: Record them.
  [arguments]{scons}: Remove keyword.
  {phases}: Refresh phase 'replace-removed-scons-syntax.
  [inputs]: Add python-wrapper.

Change-Id: Id1e60938a22bf907288871187c0f481ba174e33e
Signed-off-by: Sharlatan Hellseher <sharlatanus@gmail.com>
This commit is contained in:
Nicolas Graves 2025-06-15 00:35:26 +02:00 committed by Sharlatan Hellseher
parent 67c093a1c6
commit 3dc723b83e
No known key found for this signature in database
GPG key ID: 76D727BFF62CD2B5
4 changed files with 222 additions and 8 deletions

View file

@ -1070,6 +1070,8 @@ dist_patch_DATA = \
%D%/packages/patches/bloomberg-bde-tools-fix-install-path.patch \
%D%/packages/patches/boolector-find-googletest.patch \
%D%/packages/patches/boost-fix-duplicate-definitions-bug.patch \
%D%/packages/patches/btanks-scons-python.patch \
%D%/packages/patches/btanks-sl08-python.patch \
%D%/packages/patches/byobu-writable-status.patch \
%D%/packages/patches/bubblewrap-fix-locale-in-tests.patch \
%D%/packages/patches/busybox-add-missing-sha-NI-guard.patch \

View file

@ -10266,12 +10266,14 @@ download and unpack them separately.")
(uri (string-append "mirror://sourceforge/btanks/btanks-source/"
"btanks-" version ".tar.bz2"))
(sha256
(base32 "0ha35kxc8xlbg74wsrbapfgxvcrwy6psjkqi7c6adxs55dmcxliz"))))
(base32 "0ha35kxc8xlbg74wsrbapfgxvcrwy6psjkqi7c6adxs55dmcxliz"))
(patches
(search-patches "btanks-scons-python.patch"
"btanks-sl08-python.patch"))))
(build-system scons-build-system)
(arguments
(list
#:tests? #f ;there are none
#:scons scons-python2
#:scons-flags
#~(list (string-append "prefix=" #$output))
#:phases
@ -10279,12 +10281,11 @@ download and unpack them separately.")
(add-after 'unpack 'replace-removed-scons-syntax
(lambda _
(substitute* "SConstruct"
(("Options")
"Variables")
(("opts.Add\\(BoolOption.*")
"opts.Add('gcc_visibility', 'gcc visibility', 'true')")
(("opts.Add\\(EnumOption.*")
"opts.Add('mode', 'build mode', 'release')"))))
;; XXX: Shorten CheckLibWithHeader.
(("\"xmmintrin\\.h\"")
"'xmmintrin.h'")
(("(conf\\.CheckLibWithHeader\\(.*), \".*\\)" all check)
(string-append check ")")))))
(add-after 'set-paths 'set-sdl-paths
(lambda* (#:key inputs #:allow-other-keys)
(setenv "CPATH"
@ -10326,6 +10327,7 @@ download and unpack them separately.")
libsmpeg-with-sdl1
libvorbis
lua-5.1
python-wrapper
(sdl-union (list sdl sdl-mixer sdl-image sdl-ttf))
zlib))
(native-inputs (list pkg-config zip))

View file

@ -0,0 +1,112 @@
Author: Reiner Herrmann <reiner@reiner-h.de>
Description: Fix build with recent scons version
Bug-Debian: https://bugs.debian.org/947555
--- a/SConstruct
+++ b/SConstruct
@@ -16,7 +16,7 @@
env['BUILDERS']['StaticLibrary'] = picLibBuilder
env['BUILDERS']['Library'] = picLibBuilder
-opts = Options(['options.cache'])
+opts = Variables(['options.cache'])
#opts.Add('CC', 'C compiler')
#opts.Add('CXX', 'C++ compiler')
opts.Add('CCFLAGS', 'General options that are passed to the C compiler')
@@ -33,9 +33,9 @@
opts.Add('lib_dir', 'resources directory (default: prefix/lib)', '')
opts.Add('plugins_dir', 'plugins directory (default: prefix/lib/btanks)', '')
opts.Add('resources_dir', 'resources directory (default: prefix/share/btanks)', '')
- opts.Add(BoolOption('gcc_visibility', 'gcc visibility', 'true'))
+ opts.Add(BoolVariable('gcc_visibility', 'gcc visibility', 'true'))
-opts.Add(EnumOption('mode', 'build mode', 'release', allowed_values=('debug','release')))
+opts.Add(EnumVariable('mode', 'build mode', 'release', allowed_values=('debug','release')))
opts.Update(env)
opts.Save('options.cache', env.Clone())
@@ -47,15 +47,15 @@
Export('debug')
import SCons.Util
-if os.environ.has_key('CC'):
+if 'CC' in os.environ:
env['CC'] = os.environ['CC']
-if os.environ.has_key('CFLAGS'):
+if 'CFLAGS' in os.environ:
env['CCFLAGS'] += SCons.Util.CLVar(os.environ['CFLAGS'])
-if os.environ.has_key('CXX'):
+if 'CXX' in os.environ:
env['CXX'] = os.environ['CXX']
-if os.environ.has_key('CXXFLAGS'):
+if 'CXXFLAGS' in os.environ:
env['CXXFLAGS'] += SCons.Util.CLVar(os.environ['CXXFLAGS'])
-if os.environ.has_key('LDFLAGS'):
+if 'LDFLAGS' in os.environ:
env['LINKFLAGS'] += SCons.Util.CLVar(os.environ['LDFLAGS'])
if (sys.platform != "win32" and env['gcc_visibility']):
@@ -174,7 +174,7 @@
lib_dir = '.'
plugins_dir = ''
try :
- version_file = file('.svnversion', 'r')
+ version_file = open('.svnversion', 'r')
try :
version = version_file.readline().strip()
prefix = env['prefix']
@@ -202,7 +202,7 @@
except:
info = sys.exc_info()
- print "%s %s %s" %(info[0], info[1], info[2])
+ print("%s %s %s" %(info[0], info[1], info[2]))
except :
svnversion = os.popen('svnversion -n .', 'r')
version = svnversion.readline().strip()
@@ -243,29 +243,29 @@
Export('plugins_dir')
version = '0.9.%s' %version
-print "version: %s" %version
+print("version: %s" %version)
bt_sublibs = ['mrt', 'sdlx', 'objects', 'clunk']
env.Append(CPPPATH=['#'])
if (os.path.exists('private')):
dir = 'private'
- BuildDir('#/build/' + buildmode + '/' + dir, dir, 0)
+ VariantDir('#/build/' + buildmode + '/' + dir, dir, 0)
SConscript('#/build/' + buildmode + '/' + dir + '/SConscript')
for dir in bt_sublibs:
- BuildDir('#/build/' + buildmode + '/' + dir, dir, 0)
+ VariantDir('#/build/' + buildmode + '/' + dir, dir, 0)
SConscript('#/build/' + buildmode + '/' + dir + '/SConscript')
for dir in bt_sublibs:
env.Append(LIBPATH=['#/build/' + buildmode + '/' + dir])
-env.BuildDir('#/build/' + buildmode + '/editor', 'editor', 0)
+env.VariantDir('#/build/' + buildmode + '/editor', 'editor', 0)
SConscript('#/build/' + buildmode + '/editor/SConscript')
env.Append(LIBPATH=['#/build/' + buildmode + '/engine'])
-env.BuildDir('#/build/' + buildmode + '/engine', 'engine', 0)
+env.VariantDir('#/build/' + buildmode + '/engine', 'engine', 0)
SConscript('#/build/' + buildmode + '/engine/' + 'SConscript')
if len(install_targets) > 0:
--- a/mrt/SConscript
+++ b/mrt/SConscript
@@ -20,7 +20,7 @@
'net_exception.cpp', 'dict_serializator.cpp',
], LIBS=libs)
-if sys.platform != 'win32' and env.has_key('prefix') and len(env['prefix']) > 0:
+if sys.platform != 'win32' and 'prefix' in env and len(env['prefix']) > 0:
Import('install_targets')
Import('lib_dir')
install_targets.append(Install(lib_dir, mrt))

View file

@ -0,0 +1,98 @@
Description: Convert sl08.py to Python 3
Author: Moritz Muehlenhoff <jmm@debian.org>
Bug-Debian: https://bugs.debian.org/936245
--- btanks-0.9.8083.orig/engine/sl08/sl08.py
+++ btanks-0.9.8083/engine/sl08/sl08.py
@@ -26,7 +26,7 @@ class Generator(object):
def prototype(self, proto):
r = '('
- for i in xrange(0, self.__n):
+ for i in range(0, self.__n):
if proto:
r = r + "arg%d_type " %(i + 1)
r = r + "a%d" %(i + 1)
@@ -41,14 +41,14 @@ class Generator(object):
r = '<typename return_type'
if cname == 'base-signal':
- for i in xrange(0, self.__n):
+ for i in range(0, self.__n):
if not void or i > 0:
r = r + ", "
r = r + "typename arg%d_type" %(i + 1)
r = r + ">"
return r
elif cname == 'signal':
- for i in xrange(0, self.__n):
+ for i in range(0, self.__n):
if not void or i > 0:
r = r + ", "
r = r + "typename arg%d_type" %(i + 1)
@@ -61,7 +61,7 @@ class Generator(object):
r = r + "class validator_type = default_validator<return_type> >"
return r
elif cname == 'slot':
- for i in xrange(0, self.__n):
+ for i in range(0, self.__n):
if not void or i > 0:
r = r + ", "
r = r + "typename arg%d_type" %(i + 1)
@@ -70,7 +70,7 @@ class Generator(object):
r = r + "class object_type>"
return r
elif cname == 'base-slot':
- for i in xrange(0, self.__n):
+ for i in range(0, self.__n):
if not void or i > 0:
r = r + ", "
r = r + "typename arg%d_type" %(i + 1)
@@ -86,22 +86,22 @@ class Generator(object):
r = '<return_type'
if cname == 'base-signal':
- for i in xrange(0, self.__n):
+ for i in range(0, self.__n):
r = r + ", arg%d_type" %(i + 1)
r = r + ">"
return r
elif cname == 'signal':
- for i in xrange(0, self.__n):
+ for i in range(0, self.__n):
r = r + ", arg%d_type" %(i + 1)
r = r + ", validator_type>"
return r
elif cname == 'slot':
- for i in xrange(0, self.__n):
+ for i in range(0, self.__n):
r = r + ", arg%d_type" %(i + 1)
r = r + ", object_type>"
return r
elif cname == 'base-slot':
- for i in xrange(0, self.__n):
+ for i in range(0, self.__n):
r = r + ", arg%d_type" %(i + 1)
r = r + ">"
return r
@@ -329,11 +329,11 @@ class Generator(object):
text = ''
-for i in xrange(0, 6):
+for i in range(0, 6):
g = Generator(i)
text = text + "\n" + g.generate();
-print """#ifndef BTANKS_SL08_SLOTSANDSIGNALS_H__
+print("""#ifndef BTANKS_SL08_SLOTSANDSIGNALS_H__
#define BTANKS_SL08_SLOTSANDSIGNALS_H__
/* sl08 - small slot/signals library
@@ -387,5 +387,5 @@ namespace sl08 {
}
#endif
-""" %(text);
+""" %(text));