Commit cc472f52 authored by Thomas Haller's avatar Thomas Haller

all: merge branch 'th/build-cleanup-defines'

https://github.com/NetworkManager/NetworkManager/pull/126
parents cdbd99c5 f445128a
This diff is collapsed.
......@@ -29,7 +29,7 @@ deps = [
cflags = clients_cflags + [
'-DSYSCONFDIR="@0@"'.format(nm_sysconfdir),
'-DG_LOG_DOMAIN="@0@"'.format(name),
'-DNMCLI_LOCALEDIR="@0@"'.format(nm_localedir)
'-DNMLOCALEDIR="@0@"'.format(nm_localedir)
]
if enable_polkit_agent
......
......@@ -950,7 +950,7 @@ main (int argc, char *argv[])
#ifdef GETTEXT_PACKAGE
/* Set i18n stuff */
bindtextdomain (GETTEXT_PACKAGE, NMCLI_LOCALEDIR);
bindtextdomain (GETTEXT_PACKAGE, NMLOCALEDIR);
bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
textdomain (GETTEXT_PACKAGE);
#endif
......
......@@ -11,15 +11,13 @@ cflags = clients_cflags + [
'-DG_LOG_DOMAIN="libnmc"',
]
sources = shared_utils + files(
'nm-client-utils.c',
'nm-secret-agent-simple.c',
'nm-vpn-helpers.c'
)
libnmc_base = static_library(
'nmc-base',
sources: sources,
sources: shared_files_clients_common + files(
'nm-client-utils.c',
'nm-secret-agent-simple.c',
'nm-vpn-helpers.c',
),
dependencies: deps,
c_args: cflags
)
......@@ -29,11 +27,6 @@ libnmc_base_dep = declare_dependency(
link_with: libnmc_base
)
sources = shared_meta_setting + files(
'nm-meta-setting-access.c',
'nm-meta-setting-desc.c'
)
settings_docs = 'settings-docs.h'
if enable_introspection
......@@ -60,11 +53,13 @@ else
configuration: configuration_data()
)
endif
sources += settings_docs_source
libnmc = static_library(
'nmc',
sources: sources,
sources: files(
'nm-meta-setting-access.c',
'nm-meta-setting-desc.c'
) + shared_nm_utils_nm_meta_setting_c + [settings_docs_source],
dependencies: deps,
c_args: cflags,
link_with: libnmc_base,
......
......@@ -7,7 +7,7 @@ deps = [
cflags = clients_cflags + [
'-DG_LOG_DOMAIN="@0@"'.format(name),
'-DLOCALEDIR="@0@"'.format(nm_localedir)
'-DNMLOCALEDIR="@0@"'.format(nm_localedir)
]
subdir('newt')
......
......@@ -226,7 +226,7 @@ main (int argc, char **argv)
int i;
setlocale (LC_ALL, "");
bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
bindtextdomain (GETTEXT_PACKAGE, NMLOCALEDIR);
bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
textdomain (GETTEXT_PACKAGE);
......
......@@ -5,18 +5,16 @@ incs = [
libnm_inc
]
cflags = [
'-DNETWORKMANAGER_COMPILATION_TEST',
'-DNETWORKMANAGER_COMPILATION=NM_NETWORKMANAGER_COMPILATION_CLIENT',
'-DSRCDIR="@0@"'.format(meson.current_source_dir()),
]
exe = executable(
test_unit,
test_unit + '.c',
include_directories: incs,
dependencies: nm_core_dep,
c_args: cflags,
c_args: [
'-DNETWORKMANAGER_COMPILATION_TEST',
'-DNETWORKMANAGER_COMPILATION=NM_NETWORKMANAGER_COMPILATION_CLIENT',
] +
nm_build_cflags,
link_with: libnm_dispatcher_core
)
......
......@@ -29,6 +29,8 @@
#include "nm-utils/nm-test-utils.h"
#define TEST_DIR NM_BUILD_SRCDIR"/dispatcher/tests"
/*****************************************************************************/
static void
......@@ -525,8 +527,7 @@ test_generic (const char *file, const char *override_vpn_ip_iface)
gs_strfreev char **denv = NULL;
char **iter;
/* Read in the test file */
p = g_build_filename (SRCDIR, file, NULL);
p = g_build_filename (TEST_DIR, file, NULL);
success = get_dispatcher_file (p,
&con_dict,
&con_props,
......
......@@ -131,14 +131,15 @@ deps = [
dl_dep,
libudev_dep,
shared_dep,
uuid_dep
uuid_dep,
shared_c_siphash_dep,
]
cflags = [
'-DG_LOG_DOMAIN="@0@"'.format(libnm_name),
'-DNETWORKMANAGER_COMPILATION=NM_NETWORKMANAGER_COMPILATION_LIBNM_CORE',
'-DLIBEXECDIR="@0@"'.format(nm_libexecdir),
'-DLOCALEDIR="@0@"'.format(nm_localedir),
'-DNMLOCALEDIR="@0@"'.format(nm_localedir),
'-DNMCONFDIR="@0@"'.format(nm_pkgconfdir),
'-DNMLIBDIR="@0@"'.format(nm_pkglibdir),
'-DNMPLUGINDIR="@0@"'.format(nm_plugindir),
......@@ -150,9 +151,15 @@ if enable_json_validation
deps += jansson_dep
endif
libnm_core_sources_all = libnm_core_sources
libnm_core_sources_all += libnm_core_enum
libnm_core_sources_all += shared_nm_utils_nm_meta_setting_c
libnm_core_sources_all += shared_files_libnm_core
libnm_core_sources_all += [version_header]
libnm_core = static_library(
'nm-core',
sources: libnm_core_sources + libnm_core_enum + shared_sources + [version_header],
sources: libnm_core_sources_all,
dependencies: deps,
c_args: cflags
)
......@@ -160,7 +167,10 @@ libnm_core = static_library(
nm_core_dep = declare_dependency(
sources: libnm_core_enum[1],
include_directories: libnm_core_inc,
dependencies: shared_dep
dependencies: [
shared_dep,
shared_c_siphash_dep,
],
)
enums_to_docbook = join_paths(meson.source_root(), 'tools', 'enums-to-docbook.pl')
......
......@@ -249,7 +249,7 @@ _nm_utils_init (void)
g_error ("libnm-util symbols detected; Mixing libnm with libnm-util/libnm-glib is not supported");
g_module_close (self);
bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
bindtextdomain (GETTEXT_PACKAGE, NMLOCALEDIR);
bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
_nm_dbus_errors_init ();
......
......@@ -29,18 +29,16 @@ test_units = [
test_cert_dir = join_paths(meson.current_source_dir(), 'certs')
cflags = [
'-DNETWORKMANAGER_COMPILATION_TEST',
'-DNETWORKMANAGER_COMPILATION=NM_NETWORKMANAGER_COMPILATION_LIBNM_CORE',
'-DTEST_CERT_DIR="@0@"'.format(test_cert_dir),
]
foreach test_unit: test_units
exe = executable(
'libnm-core-' + test_unit,
[test_unit + '.c'] + enum,
dependencies: nm_core_dep,
c_args: cflags,
c_args: [
'-DNETWORKMANAGER_COMPILATION_TEST',
'-DNETWORKMANAGER_COMPILATION=NM_NETWORKMANAGER_COMPILATION_LIBNM_CORE',
] +
nm_build_cflags,
link_with: libnm_core
)
test(
......
......@@ -35,6 +35,8 @@
#include "nm-utils/nm-test-utils.h"
#define TEST_CERT_DIR NM_BUILD_SRCDIR"/libnm-core/tests/certs"
#if 0
static const char *pem_rsa_key_begin = "-----BEGIN RSA PRIVATE KEY-----";
static const char *pem_rsa_key_end = "-----END RSA PRIVATE KEY-----";
......
......@@ -33,6 +33,7 @@
#include "nm-utils/nm-test-utils.h"
#define TEST_CERT_DIR NM_BUILD_SRCDIR"/libnm-core/tests/certs"
#define TEST_WIRED_TLS_CA_CERT TEST_CERT_DIR"/test-ca-cert.pem"
#define TEST_WIRED_TLS_PRIVKEY TEST_CERT_DIR"/test-key-and-cert.pem"
......
......@@ -40,7 +40,8 @@
#include "nm-utils/nm-test-utils.h"
#define TEST_NEED_SECRETS_EAP_TLS_CA_CERT TEST_CERT_DIR "/test_ca_cert.pem"
#define TEST_CERT_DIR NM_BUILD_SRCDIR"/libnm-core/tests/certs"
#define TEST_NEED_SECRETS_EAP_TLS_CA_CERT TEST_CERT_DIR "/test_ca_cert.pem"
#define TEST_NEED_SECRETS_EAP_TLS_CLIENT_CERT TEST_CERT_DIR "/test_key_and_cert.pem"
#define TEST_NEED_SECRETS_EAP_TLS_PRIVATE_KEY TEST_CERT_DIR "/test_key_and_cert.pem"
......
......@@ -37,6 +37,8 @@
#include "nm-utils/nm-test-utils.h"
#define TEST_CERT_DIR NM_BUILD_SRCDIR"/libnm-core/tests/certs"
/*****************************************************************************/
static void
......
......@@ -79,13 +79,6 @@ sources = files(
glue = 'nm-vpn-plugin-glue.h'
sources += custom_target(
glue,
input: ifaces_vpn_plugin_xml,
output: glue,
command: [dbus_binding_tool, '--prefix=nm_vpn_plugin', '--mode=glib-server', '--output=@OUTPUT@', '@INPUT@']
)
enum_types = 'nm-vpn-enum-types'
libnm_glib_vpn_enum = gnome.mkenums(
......@@ -104,7 +97,18 @@ linker_script = join_paths(meson.current_source_dir(), 'libnm-glib-vpn.ver')
libnm_glib_vpn = shared_library(
'nm-glib-vpn',
sources: sources + libnm_glib_vpn_enum,
sources: files(
'nm-vpn-plugin.c',
'nm-vpn-plugin-ui-interface.c',
'nm-vpn-plugin-utils.c',
) + [
custom_target(
glue,
input: ifaces_vpn_plugin_xml,
output: glue,
command: [dbus_binding_tool, '--prefix=nm_vpn_plugin', '--mode=glib-server', '--output=@OUTPUT@', '@INPUT@'],
),
] + libnm_glib_vpn_enum,
version: libnm_glib_vpn_version,
dependencies: deps,
c_args: cflags,
......@@ -131,7 +135,7 @@ pkg.generate(
variables: 'exec_prefix=${prefix}'
)
sources = shared_udev_utils + files(
libnm_glib_sources = shared_files_libnm_glib + files(
'nm-access-point.c',
'nm-active-connection.c',
'nm-client.c',
......@@ -194,12 +198,10 @@ linker_script = join_paths(meson.current_source_dir(), 'libnm-glib.ver')
libnm_glib = shared_library(
'nm-glib',
sources: sources + libnm_glib_enum + [nm_secret_agent_glue],
sources: libnm_glib_sources + libnm_glib_enum + [nm_secret_agent_glue],
version: libnm_glib_version,
dependencies: deps,
c_args: cflags + [
'-DNMRUNDIR="@0@"'.format(nm_pkgrundir),
],
c_args: cflags,
link_whole: libdeprecated_nm_glib,
link_args: [
'-Wl,--version-script,@0@'.format(linker_script),
......@@ -225,7 +227,7 @@ pkg.generate(
)
if enable_introspection
gir_sources = sources + headers + libnm_glib_enum
gir_sources = libnm_glib_sources + headers + libnm_glib_enum
deps = [
dbus_glib_dep,
......
......@@ -14,12 +14,13 @@ test_units = [
foreach test_unit: test_units
exe = executable(
test_unit,
[test_unit + '.c'] + shared_test_utils,
[test_unit + '.c'] + shared_nm_test_utils_impl_c,
dependencies: deps,
c_args: common_cflags + [
'-DNETWORKMANAGER_COMPILATION_TEST',
'-DTEST_NM_SERVICE="@0@"'.format(join_paths(meson.source_root(), 'tools', 'test-networkmanager-service.py')),
],
c_args:
common_cflags + [
'-DNETWORKMANAGER_COMPILATION_TEST',
] +
nm_build_cflags,
)
test(
......
......@@ -55,7 +55,7 @@ libnm_utils_enum = gnome.mkenums(
install_dir: nm_pkgincludedir
)
sources = shared_utils + files(
sources = files(
'crypto.c',
'crypto_' + crypto + '.c',
'nm-connection.c',
......@@ -90,6 +90,7 @@ sources = shared_utils + files(
'nm-utils.c',
'nm-value-transforms.c'
)
sources += shared_files_libnm_util
deps = [
crypto_dep,
......@@ -101,7 +102,7 @@ deps = [
common_cflags = [
'-DNETWORKMANAGER_COMPILATION=NM_NETWORKMANAGER_COMPILATION_LIBNM_UTIL',
'-DLOCALEDIR="@0@"'.format(nm_localedir),
'-DNMLOCALEDIR="@0@"'.format(nm_localedir),
]
cflags = common_cflags + [
......
......@@ -232,7 +232,7 @@ nm_utils_init (GError **error)
if (!initialized) {
initialized = TRUE;
bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR);
bindtextdomain (GETTEXT_PACKAGE, NMLOCALEDIR);
bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
if (!crypto_init (error))
......
......@@ -6,10 +6,8 @@ deps = [
]
cflags = common_cflags + [
'-DBUILD_DIR="@0@"'.format(meson.current_build_dir()),
'-DTEST_CERT_DIR="@0@"'.format(test_cert_dir),
'-DNETWORKMANAGER_COMPILATION_TEST',
]
] + nm_build_cflags
test = 'test-libnm-linking'
......
......@@ -33,6 +33,8 @@
#include "nm-utils/nm-test-utils.h"
#define TEST_CERT_DIR NM_BUILD_SRCDIR"/libnm-core/tests/certs"
#if 0
static const char *pem_rsa_key_begin = "-----BEGIN RSA PRIVATE KEY-----";
static const char *pem_rsa_key_end = "-----END RSA PRIVATE KEY-----";
......
......@@ -2428,7 +2428,8 @@ test_libnm_linking (void)
int status;
GError *error = NULL;
g_spawn_sync (BUILD_DIR, argv, NULL, 0 /*G_SPAWN_DEFAULT*/,
g_spawn_sync (NM_BUILD_BUILDDIR"/libnm-util/tests",
argv, NULL, 0 /*G_SPAWN_DEFAULT*/,
_test_libnm_linking_setup_child_process, NULL,
&out, &err, &status, &error);
g_assert_no_error (error);
......
......@@ -39,7 +39,8 @@
#include "nm-utils/nm-test-utils.h"
#define TEST_NEED_SECRETS_EAP_TLS_CA_CERT TEST_CERT_DIR "/test_ca_cert.pem"
#define TEST_CERT_DIR NM_BUILD_SRCDIR"/libnm-core/tests/certs"
#define TEST_NEED_SECRETS_EAP_TLS_CA_CERT TEST_CERT_DIR "/test_ca_cert.pem"
#define TEST_NEED_SECRETS_EAP_TLS_CLIENT_CERT TEST_CERT_DIR "/test_key_and_cert.pem"
#define TEST_NEED_SECRETS_EAP_TLS_PRIVATE_KEY TEST_CERT_DIR "/test_key_and_cert.pem"
......
......@@ -29,6 +29,8 @@
#include "nm-utils/nm-test-utils.h"
#define TEST_CERT_DIR NM_BUILD_SRCDIR"/libnm-core/tests/certs"
static void
compare_blob_data (const char *test,
const char *key_path,
......
......@@ -10,7 +10,6 @@ deps = [
cflags = [
'-DG_LOG_DOMAIN="@0@"'.format(libnm_name),
'-DNETWORKMANAGER_COMPILATION=NM_NETWORKMANAGER_COMPILATION_LIBNM',
'-DNMRUNDIR="@0@"'.format(nm_pkgrundir)
]
if have_fake_typelibs
......
test_units = [
['test-general', shared_utils, [libnm_utils]],
['test-nm-client', shared_test_utils, []],
['test-remote-settings-client', shared_test_utils, []],
['test-secret-agent', shared_test_utils, []]
]
deps = [
libnm_dep,
nm_core_dep
['test-general', [libnm_utils, libnm_core]],
['test-nm-client', []],
['test-remote-settings-client', []],
['test-secret-agent', []],
]
cflags = [
'-DNETWORKMANAGER_COMPILATION_TEST',
'-DNETWORKMANAGER_COMPILATION=NM_NETWORKMANAGER_COMPILATION_LIBNM',
'-DTEST_NM_SERVICE="@0@"'.format(join_paths(meson.source_root(), 'tools', 'test-networkmanager-service.py'))
]
] + nm_build_cflags
foreach test_unit: test_units
exe = executable(
'libnm-' + test_unit[0],
[test_unit[0] + '.c'] + test_unit[1],
dependencies: deps,
[
test_unit[0] + '.c',
shared_nm_test_utils_impl_c,
],
dependencies: [
libnm_dep,
nm_core_dep,
],
c_args: cflags,
link_with: test_unit[2]
link_with: test_unit[1]
)
test(
......@@ -35,7 +35,7 @@ endforeach
# just test, that we can build "nm-vpn-plugin-utils.c"
libnm_vpn_plugin_utils_test = static_library(
'nm-vpn-plugin-utils-test',
sources: shared_vpn_plugin_utils + [libnm_enum[1]],
sources: shared_nm_utils_nm_vpn_plugin_utils_c + [libnm_enum[1]],
include_directories: libnm_inc,
dependencies: nm_core_dep,
c_args: cflags
......
......@@ -54,6 +54,11 @@ nm_pkgstatedir = join_paths(nm_localstatedir, nm_name)
nm_vpndir = join_paths(nm_libdir, nm_name)
nm_plugindir = join_paths(nm_libdir, nm_name, dist_version)
nm_build_cflags = [
'-DNM_BUILD_SRCDIR="@0@"'.format(meson.source_root()),
'-DNM_BUILD_BUILDDIR="@0@"'.format(meson.build_root()),
]
libnm_name = 'libnm'
current = 1
......
shared_c_list_dep = declare_dependency(
include_directories: include_directories('c-list/src')
)
shared_inc = include_directories('.')
shared_c_siphash = static_library(
'c-siphash',
sources: ['c-siphash/src/c-siphash.c']
sources: 'c-siphash/src/c-siphash.c',
)
shared_c_siphash_dep = declare_dependency(
include_directories: include_directories('c-siphash/src'),
link_with: shared_c_siphash
include_directories: shared_inc,
link_with: shared_c_siphash,
)
shared_n_acd = static_library(
'n-acd',
sources: ['n-acd/src/n-acd.c'],
dependencies: [ shared_c_siphash_dep, shared_c_list_dep ]
sources: 'n-acd/src/n-acd.c',
include_directories: [
include_directories('c-siphash/src'),
include_directories('c-list/src'),
],
dependencies: shared_c_siphash_dep,
)
shared_n_acd_dep = declare_dependency(
include_directories: include_directories('.'),
include_directories: shared_inc,
link_with: shared_n_acd,
)
shared_inc = include_directories('.')
version_conf = configuration_data()
version_conf.set('NM_MAJOR_VERSION', nm_major_version)
version_conf.set('NM_MINOR_VERSION', nm_minor_version)
version_conf.set('NM_MICRO_VERSION', nm_micro_version)
version = 'nm-version-macros.h'
version_header = configure_file(
input: version + '.in',
output: version,
configuration: version_conf
input: 'nm-version-macros.h.in',
output: 'nm-version-macros.h',
configuration: version_conf,
)
shared_meta_setting = files('nm-meta-setting.c')
shared_nm_utils_nm_meta_setting_c = files('nm-meta-setting.c')
shared_test_utils = files('nm-test-utils-impl.c')
shared_nm_test_utils_impl_c = files('nm-test-utils-impl.c')
shared_siphash = files('nm-utils/siphash24.c')
shared_nm_utils_nm_vpn_plugin_utils_c = files('nm-utils/nm-vpn-plugin-utils.c')
shared_udev_utils = files('nm-utils/nm-udev-utils.c')
shared_files_libnm_core = files('''
c-siphash/src/c-siphash.c
nm-utils/c-list-util.c
nm-utils/nm-dedup-multi.c
nm-utils/nm-enum-utils.c
nm-utils/nm-hash-utils.c
nm-utils/nm-random-utils.c
nm-utils/nm-shared-utils.c
nm-utils/nm-udev-utils.c
'''.split())
shared_utils = files(
'nm-utils/nm-enum-utils.c',
'nm-utils/nm-hash-utils.c',
'nm-utils/nm-random-utils.c',
'nm-utils/nm-shared-utils.c'
)
shared_files_clients_common = files('''
c-siphash/src/c-siphash.c
nm-utils/nm-enum-utils.c
nm-utils/nm-hash-utils.c
nm-utils/nm-random-utils.c
nm-utils/nm-shared-utils.c
'''.split())
shared_vpn_plugin_utils = files('nm-utils/nm-vpn-plugin-utils.c')
shared_files_libnm_util = files('''
nm-utils/nm-shared-utils.c
'''.split())
shared_sources = shared_utils + shared_meta_setting + shared_udev_utils + files(
'nm-utils/c-list-util.c',
'nm-utils/nm-dedup-multi.c'
)
shared_files_libnm_glib = files('''
nm-utils/nm-udev-utils.c
'''.split())
shared_dep = declare_dependency(
include_directories: [
top_inc,
shared_inc,
include_directories('nm-utils')
],
dependencies: glib_dep
include_directories: [
top_inc,
shared_inc,
],
dependencies: glib_dep,
)
......@@ -28,6 +28,8 @@
#include "nm-test-libnm-utils.h"
#define NMTSTC_NM_SERVICE NM_BUILD_SRCDIR"/tools/test-networkmanager-service.py"
/*****************************************************************************/
static gboolean
......@@ -116,7 +118,7 @@ nmtstc_service_available (NMTstcServiceInfo *info)
/* This happens, when test-networkmanager-service.py exits with 77 status
* code. */
m = g_strdup_printf ("missing dependency for running NetworkManager stub service %s", TEST_NM_SERVICE);
m = g_strdup_printf ("missing dependency for running NetworkManager stub service %s", NMTSTC_NM_SERVICE);
g_test_skip (m);
return NULL;
}
......@@ -125,7 +127,7 @@ NMTstcServiceInfo *
nmtstc_service_init (void)
{
NMTstcServiceInfo *info;
const char *args[] = { TEST_NM_PYTHON, TEST_NM_SERVICE, NULL };
const char *args[] = { TEST_NM_PYTHON, NMTSTC_NM_SERVICE, NULL };
GError *error = NULL;
info = g_malloc0 (sizeof (*info));
......@@ -170,7 +172,7 @@ nmtstc_service_init (void)
g_main_context_unref (context);
if (had_timeout)
g_error ("test service %s did not start in time", TEST_NM_SERVICE);
g_error ("test service %s did not start in time", NMTSTC_NM_SERVICE);
if (!data.name_found) {
g_assert (data.exited);
info->pid = NM_PID_T_INVAL;
......@@ -184,7 +186,7 @@ nmtstc_service_init (void)
* via pygobject. */
return NULL;
}
g_error ("test service %s exited with error code %d", TEST_NM_SERVICE, data.exit_code);
g_error ("test service %s exited with error code %d", NMTSTC_NM_SERVICE, data.exit_code);
}
}
......
......@@ -28,8 +28,6 @@
#include "nm-shared-utils.h"
#include "nm-random-utils.h"
#include "siphash24.c"
/*****************************************************************************/
#define HASH_KEY_SIZE 16u
......@@ -49,7 +47,7 @@ _get_hash_key_init (void)
} g_arr _nm_alignas (guint64);