diff options
author | Uwe Klotz <uklotz@mixxx.org> | 2019-09-08 00:18:29 +0200 |
---|---|---|
committer | Uwe Klotz <uklotz@mixxx.org> | 2019-09-08 00:18:29 +0200 |
commit | 41a19f8f9e1086f52ce8cbc383e1666d5f4c456d (patch) | |
tree | 6f2c154167da7b754ab26ada2512b5e0125dd16b /build/features.py | |
parent | 894020d418581fdd41422adad25bb17bd6cf173a (diff) |
Enable modplug feature implicitly if available
Diffstat (limited to 'build/features.py')
-rw-r--r-- | build/features.py | 38 |
1 files changed, 21 insertions, 17 deletions
diff --git a/build/features.py b/build/features.py index 141f284081..da5091ed4c 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 @@ class ModPlug(Feature): 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') |