From 4b8eab72f3457c05f76de999515c749f96adf21d Mon Sep 17 00:00:00 2001 From: Davide Pesavento Date: Sat, 1 Sep 2018 20:10:36 -0400 Subject: [PATCH] build: drop dependency on unused CoreServices framework Change-Id: I91df33fafbcf275f7b41394112f8c002bc98af97 --- .waf-tools/osx-frameworks.py | 53 +++++++++++++++--------------------- wscript | 37 ++++++++++++------------- 2 files changed, 40 insertions(+), 50 deletions(-) diff --git a/.waf-tools/osx-frameworks.py b/.waf-tools/osx-frameworks.py index 477a7f75..76cd3df7 100644 --- a/.waf-tools/osx-frameworks.py +++ b/.waf-tools/osx-frameworks.py @@ -4,48 +4,39 @@ from waflib import Logs, Utils, TaskGen from waflib.Configure import conf -OSX_SECURITY_CODE = ''' -#include -#include -#include -#include -#include -int main() {} -''' +@conf +def check_osx_framework_cxx(conf, fw_name, **kw): + conf.check_cxx(framework_name=fw_name, + uselib_store='OSX_' + fw_name.upper(), + fragment='#include <{0}/{0}.h>\nint main() {{}}'.format(fw_name), + **kw) -OSX_SYSTEMCONFIGURATION_CODE = ''' -#include -#include -int main() {} -''' +@conf +def check_osx_framework_mm(conf, fw_name, **kw): + conf.check_cxx(framework_name=fw_name, + uselib_store='OSX_' + fw_name.upper(), + fragment='#import <{0}/{0}.h>\nint main() {{}}'.format(fw_name), + compile_filename='test.mm', + **kw) @conf def check_osx_frameworks(conf, *k, **kw): - if Utils.unversioned_sys_platform() == "darwin": + if Utils.unversioned_sys_platform() == 'darwin': try: - conf.check_cxx(framework_name='CoreFoundation', uselib_store='OSX_COREFOUNDATION', - mandatory=True) - conf.check_cxx(framework_name='CoreServices', uselib_store='OSX_CORESERVICES', - mandatory=True) - conf.check_cxx(framework_name='Security', uselib_store='OSX_SECURITY', - use='OSX_COREFOUNDATION', fragment=OSX_SECURITY_CODE, - mandatory=True) - conf.check_cxx(framework_name='SystemConfiguration', uselib_store='OSX_SYSTEMCONFIGURATION', - use='OSX_COREFOUNDATION', fragment=OSX_SYSTEMCONFIGURATION_CODE, - mandatory=True) + conf.check_osx_framework_cxx('CoreFoundation', mandatory=True) + conf.check_osx_framework_cxx('Security', use='OSX_COREFOUNDATION', mandatory=True) + conf.check_osx_framework_cxx('SystemConfiguration', use='OSX_COREFOUNDATION', mandatory=True) - conf.check_cxx(framework_name='Foundation', uselib_store='OSX_FOUNDATION', - mandatory=True, compile_filename='test.mm') - conf.check_cxx(framework_name='CoreWLAN', uselib_store='OSX_COREWLAN', - use="OSX_FOUNDATION", mandatory=True, compile_filename='test.mm') + conf.check_osx_framework_mm('Foundation', mandatory=True) + conf.check_osx_framework_mm('CoreWLAN', use='OSX_FOUNDATION', mandatory=True) conf.define('HAVE_OSX_FRAMEWORKS', 1) conf.env['HAVE_OSX_FRAMEWORKS'] = True except: - Logs.warn("Compiling on macOS, but required framework(s) is(are) not functional.") - Logs.warn("Note that the frameworks are known to work only with the Apple clang compiler.") + Logs.warn('Building on macOS, but one or more required frameworks are not functional.') + Logs.warn('Note that the frameworks are known to work only with the Apple clang compiler.') @TaskGen.extension('.mm') def m_hook(self, node): - """Alias .mm files to be compiled the same as .cpp files, gcc/clang will do the right thing.""" + '''Alias .mm files to be compiled the same as .cpp files, clang will do the right thing.''' return self.create_compiled_task('cxx', node) diff --git a/wscript b/wscript index cfedb523..fa94ca31 100644 --- a/wscript +++ b/wscript @@ -19,34 +19,33 @@ def options(opt): opt = opt.add_option_group('Library Options') - opt.add_option('--with-tests', action='store_true', default=False, dest='with_tests', - help='''Build unit tests''') + opt.add_option('--with-examples', action='store_true', default=False, + help='Build examples') + + opt.add_option('--with-tests', action='store_true', default=False, + help='Build unit tests') opt.add_option('--without-tools', action='store_false', default=True, dest='with_tools', - help='''Do not build tools''') - - opt.add_option('--with-examples', action='store_true', default=False, dest='with_examples', - help='''Build examples''') + help='Do not build tools') opt.add_option('--without-sqlite-locking', action='store_false', default=True, dest='with_sqlite_locking', - help='''Disable filesystem locking in sqlite3 database ''' - '''(use unix-dot locking mechanism instead). ''' - '''This option may be necessary if home directory is hosted on NFS.''') + help='Disable filesystem locking in sqlite3 database ' + '(use unix-dot locking mechanism instead). ' + 'This option may be necessary if the home directory is hosted on NFS.') opt.add_option('--without-osx-keychain', action='store_false', default=True, - dest='with_osx_keychain', - help='''On Darwin, do not use OSX keychain as a default TPM''') + dest='with_osx_keychain', help='Do not use macOS Keychain as default TPM (macOS only)') opt.add_option('--enable-static', action='store_true', default=False, - dest='enable_static', help='''Build static library (disabled by default)''') + dest='enable_static', help='Build static library (disabled by default)') opt.add_option('--disable-static', action='store_false', default=False, - dest='enable_static', help='''Do not build static library (disabled by default)''') + dest='enable_static', help='Do not build static library (disabled by default)') opt.add_option('--enable-shared', action='store_true', default=True, - dest='enable_shared', help='''Build shared library (enabled by default)''') + dest='enable_shared', help='Build shared library (enabled by default)') opt.add_option('--disable-shared', action='store_false', default=True, - dest='enable_shared', help='''Do not build shared library (enabled by default)''') + dest='enable_shared', help='Do not build shared library (enabled by default)') def configure(conf): conf.start_msg('Building static library') @@ -165,7 +164,7 @@ def build(bld): target='ndn-cxx-mm', name='ndn-cxx-mm', source=bld.path.ant_glob(['src/**/*-osx.mm']), - use='version BOOST OPENSSL SQLITE3 RT PTHREAD OSX_COREFOUNDATION OSX_CORESERVICES OSX_SECURITY OSX_SYSTEMCONFIGURATION OSX_FOUNDATION OSX_COREWLAN', + use='version BOOST OPENSSL SQLITE3 RT PTHREAD OSX_COREFOUNDATION OSX_SECURITY OSX_SYSTEMCONFIGURATION OSX_FOUNDATION OSX_COREWLAN', includes='src') libndn_cxx = dict( @@ -183,7 +182,7 @@ def build(bld): if bld.env['HAVE_OSX_FRAMEWORKS']: libndn_cxx['source'] += bld.path.ant_glob('src/**/*-osx.cpp') - libndn_cxx['use'] += ' OSX_COREFOUNDATION OSX_CORESERVICES OSX_SECURITY OSX_SYSTEMCONFIGURATION OSX_FOUNDATION OSX_COREWLAN' + libndn_cxx['use'] += ' OSX_COREFOUNDATION OSX_SECURITY OSX_SYSTEMCONFIGURATION OSX_FOUNDATION OSX_COREWLAN' if bld.env['HAVE_NETLINK']: libndn_cxx['source'] += bld.path.ant_glob('src/**/*netlink*.cpp') @@ -221,7 +220,7 @@ def build(bld): EXTRA_FRAMEWORKS = '' if bld.env['HAVE_OSX_FRAMEWORKS']: - EXTRA_FRAMEWORKS = '-framework CoreFoundation -framework CoreServices -framework Security -framework SystemConfiguration -framework Foundation -framework CoreWLAN' + EXTRA_FRAMEWORKS = '-framework CoreFoundation -framework Security -framework SystemConfiguration -framework Foundation -framework CoreWLAN' def uniq(alist): seen = set() @@ -281,8 +280,8 @@ def build(bld): bld(features='sphinx', name='manpages', builder='man', - outdir='docs/manpages', config='docs/conf.py', + outdir='docs/manpages', source=bld.path.ant_glob('docs/manpages/**/*.rst'), install_path='${MANDIR}', VERSION=VERSION)