waf: upgrade to waf 2.1.1/waifu 1.3.0. Try to fix most optparse->argparse migration issues

This commit is contained in:
Alibek Omarov 2024-05-25 04:58:28 +03:00
parent 4bf72b5383
commit 823fe9ebbd
10 changed files with 43 additions and 45 deletions

View File

@ -21,16 +21,16 @@ def options(opt):
help = 'enable custom swap allocator. For devices with no swap support')
grp.add_option('--enable-legacy-sdl', action = 'store_true', dest = 'SDL12', default = False,
help = 'enable using SDL1.2 instead of SDL2(not recommended) [default: %default]')
help = 'enable using SDL1.2 instead of SDL2(not recommended) [default: %(default)s]')
grp.add_option('--enable-static-binary', action = 'store_true', dest = 'STATIC', default = False,
help = 'build static binary(not recommended, --single-binary required) [default: %default]')
help = 'build static binary(not recommended, --single-binary required) [default: %(default)s]')
grp.add_option('--enable-engine-tests', action = 'store_true', dest = 'ENGINE_TESTS', default = False,
help = 'embed tests into the engine, jump into them by -runtests command line switch [default: %default]')
help = 'embed tests into the engine, jump into them by -runtests command line switch [default: %(default)s]')
grp.add_option('--enable-engine-fuzz', action = 'store_true', dest = 'ENGINE_FUZZ', default = False,
help = 'add LLVM libFuzzer [default: %default]' )
help = 'add LLVM libFuzzer [default: %(default)s]' )
opt.load('sdl2')

View File

@ -12,7 +12,7 @@ def options(opt):
grp = opt.add_option_group('Game launcher options')
grp.add_option('--disable-menu-changegame', action = 'store_true', dest = 'DISABLE_MENU_CHANGEGAME', default = False,
help = 'disable changing the game from the menu [default: %default]')
help = 'disable changing the game from the menu [default: %(default)s]')
def configure(conf):
if conf.env.DEST_OS == 'win32':

View File

@ -11,7 +11,7 @@ def options(opt):
grp = opt.add_option_group('ref_gl options')
grp.add_option('--enable-static-gl', action='store_true', dest='GL_STATIC', default=False,
help = 'enable direct linking to opengl [default: %default]')
help = 'enable direct linking to opengl [default: %(default)s]')
# stub
return

View File

@ -137,10 +137,8 @@ def options(opt):
:param opt: Options context from the *waf* build environment.
:type opt: waflib.Options.OptionsContext
'''
opt.add_option('--cmake', dest='cmake', default=False,
action='store_true', help='select cmake for export/import actions')
opt.add_option('--clean', dest='clean', default=False,
action='store_true', help='delete exported files')
opt.add_option('--cmake', dest='cmake', default=False, action='store_true', help='select cmake for export/import actions')
opt.add_option('--cmake-clean', dest='cmake_clean', default=False, action='store_true', help='delete exported cmake files')
def configure(conf):
@ -179,7 +177,7 @@ class CMakeContext(BuildContext):
pass
self.cmake = True
if self.options.clean:
if self.options.cmake_clean:
cleanup(self)
else:
export(self)
@ -224,7 +222,7 @@ def cleanup(bld):
:param bld: a *waf* build instance from the top level *wscript*.
:type bld: waflib.Build.BuildContext
'''
if not bld.options.clean:
if not bld.options.cmake_clean:
return
loc = bld.path.relpath().replace('\\', '/')

View File

@ -155,19 +155,19 @@ def options(opt):
help = 'build type: debug, release or none(custom flags)')
grp.add_option('--enable-lto', action = 'store_true', dest = 'LTO', default = False,
help = 'enable Link Time Optimization if possible [default: %default]')
help = 'enable Link Time Optimization if possible [default: %(default)s]')
grp.add_option('--enable-poly-opt', action = 'store_true', dest = 'POLLY', default = False,
help = 'enable polyhedral optimization if possible [default: %default]')
help = 'enable polyhedral optimization if possible [default: %(default)s]')
grp.add_option('--enable-openmp', action = 'store_true', dest = 'OPENMP', default = False,
help = 'enable OpenMP extensions [default: %default]')
help = 'enable OpenMP extensions [default: %(default)s]')
grp.add_option('--enable-profile', action = 'store_true', dest = 'PROFILE_GENERATE', default = False,
help = 'enable profile generating build (stored in xash3d-prof directory) [default: %default]')
help = 'enable profile generating build (stored in xash3d-prof directory) [default: %(default)s]')
grp.add_option('--use-profile', action = 'store', dest = 'PROFILE_USE', default = None,
help = 'use profile during build [default: %default]')
help = 'use profile during build [default: %(default)s]')
def configure(conf):
conf.start_msg('Build type')

View File

@ -17,10 +17,10 @@ def options(opt):
vgui_dev_path = os.path.join(opt.path.path_from(opt.root), 'vgui-dev')
grp.add_option('--vgui', action = 'store', dest = 'VGUI_DEV', default=vgui_dev_path,
help = 'path to vgui-dev repo [default: %default]')
help = 'path to vgui-dev repo [default: %(default)s]')
grp.add_option('--skip-vgui-sanity-check', action = 'store_false', dest = 'VGUI_SANITY_CHECK', default=True,
help = 'skip checking VGUI sanity [default: %default]' )
help = 'skip checking VGUI sanity [default: %(default)s]' )
return
@conf

View File

