scripts: wscript: nswitch: do the libstdc++ hack right before build to not pollute the environment

This commit is contained in:
fgsfds 2023-02-08 01:37:35 +01:00
parent f7489a3747
commit b2cc96cf0d
1 changed files with 4 additions and 4 deletions

View File

@ -58,12 +58,8 @@ def configure(conf):
if not conf.env.HAVE_SDL2:
conf.fatal('SDL2 not availiable! Install switch-sdl2!')
conf.define('XASH_SDL', 2)
# HACK: now link in the entirety of libstdc++ so that dynamic libs could use all of it without manual exporting
# we can't do this right away because std::filesystem will complain about not having pathconf(),
# which we have defined in sys_nswitch.c
conf.env.LDFLAGS.remove('-lstdc++')
conf.env.LDFLAGS.remove('-lm')
conf.env.LDFLAGS += ['-Wl,--whole-archive', '-lstdc++', '-Wl,--no-whole-archive', '-lm']
elif conf.options.FBDEV_SW:
# unused, XASH_LINUX without XASH_SDL gives fbdev & alsa support
# conf.define('XASH_FBDEV', 1)
@ -195,6 +191,10 @@ def build(bld):
# Switch has custom parameters
if bld.env.DEST_OS == 'nswitch':
# HACK: link in the entirety of libstdc++ so that dynamic libs could use all of it without manual exporting
# we can't do this right away because std::filesystem will complain about not having pathconf(),
# which we have defined in sys_nswitch.c
bld.env.LDFLAGS += ['-Wl,--whole-archive', '-lstdc++', '-Wl,--no-whole-archive', '-lm']
bld(source = source,
target = 'xash',
features = 'c cxxprogram',