meson: Use string variables extensively

The strings holding the names used for libraries have also been
moved to different variables. This way they would be less error
as these variables can be reused easily and any typing error
would be quickly detected.
This commit is contained in:
Iñigo Martínez 2018-01-09 08:05:15 +01:00 committed by Thomas Haller
parent 5e16bcf268
commit 50930ed19a
14 changed files with 54 additions and 43 deletions

View file

@ -1,3 +1,5 @@
name = 'nmcli'
# FIXME: nmcli-completion should be renamed to nmcli
install_data(
'nmcli-completion',
@ -25,7 +27,7 @@ deps = [
]
cflags = clients_cflags + [
'-DG_LOG_DOMAIN="nmcli"',
'-DG_LOG_DOMAIN="@0@"'.format(name),
'-DNMCLI_LOCALEDIR="@0@"'.format(nm_localedir)
]
@ -41,7 +43,7 @@ if enable_polkit_agent
endif
executable(
'nmcli',
name,
sources,
dependencies: deps,
c_args: cflags,

View file

@ -1,10 +1,12 @@
name = 'nmtui'
deps = [
newt_dep,
nm_core_dep
]
cflags = clients_cflags + [
'-DG_LOG_DOMAIN="nmtui"',
'-DG_LOG_DOMAIN="@0@"'.format(name),
'-DLOCALEDIR="@0@"'.format(nm_localedir)
]
@ -65,7 +67,7 @@ if have_version_script
endif
executable(
'nmtui',
name,
sources,
dependencies: deps,
c_args: cflags,

View file

@ -1,4 +1,4 @@
doc_module = 'NetworkManager'
doc_module = nm_name
settings = 'settings-spec'
output = settings + '.xml'

View file

@ -1,4 +1,4 @@
doc_module = 'libnm-glib'
doc_module = libnm_glib_name
private_headers = [
'common.h',

View file

@ -1,4 +1,4 @@
doc_module = 'libnm-util'
doc_module = libnm_util_name
private_headers = [
'crypto.h',

View file

@ -1,4 +1,4 @@
doc_module = 'libnm'
doc_module = libnm_name
private_headers = [
'common.h',

View file

@ -136,7 +136,7 @@ deps = [
]
cflags = [
'-DG_LOG_DOMAIN="libnm"',
'-DG_LOG_DOMAIN="@0@"'.format(libnm_name),
'-DNETWORKMANAGER_COMPILATION=NM_NETWORKMANAGER_COMPILATION_LIBNM_CORE',
'-DLIBEXECDIR="@0@"'.format(nm_libexecdir),
'-DLOCALEDIR="@0@"'.format(nm_localedir),

View file

@ -13,7 +13,7 @@ common_cflags = [
]
cflags = common_cflags + [
'-DG_LOG_DOMAIN="libnm-glib"'
'-DG_LOG_DOMAIN="@0@"'.format(libnm_glib_name)
]
vpn_headers = files(
@ -57,7 +57,7 @@ deprecated_headers = files('libnm_glib.h')
install_headers(
headers + vpn_headers + deprecated_headers,
subdir: 'libnm-glib'
subdir: libnm_glib_name
)
libdeprecated_nm_glib = static_library(
@ -126,10 +126,10 @@ libnm_glib_vpn_dep = declare_dependency(
pkg.generate(
libraries: libnm_glib_vpn,
version: nm_version,
name: 'libnm-glib-vpn',
name: libnm_glib_vpn_name,
description: 'Convenience library for NetworkManager VPN plugins',
filebase: 'libnm-glib-vpn',
subdirs: 'libnm-glib',
filebase: libnm_glib_vpn_name,
subdirs: libnm_glib_name,
requires: 'NetworkManager >= ' + nm_version + ' glib-2.0 dbus-glib-1',
variables: 'exec_prefix=${prefix}'
)
@ -222,10 +222,10 @@ libnm_glib_dep = declare_dependency(
pkg.generate(
libraries: libnm_glib,
version: nm_version,
name: 'libnm-glib',
name: libnm_glib_name,
description: 'Convenience library for clients of NetworkManager',
filebase: 'libnm-glib',
subdirs: 'libnm-glib',
filebase: libnm_glib_name,
subdirs: libnm_glib_name,
requires: 'libnm-util >= ' + nm_version + ' NetworkManager >= ' + nm_version + ' gobject-2.0 dbus-glib-1',
variables: 'exec_prefix=${prefix}'
)
@ -252,7 +252,7 @@ if enable_introspection
namespace: 'NMClient',
identifier_prefix: nm_id_prefix,
symbol_prefix: nm_id_prefix.to_lower(),
export_packages: ['libnm-glib', 'libnm-glib-vpn'],
export_packages: [libnm_glib_name, libnm_glib_vpn_name],
includes: gir_includes,
extra_args: cflags + [
'--include-uninstalled=' + libnm_util_gir[0].full_path(),
@ -261,7 +261,7 @@ if enable_introspection
)
endif
name = 'libnm-glib-test'
name = libnm_glib_name + '-test'
deps = common_deps + [libnm_util_dep]
@ -274,7 +274,7 @@ executable(
)
run_target(
'check-local-exports-libnm-glib',
'check-local-exports-' + libnm_glib_name,
command: [check_exports, libnm_glib.full_path(), symbol_map],
depends: libnm_glib
)

View file

@ -105,7 +105,7 @@ common_cflags = [
]
cflags = common_cflags + [
'-DG_LOG_DOMAIN="libnm-util"'
'-DG_LOG_DOMAIN="@0@"'.format(libnm_util_name)
]
symbol_map = join_paths(meson.current_source_dir(), 'libnm-util.ver')
@ -135,9 +135,9 @@ libnm_util_dep = declare_dependency(
pkg.generate(
libraries: libnm_util,
version: nm_version,
name: 'libnm-util',
name: libnm_util_name,
description: 'Convenience library for clients of NetworkManager',
filebase: 'libnm-util',
filebase: libnm_util_name,
subdirs: nm_name,
requires: 'NetworkManager >= ' + nm_version + ' glib-2.0 dbus-glib-1',
variables: 'exec_prefix=${prefix}'
@ -158,7 +158,7 @@ if enable_introspection
namespace: nm_name,
identifier_prefix: nm_id_prefix,
symbol_prefix: nm_id_prefix.to_lower(),
export_packages: 'libnm-util',
export_packages: libnm_util_name,
includes: gir_includes,
install: true
)
@ -170,7 +170,7 @@ if enable_introspection
endif
run_target(
'check-local-exports-libnm-util',
'check-local-exports-' + libnm_util_name,
command: [check_exports, libnm_util.full_path(), symbol_map],
depends: libnm_util
)

View file

@ -14,7 +14,7 @@ deps = [
]
cflags = [
'-DG_LOG_DOMAIN="libnm"',
'-DG_LOG_DOMAIN="@0@"'.format(libnm_name),
'-DNETWORKMANAGER_COMPILATION=NM_NETWORKMANAGER_COMPILATION_LIBNM',
'-DNMRUNDIR="@0@"'.format(nm_pkgrundir)
]
@ -72,7 +72,7 @@ libnm_headers = files(
install_headers(
libnm_core_headers + libnm_headers + [version_header],
subdir: 'libnm'
subdir: libnm_name
)
enum_headers = libnm_headers + [version_header]
@ -174,10 +174,10 @@ libnm_dep = declare_dependency(
pkg.generate(
libraries: libnm,
version: nm_version,
name: 'libnm',
name: libnm_name,
description: 'Convenience library for clients of NetworkManager',
filebase: 'libnm',
subdirs: 'libnm',
filebase: libnm_name,
subdirs: libnm_name,
requires: 'gio-2.0',
variables: [
'exec_prefix=${prefix}',
@ -186,7 +186,7 @@ pkg.generate(
)
run_target(
'check-local-exports-libnm',
'check-local-exports-' + libnm_name,
command: [check_exports, libnm.full_path(), symbol_map],
depends: libnm
)
@ -201,7 +201,7 @@ if enable_introspection
namespace: 'NM',
identifier_prefix: nm_id_prefix,
symbol_prefix: nm_id_prefix.to_lower(),
export_packages: 'libnm',
export_packages: libnm_name,
includes: 'Gio-2.0',
extra_args: cflags,
install: true

View file

@ -42,24 +42,31 @@ nm_pkglibdir = join_paths(nm_libdir, nm_name)
nm_pkgrundir = join_paths(nm_runstatedir, nm_name)
nm_pkgstatedir = join_paths(nm_localstatedir, nm_name)
libnm_name = 'libnm'
current = 1
revision = 0
age = 1
libnm_version = '@0@.@1@.@2@'.format(current - age, age, revision)
libnm_pkgincludedir = join_paths(nm_includedir, 'libnm')
libnm_pkgincludedir = join_paths(nm_includedir, libnm_name)
libnm_util_name = 'libnm-util'
current = 9
revision = 0
age = 7
libnm_util_version = '@0@.@1@.@2@'.format(current - age, age, revision)
libnm_glib_name = 'libnm-glib'
libnm_glib_vpn_name = libnm_glib_name + '-vpn'
current = 13
revision = 0
age = 9
libnm_glib_version = '@0@.@1@.@2@'.format(current - age, age, revision)
libnm_glib_pkgincludedir = join_paths(nm_includedir, 'libnm-glib')
libnm_glib_pkgincludedir = join_paths(nm_includedir, libnm_glib_name)
current = 3
revision = 0

View file

@ -83,7 +83,7 @@ if enable_wext
endif
libnetwork_manager_base = static_library(
'NetworkManagerBase',
nm_name + 'Base',
sources: sources,
dependencies: deps,
c_args: cflags,
@ -200,7 +200,7 @@ if enable_session_tracking
endif
libnetwork_manager = static_library(
'NetworkManager',
nm_name,
sources: sources,
dependencies: deps,
c_args: cflags,
@ -238,7 +238,7 @@ endif
'''
network_manager = executable(
meson.project_name(),
nm_name,
'main.c',
dependencies: deps,
c_args: cflags,
@ -298,7 +298,7 @@ if enable_tests
test_cflags_platform = '-DSETUP=nm_' + platform + '_platform_setup'
libnetwork_manager_test = static_library(
'NetworkManagerTest',
nm_name + 'Test',
sources: sources,
dependencies: deps,
c_args: cflags + test_cflags,

View file

@ -12,7 +12,7 @@ nm_pppd_plugin = shared_module(
include_directories: src_inc,
dependencies: deps,
c_args: [
'-DG_LOG_DOMAIN="nm-pppd-plugin"',
'-DG_LOG_DOMAIN="@0@"'.format(name),
'-DNETWORKMANAGER_COMPILATION=NM_NETWORKMANAGER_COMPILATION_GLIB',
],
install: true,
@ -26,7 +26,7 @@ deps = [
nm_dep
]
symbol_map = join_paths(meson.current_source_dir(), name + '.ver')
symbol_map = join_paths(meson.current_source_dir(), 'nm-ppp-plugin.ver')
ldflags = []
if have_version_script

View file

@ -1,5 +1,5 @@
gnome.generate_vapi(
'libnm',
libnm_name,
sources: libnm_gir[0],
packages: 'gio-2.0',
install: true
@ -12,7 +12,7 @@ if enable_libnm_glib
]
libnm_util_vapi = gnome.generate_vapi(
'libnm-util',
libnm_util_name,
sources: libnm_util_gir[0],
packages: packages,
install: true
@ -21,7 +21,7 @@ if enable_libnm_glib
packages += libnm_util_vapi
gnome.generate_vapi(
'libnm-glib',
libnm_glib_name,
sources: libnm_glib_gir[0],
packages: packages,
install: true