diff --git a/.travis.yml b/.travis.yml index de6ff770a0..c96bb9496a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -97,7 +97,7 @@ script: -D introspection=false \ -D qt=false \ -D crypto=$CRYPTO \ - -D docs=true \ + -D docs=false \ \ -D libnm_glib=true \ -D iwd=true \ diff --git a/Makefile.am b/Makefile.am index 5b0feefa40..e67a3d870c 100644 --- a/Makefile.am +++ b/Makefile.am @@ -4744,7 +4744,6 @@ EXTRA_DIST += \ valgrind.suppressions \ meson.build \ meson_options.txt \ - meson_post_install.py \ config.h.meson \ config-extra.h.meson \ docs/meson.build \ @@ -4785,6 +4784,7 @@ EXTRA_DIST += \ tools/check-exports.sh \ tools/create-exports-NetworkManager.sh \ tools/debug-helper.py \ + tools/meson-post-install.sh \ tools/run-nm-test.sh \ tools/test-networkmanager-service.py \ tools/test-sudo-wrapper.sh \ diff --git a/docs/api/Makefile.am b/docs/api/Makefile.am index 859aa20bc2..f48e132874 100644 --- a/docs/api/Makefile.am +++ b/docs/api/Makefile.am @@ -88,11 +88,15 @@ content_files = \ $(top_builddir)/man/nmcli-examples.xml \ $(top_builddir)/man/nm-settings.xml \ $(top_builddir)/man/nm-settings-keyfile.xml \ - $(top_builddir)/man/nm-openvswitch.xml \ version.xml \ ../../COPYING \ $(NULL) + +if WITH_OPENVSWITCH +content_files += $(top_builddir)/man/nm-openvswitch.xml +endif + if CONFIG_PLUGIN_IFCFG_RH content_files += $(top_builddir)/man/nm-settings-ifcfg-rh.xml endif diff --git a/docs/api/network-manager-docs.xml b/docs/api/network-manager-docs.xml index 9285744310..23d67db1e7 100644 --- a/docs/api/network-manager-docs.xml +++ b/docs/api/network-manager-docs.xml @@ -77,7 +77,7 @@ - + diff --git a/man/meson.build b/man/meson.build index 044ddcaba4..41fbf583a6 100644 --- a/man/meson.build +++ b/man/meson.build @@ -10,7 +10,7 @@ common_conf.set('NM_CONFIG_DEFAULT_MAIN_DHCP', config_dhcp_default) common = 'common.ent' -configure_file( +common_ent_file = configure_file( input: common + '.in', output: common, configuration: common_conf @@ -47,6 +47,8 @@ if enable_ovs mans += [['nm-openvswitch', '7']] endif +content_files += join_paths(meson.current_build_dir(), 'common.ent') + foreach man: mans input = man[0] + '.xml' content_files += join_paths(meson.current_source_dir(), input) @@ -58,6 +60,7 @@ foreach man: mans input: input, output: output, command: xsltproc_options + [docbook_xls, '@INPUT@'], + depend_files: common_ent_file, install: true, install_dir: join_paths(nm_mandir, 'man' + man[1]) ) diff --git a/meson.build b/meson.build index e0da40e49e..0d5ad7fa1c 100644 --- a/meson.build +++ b/meson.build @@ -711,11 +711,27 @@ auto_support_src = 'int main() { int a = 0; __auto_type b = a; return b + a; };' config_h.set10('_NM_CC_SUPPORT_AUTO_TYPE', cc.compiles(auto_support_src)) # Vala bindings -enable_vapi = get_option('vapi') -if enable_vapi +vapi_opt = get_option('vapi') +if vapi_opt == 'false' + enable_vapi = false +else vala_req_version = '>= 0.17.1.24' - assert(add_languages('vala', required: false), 'vala is required to build. Use -Dvapi=false to disable it') - assert(meson.get_compiler('vala').version().version_compare(vala_req_version), 'vala ' + vala_req_version + ' is required to build. Use -Dvapi=false to disable it') + enable_vapi = true + + if not enable_introspection + assert(vapi_opt != 'true', 'vala api require GObject introspection. Use -Dvapi=false to disable it') + enable_vapi = false + endif + + if enable_vapi and not add_languages('vala', required: false) + assert(vapi_opt != 'true', 'vala is required to build. Use -Dvapi=false to disable it') + enable_vapi = false + endif + + if enable_vapi and not meson.get_compiler('vala').version().version_compare(vala_req_version) + assert(vapi_opt != 'true', 'vala ' + vala_req_version + ' is required to build. Use -Dvapi=false to disable it') + enable_vapi = false + endif endif # Tests, utilities and documentation @@ -848,11 +864,10 @@ if enable_qt endif enable_docs = get_option('docs') + if enable_docs + assert(enable_introspection, '-Ddocs=true requires -Dintrospection=true') subdir('man') - - #assert(enable_introspection, '-Dgtk_doc=true requires -Dintrospection=true') - subdir('docs') endif @@ -896,7 +911,7 @@ configure_file( ) meson.add_install_script( - 'meson_post_install.py', + join_paths('tools', 'meson-post-install.sh'), nm_datadir, nm_bindir, nm_pkgconfdir, @@ -979,4 +994,5 @@ output += ' JSON validation for libnm: ' + enable_json_validation.to_string() + output += ' crypto: ' + crypto + ' (have-gnutls: ' + crypto_gnutls_dep.found().to_string() + ', have-nss: ' + crypto_nss_dep.found().to_string() + ')\n' output += ' sanitizers: ' + get_option('b_sanitize') + '\n' output += ' Mozilla Public Suffix List: ' + enable_libpsl.to_string() + '\n' +output += ' vapi: ' + enable_vapi.to_string() + '\n' message(output) diff --git a/meson_options.txt b/meson_options.txt index 7f06d53a71..0f93d77f30 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -61,7 +61,7 @@ option('config_dhcp_default', type: 'combo', choices: ['dhcpcanon', 'dhclient', # miscellaneous option('introspection', type: 'boolean', value: true, description: 'Enable introspection for this build') -option('vapi', type: 'boolean', value: true, description: 'build Vala bindings') +option('vapi', type : 'combo', choices : ['auto', 'true', 'false'], description: 'build Vala bindings') option('docs', type: 'boolean', value: false, description: 'use to build documentation') option('tests', type: 'combo', choices: ['yes', 'no', 'root'], value: 'yes', description: 'Build NetworkManager tests') option('more_asserts', type: 'string', value: 'all', description: 'Enable more assertions for debugging (0 = none, 100 = all, default: all)') diff --git a/meson_post_install.py b/meson_post_install.py deleted file mode 100644 index 16dbc42b95..0000000000 --- a/meson_post_install.py +++ /dev/null @@ -1,46 +0,0 @@ -#!/usr/bin/env python3 - -import os -import sys - -if not os.environ.get('DESTDIR'): - datadir = sys.argv[1] - bindir = sys.argv[2] - pkgconfdir = sys.argv[3] - pkglibdir = sys.argv[4] - localstatedir = sys.argv[5] - - completions_dir = os.path.join(datadir, 'bash-completion', 'completions') - os.rename(os.path.join(completions_dir, 'nmcli-completion'), os.path.join(completions_dir, 'nmcli')) - - nmtui_alias = ['nmtui-connect', 'nmtui-edit', 'nmtui-hostname'] - src = os.path.join(bindir, 'nmtui') - [os.symlink(src, os.path.join(bindir, dst)) - for dst in nmtui_alias] - - dst_dirs = [ - os.path.join(pkgconfdir, 'conf.d'), - os.path.join(pkgconfdir, 'system-connections'), - os.path.join(pkgconfdir, 'dispatcher.d', 'no-wait.d'), - os.path.join(pkgconfdir, 'dispatcher.d', 'pre-down.d'), - os.path.join(pkgconfdir, 'dispatcher.d', 'pre-up.d'), - os.path.join(pkgconfdir, 'dnsmasq.d'), - os.path.join(pkgconfdir, 'dnsmasq-shared.d'), - os.path.join(pkglibdir, 'conf.d'), - os.path.join(pkglibdir, 'VPN'), - os.path.join(localstatedir, 'lib', 'NetworkManager') - ] - [os.makedirs(dst_dir) - for dst_dir in dst_dirs - if not os.path.exists(dst_dir)] - - if sys.argv[6] == 'install_docs': - mandir = sys.argv[7] - - src = os.path.join(mandir, 'man1', 'nmtui.1') - [os.symlink(src, os.path.join(mandir, 'man1', dst + '.1')) - for dst in nmtui_alias] - - src = os.path.join(mandir, 'man5', 'NetworkManager.conf.5') - dst = os.path.join(mandir, 'man5', 'nm-system-settings.conf.5') - os.symlink(src, dst) diff --git a/src/meson.build b/src/meson.build index f46366a904..0a66647c25 100644 --- a/src/meson.build +++ b/src/meson.build @@ -252,11 +252,27 @@ subdir('settings/plugins') create_exports_networkmanager = join_paths(meson.source_root(), 'tools', 'create-exports-NetworkManager.sh') symbol_map_name = 'NetworkManager.ver' +# libNetworkManager.a, as built by meson doesn't contain all symbols +# from libNetworkManagerBase.a and other static libraries, unless we +# add dependencies with link_whole, only supported in meson >= 0.46. +# Create an executable with full symbols that we use in place of the +# library to enumerate the symbols. +network_manager_sym = executable( + 'nm-full-symbols', + 'main.c', + c_args: nm_cflags, + link_args: '-Wl,--no-gc-sections', + dependencies: nm_deps, + link_whole: [libnetwork_manager, libnetwork_manager_base, libnm_core], + install: false, +) + +# this uses symbols from nm-full-symbols instead of libNetworkManager.a ver_script = custom_target( symbol_map_name, input: meson.source_root(), output: symbol_map_name, - depends: [ libnetwork_manager, core_plugins ], + depends: [ network_manager_sym, core_plugins ], command: [create_exports_networkmanager, '--called-from-build', '@INPUT@'] ) @@ -273,3 +289,12 @@ network_manager = executable( install: true, install_dir: nm_sbindir ) + +if enable_tests + foreach plugin : core_plugins + test ('sym/' + plugin.full_path().split('/')[-1], + network_manager, + args: '--version', + env: ['LD_BIND_NOW=1', 'LD_PRELOAD=' + plugin.full_path()]) + endforeach +endif diff --git a/tools/create-exports-NetworkManager.sh b/tools/create-exports-NetworkManager.sh index c23203bf79..3c5789d884 100755 --- a/tools/create-exports-NetworkManager.sh +++ b/tools/create-exports-NetworkManager.sh @@ -35,7 +35,12 @@ call_nm() { } get_symbols_nm () { - call_nm ./src/${libs}libNetworkManager.a | + if [ -z "$from_meson" ]; then + base=./src/.libs/libNetworkManager.a + else + base=./src/nm-full-symbols + fi + call_nm "$base" | sed -n 's/^[tTDGRBS] //p' | _sort } diff --git a/tools/meson-post-install.sh b/tools/meson-post-install.sh new file mode 100755 index 0000000000..fd21941bbd --- /dev/null +++ b/tools/meson-post-install.sh @@ -0,0 +1,44 @@ +#!/bin/sh + +datadir=$1 +bindir=$2 +pkgconfdir=$3 +pkglibdir=$4 +localstatedir=$5 + +[ -n "$DESTDIR" ] && DESTDIR=${DESTDIR%%/}/ + +if [ -f "${DESTDIR}${datadir}/bash-completion/completions/nmcli-completion" ]; then + mv "${DESTDIR}${datadir}/bash-completion/completions/nmcli-completion" \ + "${DESTDIR}${datadir}/bash-completion/completions/nmcli" +fi + +if [ -x "${DESTDIR}${bindir}/nmtui" ]; then + for alias in nmtui-connect nmtui-edit nmtui-hostname; do + ln -sf nmtui "${DESTDIR}${bindir}/$alias" + done +fi + +for dir in "${pkgconfdir}/conf.d" \ + "${pkgconfdir}/system-connections" \ + "${pkgconfdir}/dispatcher.d/no-wait.d" \ + "${pkgconfdir}/dispatcher.d/pre-down.d" \ + "${pkgconfdir}/dispatcher.d/pre-up.d" \ + "${pkgconfdir}/dnsmasq.d" \ + "${pkgconfdir}/dnsmasq-shared.d" \ + "${pkgconfdir}/conf.d" \ + "${pkgconfdir}/VPN" \ + "${localstatedir}/lib/NetworkManager"; do + mkdir -p "${DESTDIR}${dir}" +done + +if [ "$6" = install_docs ]; then + mandir=$7 + + for alias in nmtui-connect nmtui-edit nmtui-hostname; do + ln -f "${DESTDIR}${mandir}/man1/nmtui.1" "${DESTDIR}${mandir}/man1/${alias}.1" + done + + ln -f "${DESTDIR}${mandir}/man5/NetworkManager.conf.5" "${DESTDIR}${mandir}/man5/nm-system-settings.conf" +fi +