From 51fa7d2611cb2f5da78506ff485a37b1b92bd74b Mon Sep 17 00:00:00 2001 From: Alibek Omarov Date: Mon, 2 Dec 2024 21:59:11 +0300 Subject: [PATCH] wscript: strip lib prefix from new opus and vorbis targets, don't link them in dedicated --- 3rdparty/libogg/wscript | 6 +++--- 3rdparty/opusfile/wscript | 8 ++++---- 3rdparty/vorbis/wscript | 24 ++++++++++-------------- engine/wscript | 4 ++-- wscript | 22 +++++++++------------- 5 files changed, 28 insertions(+), 36 deletions(-) diff --git a/3rdparty/libogg/wscript b/3rdparty/libogg/wscript index b24fbf751..540017882 100644 --- a/3rdparty/libogg/wscript +++ b/3rdparty/libogg/wscript @@ -43,8 +43,8 @@ def build(bld): bld.stlib( source = sources, - target = 'libogg', + target = 'ogg', use = 'libogg_config_types', - includes = ['libogg/include/'], - export_includes = ['libogg/include/'] + includes = 'libogg/include/', + export_includes = 'libogg/include/' ) diff --git a/3rdparty/opusfile/wscript b/3rdparty/opusfile/wscript index ef0f5f8da..3b81c2302 100644 --- a/3rdparty/opusfile/wscript +++ b/3rdparty/opusfile/wscript @@ -30,8 +30,8 @@ def build(bld): bld.stlib( source = sources, - target = 'libopusfile', - includes = ['opusfile/include/'], - use = ['libogg', 'opus'], - export_includes = ['opusfile/include/'] + target = 'opusfile', + includes = 'opusfile/include/', + use = 'ogg opus', + export_includes = 'opusfile/include/' ) diff --git a/3rdparty/vorbis/wscript b/3rdparty/vorbis/wscript index 0ef030857..6f8755e19 100644 --- a/3rdparty/vorbis/wscript +++ b/3rdparty/vorbis/wscript @@ -22,7 +22,7 @@ def configure(conf): if conf.check_cc(fragment=FRAGMENT_MEMORY_H, msg = 'Checking for memory.h header', mandatory = False): conf.define('USE_MEMORY_H', 1) - + conf.check_cc(fragment=FRAGMENT_ALLOCA_H, msg = 'Checking for alloca in alloca.h header', mandatory = False) if conf.env.COMPILER_CC == 'msvc': @@ -54,22 +54,18 @@ def build(bld): 'vorbis-src/lib/bitrate.c' ] - libvorbisfile_sources = [ - 'vorbis-src/lib/vorbisfile.c' - ] - bld.stlib( source = libvorbis_sources, - target = 'libvorbis', - includes = ['vorbis-src/include/'], - use = ['libogg'], - export_includes = ['vorbis-src/include/'] + target = 'vorbis', + includes = 'vorbis-src/include/', + use = 'ogg', + export_includes = 'vorbis-src/include/' ) bld.stlib( - source = libvorbisfile_sources, - target = 'libvorbisfile', - includes = ['vorbis-src/include/'], - use = ['libvorbis'], - export_includes = ['vorbis-src/include/'] + source = 'vorbis-src/lib/vorbisfile.c', + target = 'vorbisfile', + includes = 'vorbis-src/include/', + use = 'vorbis', + export_includes = 'vorbis-src/include/' ) diff --git a/engine/wscript b/engine/wscript index 3b4af8933..904e797ba 100644 --- a/engine/wscript +++ b/engine/wscript @@ -141,7 +141,7 @@ def build(bld): bld(name = 'engine_includes', export_includes = '. common common/imagelib', use = 'filesystem_includes') is_cxx_link = False - libs = [ 'engine_includes', 'public', 'dllemu', 'werror', 'opus', 'libvorbis', 'libvorbisfile', 'libopusfile' ] + libs = [ 'engine_includes', 'public', 'dllemu', 'werror' ] # basic build: dedicated only source = bld.path.ant_glob([ @@ -238,7 +238,7 @@ def build(bld): 'client/soundlib/libmpg/*.c', ]) is_cxx_link = True - libs += ['bzip2', 'MultiEmulator'] + libs += ['bzip2', 'MultiEmulator', 'opus', 'opusfile', 'vorbis', 'vorbisfile'] rpath = bld.env.DEFAULT_RPATH diff --git a/wscript b/wscript index 7fac0999c..fa505d233 100644 --- a/wscript +++ b/wscript @@ -94,6 +94,10 @@ SUBDIRS = [ Subproject('ref/soft', lambda x: not x.env.DEDICATED and not x.env.SUPPORT_BSP2_FORMAT and x.env.SOFT), Subproject('ref/null', lambda x: not x.env.DEDICATED and x.env.NULL), Subproject('3rdparty/bzip2', lambda x: not x.env.DEDICATED and not x.env.HAVE_SYSTEM_BZ2), + Subproject('3rdparty/opus', lambda x: not x.env.DEDICATED and not x.env.HAVE_SYSTEM_OPUS), + Subproject('3rdparty/libogg', lambda x: not x.env.DEDICATED and not x.env.HAVE_SYSTEM_OGG), + Subproject('3rdparty/vorbis', lambda x: not x.env.DEDICATED and (not x.env.HAVE_SYSTEM_VORBIS or not x.env.HAVE_SYSTEM_VORBISFILE)), + Subproject('3rdparty/opusfile', lambda x: not x.env.DEDICATED and not x.env.HAVE_SYSTEM_OPUSFILE), Subproject('3rdparty/mainui', lambda x: not x.env.DEDICATED), Subproject('3rdparty/vgui_support', lambda x: not x.env.DEDICATED), Subproject('3rdparty/MultiEmulator',lambda x: not x.env.DEDICATED), @@ -102,12 +106,6 @@ SUBDIRS = [ Subproject('game_launch', lambda x: not x.env.DISABLE_LAUNCHER), Subproject('engine'), # keep latest for static linking - # disable only by external dependency presense - Subproject('3rdparty/opus', lambda x: not x.env.HAVE_SYSTEM_OPUS), - Subproject('3rdparty/libogg', lambda x: not x.env.HAVE_SYSTEM_OGG), - Subproject('3rdparty/vorbis', lambda x: not x.env.HAVE_SYSTEM_VORBIS and not x.env.HAVE_SYSTEM_VORBISFILE), - Subproject('3rdparty/opusfile', lambda x: not x.env.HAVE_SYSTEM_OPUSFILE), - # enabled optionally Subproject('utils/mdldec', lambda x: x.env.ENABLE_UTILS), Subproject('utils/xar', lambda x: x.env.ENABLE_UTILS and x.env.ENABLE_XAR), @@ -472,13 +470,11 @@ def configure(conf): else: conf.env.SHAREDIR = conf.env.LIBDIR = conf.env.BINDIR = conf.env.PREFIX - if not conf.options.BUILD_BUNDLED_DEPS: - for i in (('ogg', 'libogg'), - ('opusfile', 'libopusfile'), - ('vorbis', 'libvorbis'), - ('vorbisfile', 'libvorbisfile')): - if conf.check_cfg(package=i[0], uselib_store=i[1], args='--cflags --libs', mandatory=False): - conf.env['HAVE_SYSTEM_%s' % i[0].upper()] = True + # dedicated server don't have external dependencies + if not conf.options.BUILD_BUNDLED_DEPS and not conf.options.DEDICATED: + for i in ('ogg','opusfile','vorbis','vorbisfile'): + if conf.check_cfg(package=i, uselib_store=i, args='--cflags --libs', mandatory=False): + conf.env['HAVE_SYSTEM_%s' % i.upper()] = True # search for opus 1.4 only, it has fixes for custom modes # 1.5 breaks custom modes: https://github.com/xiph/opus/issues/374