From 3533b0d284804bd75c35468d3417ec3df8b6abc3 Mon Sep 17 00:00:00 2001 From: Alibek Omarov Date: Wed, 21 Jun 2023 13:18:57 +0300 Subject: [PATCH] wscript: check for opus 1.4, which fixes an assertion in custom modes decoder initialize --- wscript | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/wscript b/wscript index 0e319594..bc498a66 100644 --- a/wscript +++ b/wscript @@ -457,15 +457,14 @@ int main(int argc, char **argv) { strchrnul(argv[1], 'x'); 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 - conf.define('CUSTOM_MODES', 1) - - # try to link with export that only exists with CUSTOM_MODES defined - if conf.check_pkg('opus', 'opus', '''#include -int main(void){ return !opus_custom_encoder_init(0, 0, 0); }''', fatal = False): - conf.env.HAVE_SYSTEM_OPUS = True - else: - conf.undefine('CUSTOM_MODES') + # search for exact version of opus, 1.4 has fixes for custom modes + if conf.check_cfg(package='opus', uselib_store='opus', args='opus >= 1.4 --cflags --libs', mandatory=False): + # now try to link with export that only exists with CUSTOM_MODES defined + frag='''#include +int main(void) { return !opus_custom_encoder_init(0, 0, 0); }''' + + if conf.check_cc(msg='Checking if opus supports custom modes', defines='CUSTOM_MODES=1', use='opus', fragment=frag, mandatory=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)