@ -503,13 +503,13 @@ def options(opt):
xc.add_option('--android', action='store', dest='ANDROID_OPTS', default=None,
help='enable building for android, format: --android=<arch>,<toolchain>,<api>, example: --android=armeabi-v7a-hard,4.9,9')
xc.add_option('--enable-magx', action='store_true', dest='MAGX', default=False,
help='enable building for Motorola MAGX [default: %default]')
help='enable building for Motorola MAGX [default: %(default)s]')
xc.add_option('--enable-msvc-wine', action='store_true', dest='MSVC_WINE', default=False,
help='enable building with MSVC using Wine [default: %default]')
help='enable building with MSVC using Wine [default: %(default)s]')
xc.add_option('--nswitch', action='store_true', dest='NSWITCH', default = False,
help='enable building for Nintendo Switch [default: %default]')
help='enable building for Nintendo Switch [default: %(default)s]')
xc.add_option('--psvita', action='store_true', dest='PSVITA', default = False,
help='enable building for PlayStation Vita [default: %default]')
help='enable building for PlayStation Vita [default: %(default)s]')
xc.add_option('--sailfish', action='store', dest='SAILFISH', default = None,
help='enable building for Sailfish/Aurora')

View File

@ -7,7 +7,7 @@ def options(opt):
grp = opt.get_option_group('Utilities options')
grp.add_option('--disable-utils-mdldec', action = 'store_true', dest = 'DISABLE_UTILS_MDLDEC', default = False,
help = 'disable studio model decompiler utility [default: %default]')
help = 'disable studio model decompiler utility [default: %(default)s]')
def configure(conf):
conf.env.DISABLE_UTILS_MDLDEC = conf.options.DISABLE_UTILS_MDLDEC

20
waf vendored

File diff suppressed because one or more lines are too long

22
wscript
View File

@ -53,7 +53,7 @@ class RefDll:
kw['dest'] = self.dest
kw['default'] = self.default
kw['help'] = '%s %s renderer [default: %%default]' % (act, self.name)
kw['help'] = '%s %s renderer [default: %%(default)s]' % (act, self.name)
opt.add_option(key, **kw)
@ -113,31 +113,31 @@ def options(opt):
grp = opt.add_option_group('Common options')
grp.add_option('-d', '--dedicated', action = 'store_true', dest = 'DEDICATED', default = False,
help = 'build Xash Dedicated Server [default: %default]')
help = 'build Xash Dedicated Server [default: %(default)s]')
grp.add_option('--gamedir', action = 'store', dest = 'GAMEDIR', default = 'valve',
help = 'engine default game directory [default: %default]')
help = 'engine default game directory [default: %(default)s]')
grp.add_option('-8', '--64bits', action = 'store_true', dest = 'ALLOW64', default = False,
help = 'allow targetting 64-bit engine(Linux/Windows/OSX x86 only) [default: %default]')
help = 'allow targetting 64-bit engine(Linux/Windows/OSX x86 only) [default: %(default)s]')
grp.add_option('-P', '--enable-packaging', action = 'store_true', dest = 'PACKAGING', default = False,
help = 'respect prefix option, useful for packaging for various operating systems [default: %default]')
help = 'respect prefix option, useful for packaging for various operating systems [default: %(default)s]')
grp.add_option('--enable-bundled-deps', action = 'store_true', dest = 'BUILD_BUNDLED_DEPS', default = False,
help = 'prefer to build bundled dependencies (like opus) instead of relying on system provided')
grp.add_option('--enable-bsp2', action = 'store_true', dest = 'SUPPORT_BSP2_FORMAT', default = False,
help = 'build engine and renderers with BSP2 map support(recommended for Quake, breaks compatibility!) [default: %default]')
help = 'build engine and renderers with BSP2 map support(recommended for Quake, breaks compatibility!) [default: %(default)s]')
grp.add_option('--low-memory-mode', action = 'store', dest = 'LOW_MEMORY', default = 0, type = 'int',
grp.add_option('--low-memory-mode', action = 'store', dest = 'LOW_MEMORY', default = 0, type = int,
help = 'enable low memory mode (only for devices have <128 ram)')
grp.add_option('--disable-werror', action = 'store_true', dest = 'DISABLE_WERROR', default = False,
help = 'disable compilation abort on warning')
grp.add_option('--enable-tests', action = 'store_true', dest = 'TESTS', default = False,
help = 'enable building standalone tests (does not enable engine tests!) [default: %default]')
help = 'enable building standalone tests (does not enable engine tests!) [default: %(default)s]')
# a1ba: special option for me
grp.add_option('--debug-all-servers', action='store_true', dest='ALL_SERVERS', default=False, help='')
@ -145,7 +145,7 @@ def options(opt):
grp = opt.add_option_group('Renderers options')
grp.add_option('--enable-all-renderers', action='store_true', dest='ALL_RENDERERS', default=False,
help = 'enable all renderers supported by Xash3D FWGS [default: %default]')
help = 'enable all renderers supported by Xash3D FWGS [default: %(default)s]')
for dll in REFDLLS:
dll.register_option(grp)
@ -153,10 +153,10 @@ def options(opt):
grp = opt.add_option_group('Utilities options')
grp.add_option('--enable-utils', action = 'store_true', dest = 'ENABLE_UTILS', default = False,
help = 'enable building various development utilities [default: %default]')
help = 'enable building various development utilities [default: %(default)s]')
grp.add_option('--enable-fuzzer', action = 'store_true', dest = 'ENABLE_FUZZER', default = False,
help = 'enable building libFuzzer runner [default: %default]' )
help = 'enable building libFuzzer runner [default: %(default)s]' )
for i in SUBDIRS:
if not i.is_exists(opt):