From 894020d418581fdd41422adad25bb17bd6cf173a Mon Sep 17 00:00:00 2001 From: Uwe Klotz Date: Sat, 7 Sep 2019 18:31:43 +0200 Subject: [PATCH 1/2] Disable modplug feature by default --- build/features.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/build/features.py b/build/features.py index 9321bbca1d3..141f2840810 100644 --- a/build/features.py +++ b/build/features.py @@ -441,8 +441,13 @@ class ModPlug(Feature): def description(self): return "Modplug module decoder plugin" + # NOTE(2019-09-07, uklotzde) + # Modplug support is disabled by default, even if libmodplug is + # available on many platforms. Instead it is recommend to enable + # this feature explicitly for the release builds if available, + # e.g. on Linux, FreeBSD, macOS, ... def default(self, build): - return 1 if build.platform_is_linux else 0 + return 0 def enabled(self, build): build.flags['modplug'] = util.get_flags(build.env, 'modplug', self.default(build)) From 41a19f8f9e1086f52ce8cbc383e1666d5f4c456d Mon Sep 17 00:00:00 2001 From: Uwe Klotz Date: Sun, 8 Sep 2019 00:18:29 +0200 Subject: [PATCH 2/2] Enable modplug feature implicitly if available --- build/features.py | 38 +++++++++++++++++++++----------------- 1 file changed, 21 insertions(+), 17 deletions(-) diff --git a/build/features.py b/build/features.py index 141f2840810..da5091ed4c4 100644 --- a/build/features.py +++ b/build/features.py @@ -441,16 +441,12 @@ class ModPlug(Feature): def description(self): return "Modplug module decoder plugin" - # NOTE(2019-09-07, uklotzde) - # Modplug support is disabled by default, even if libmodplug is - # available on many platforms. Instead it is recommend to enable - # this feature explicitly for the release builds if available, - # e.g. on Linux, FreeBSD, macOS, ... - def default(self, build): - return 0 - def enabled(self, build): - build.flags['modplug'] = util.get_flags(build.env, 'modplug', self.default(build)) + # Default to enabled on but only throw an error if it was explicitly + # requested and is not available. + if 'modplug' in build.flags: + return int(build.flags['modplug']) > 0 + build.flags['modplug'] = util.get_flags(build.env, 'modplug', 1) if int(build.flags['modplug']): return True return False @@ -458,22 +454,30 @@ def enabled(self, build): def add_options(self, build, vars): vars.Add('modplug', 'Set to 1 to enable libmodplug based module tracker support.', - self.default(build)) + 1) def configure(self, build, conf): if not self.enabled(build): return - build.env.Append(CPPDEFINES='__MODPLUG__') + # Only block the configure if modplug was explicitly requested. + explicit = 'modplug' in SCons.ARGUMENTS - have_modplug_h = conf.CheckHeader('libmodplug/modplug.h') - have_modplug = conf.CheckLib(['modplug', 'libmodplug'], autoadd=True) + if not conf.CheckHeader('libmodplug/modplug.h'): + if explicit: + raise Exception('Could not find libmodplug development headers.') + else: + build.flags['modplug'] = 0 + return - if not have_modplug_h: - raise Exception('Could not find libmodplug development headers.') + if not conf.CheckLib(['modplug', 'libmodplug'], autoadd=True): + if explicit: + raise Exception('Could not find libmodplug shared library.') + else: + build.flags['modplug'] = 0 + return - if not have_modplug: - raise Exception('Could not find libmodplug shared library.') + build.env.Append(CPPDEFINES='__MODPLUG__') def sources(self, build): depends.Qt.uic(build)('preferences/dialog/dlgprefmodplugdlg.ui')