diff --git a/3rdparty/opus/wscript b/3rdparty/opus/wscript index 54daf0ff..9f3d2098 100644 --- a/3rdparty/opus/wscript +++ b/3rdparty/opus/wscript @@ -3,24 +3,10 @@ import os -OPUS_CHECK='''#include -#include -int main() -{ - OpusEncoder *oe = opus_encoder_create(48000, 2, OPUS_APPLICATION_VOIP, NULL); - OpusDecoder *od = opus_decoder_create(48000, 2, NULL); - return !oe || !od; -} -''' - def options(opt): pass def configure(conf): - if conf.check_pkg('opus', 'OPUS', OPUS_CHECK, fatal = False): - conf.env.HAVE_OPUS = True - return - if not conf.path.find_dir('opus') or not conf.path.find_dir('opus/src'): conf.fatal('Can\'t find opus submodule. Run `git submodule update --init --recursive`.') return @@ -29,9 +15,6 @@ def configure(conf): # TODO: maybe call autotools/cmake/meson instead? def build(bld): - if bld.env.HAVE_OPUS: - return - sources = bld.path.ant_glob([ 'opus/src/*.c', 'opus/celt/*.c', diff --git a/wscript b/wscript index 07737fb5..606cf870 100644 --- a/wscript +++ b/wscript @@ -72,6 +72,9 @@ def options(opt): 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]') + grp.add_option('--enabled-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]') @@ -323,6 +326,12 @@ int main(int argc, char **argv) { strcasestr(argv[1], argv[2]); return 0; }''' conf.env.SHAREDIR = conf.env.LIBDIR = conf.env.BINDIR = conf.env.PREFIX + if not conf.options.BUILD_BUNDLED_DEPS: + # check if we can use system opus + if conf.check_pkg('opus', 'opus', '''#include +int main(void){ return (opus_encoder_create(48000, 2, OPUS_APPLICATION_VOIP, 0) != 0) && (opus_decoder_create(48000, 2, 0) != 0);}''', fatal = False): + conf.env.HAVE_SYSTEM_OPUS = True + conf.define('XASH_BUILD_COMMIT', conf.env.GIT_VERSION if conf.env.GIT_VERSION else 'notset') conf.define('XASH_LOW_MEMORY', conf.options.LOW_MEMORY)