merge: branch 'bg/meson-fixes'

https://github.com/NetworkManager/NetworkManager/pull/204
(cherry picked from commit c7c3acf280)
This commit is contained in:
Beniamino Galvani 2018-10-02 10:00:54 +02:00
commit 8ac6aa4f97
11 changed files with 113 additions and 62 deletions

View file

@ -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 \

View file

@ -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 \

View file

@ -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

View file

@ -77,7 +77,7 @@
<xi:include href="../../man/nm-settings-keyfile.xml"><xi:fallback /></xi:include>
<xi:include href="../../man/nm-settings-ifcfg-rh.xml"><xi:fallback /></xi:include>
<xi:include href="../../man/nm-online.xml"/>
<xi:include href="../../man/nm-openvswitch.xml"/>
<xi:include href="../../man/nm-openvswitch.xml"><xi:fallback /></xi:include>
</part>
<part id="ref-settings">

View file

@ -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])
)

View file

@ -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)

View file

@ -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)')

View file

@ -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)

View file

@ -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

View file

@ -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
}

44
tools/meson-post-install.sh Executable file
View file

@ -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