From f01818a3f806625d9493bff9fb5577efdeeae63f Mon Sep 17 00:00:00 2001 From: Alibek Omarov Date: Thu, 5 Feb 2026 07:46:32 +0500 Subject: [PATCH] wscript: allow linking with system-wide opus 1.6.1 which has a fix for custom modes --- wscript | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/wscript b/wscript index 6fd915c1..5813c065 100644 --- a/wscript +++ b/wscript @@ -528,7 +528,13 @@ int main(int argc, char **argv) { return opus_tagcompare(argv[0], argv[1]); }''' # search for opus 1.4 only, it has fixes for custom modes # 1.5 breaks custom modes: https://github.com/xiph/opus/issues/374 - if conf.check_cfg(package='opus', uselib_store='opus', args='opus = 1.4 --cflags --libs', mandatory=False): + have_opus = conf.check_cfg(package='opus', uselib_store='opus', args=['opus = 1.4', '--cflags', '--libs'], mandatory=False) + + # 1.6.1 fixes them again + if not have_opus: + have_opus = conf.check_cfg(package='opus', uselib_store='opus', args=['opus >= 1.6.1', '--cflags', '--libs'], mandatory=False) + + if have_opus: # now try to link with export that only exists with CUSTOM_MODES defined frag='''#include int main(void) { return !opus_custom_encoder_init((OpusCustomEncoder *)1, (const OpusCustomMode *)1, 1); }'''