Skip to content

Commit

Permalink
wscript: strip lib prefix from new opus and vorbis targets, don't lin…
Browse files Browse the repository at this point in the history
…k them in dedicated
  • Loading branch information
a1batross committed Dec 2, 2024
1 parent 6b6d3b3 commit 51fa7d2
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 36 deletions.
6 changes: 3 additions & 3 deletions 3rdparty/libogg/wscript
Original file line number Diff line number Diff line change
Expand Up @@ -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/'
)
8 changes: 4 additions & 4 deletions 3rdparty/opusfile/wscript
Original file line number Diff line number Diff line change
Expand Up @@ -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/'
)
24 changes: 10 additions & 14 deletions 3rdparty/vorbis/wscript
Original file line number Diff line number Diff line change
Expand Up @@ -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':
Expand Down Expand Up @@ -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/'
)
4 changes: 2 additions & 2 deletions engine/wscript
Original file line number Diff line number Diff line change
Expand Up @@ -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([
Expand Down Expand Up @@ -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

Expand Down
22 changes: 9 additions & 13 deletions wscript
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand All @@ -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),
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 51fa7d2

Please sign in to comment.