Commit 22ef6a50 authored by Thomas Haller's avatar Thomas Haller

build: refine the NETWORKMANAGER_COMPILATION define

Note that:

 - we compile some source files multiple times. Most notably those
   under "shared/".

 - we include a default header "shared/nm-default.h" in every source
   file. This header is supposed to setup a common environment by defining
   and including parts that are commonly used. As we always include the
   same header, the header must behave differently depending
   one whether the compilation is for libnm-core, NetworkManager or
   libnm-glib. E.g. it must include <glib/gi18n.h> or <glib/gi18n-lib.h>
   depending on whether we compile a library or an application.

For that, the source files need the NETWORKMANAGER_COMPILATION #define
to behave accordingly.

Extend the define to be composed of flags. These flags are all named
NM_NETWORKMANAGER_COMPILATION_WITH_*, they indicate which part of the
build are available. E.g. when building libnm-core.la itself, then
WITH_LIBNM_CORE, WITH_LIBNM_CORE_INTERNAL, and WITH_LIBNM_CORE_PRIVATE
are available. When building NetworkManager, WITH_LIBNM_CORE_PRIVATE
is not available but the internal parts are still accessible. When
building nmcli, only WITH_LIBNM_CORE (the public part) is available.
This granularily controls the build.
parent 31b6abd4
This diff is collapsed.
......@@ -30,9 +30,9 @@ deps = [
readline_dep
]
cflags = [
cflags = clients_cflags + [
'-DG_LOG_DOMAIN="nmcli"',
'-DNMCLI_LOCALEDIR="@0@"'.format(nm_localedir)
'-DNMCLI_LOCALEDIR="@0@"'.format(nm_localedir),
]
ldflags = []
......
......@@ -13,9 +13,8 @@ deps = [
libnm_dep
]
cflags = [
cflags = clients_cflags + [
'-DG_LOG_DOMAIN="libnmc"',
'-DNMLOCALEDIR="@0@"'.format(nm_localedir)
]
sources = shared_utils + files(
......@@ -29,7 +28,7 @@ libnmc_base = static_library(
sources: sources + [libnm_core_enum[1]],
include_directories: incs,
dependencies: deps,
c_args: common_cflags
c_args: cflags,
)
libnmc_base_dep = declare_dependency(
......@@ -75,7 +74,7 @@ libnmc = static_library(
sources: sources + [libnm_core_enum[1]],
include_directories: incs,
dependencies: deps,
c_args: common_cflags,
c_args: cflags,
link_with: libnmc_base,
link_depends: settings_docs_source
)
......
......@@ -10,7 +10,9 @@ exe = executable(
test_unit + '.c',
include_directories: incs,
dependencies: deps,
c_args: cflags
c_args: clients_cflags + [
'-DNETWORKMANAGER_COMPILATION_TEST',
],
)
test(test_unit, exe)
......@@ -11,9 +11,13 @@ deps = [
libnm_dep
]
cflags = [
clients_cflags = [
'-DNETWORKMANAGER_COMPILATION=NM_NETWORKMANAGER_COMPILATION_CLIENT',
'-DNMLOCALEDIR="@0@"'.format(nm_localedir),
]
cflags = clients_cflags + [
'-DG_LOG_DOMAIN="@0@"'.format(name),
'-DNMLOCALEDIR="@0@"'.format(nm_localedir)
]
ldflags = []
......
incs = [
top_inc,
shared_inc,
libnm_core_inc
libnm_core_inc,
libnm_inc,
]
deps = [
......@@ -9,7 +10,10 @@ deps = [
newt_dep
]
cflags = ['-DG_LOG_DOMAIN="nmtui"']
cflags = clients_cflags + [
'-DG_LOG_DOMAIN="nmtui"',
'-DLOCALEDIR="@0@"'.format(nm_localedir),
]
subdir('newt')
......@@ -62,8 +66,6 @@ deps += [
libnmt_newt_dep
]
cflags += '-DLOCALEDIR="@0@"'.format(nm_localedir)
ldflags = []
if have_version_script
ldflags += '-Wl,--version-script,@0@'.format(linker_script_binary)
......
......@@ -39,7 +39,9 @@ deps = [
cflags = [
'-DLIBEXECDIR="@0@"'.format(nm_libexecdir),
'-DSYSCONFDIR="@0@"'.format(nm_sysconfdir),
'-DNMCONFDIR="@0@"'.format(nm_pkgconfdir)
'-DNMCONFDIR="@0@"'.format(nm_pkgconfdir),
'-DG_LOG_DOMAIN="@0@"'.format(name),
'-DNETWORKMANAGER_COMPILATION=NM_NETWORKMANAGER_COMPILATION_CLIENT',
]
libnm_dispatcher_core = static_library(
......
......@@ -4,10 +4,15 @@ incs = [
top_inc,
shared_inc,
libnm_core_inc,
libnm_inc,
dispatcher_inc
]
cflags = '-DSRCDIR="@0@"'.format(meson.current_source_dir())
cflags = [
'-DNETWORKMANAGER_COMPILATION_TEST',
'-DNETWORKMANAGER_COMPILATION=NM_NETWORKMANAGER_COMPILATION_CLIENT',
'-DSRCDIR="@0@"'.format(meson.current_source_dir()),
]
exe = executable(
test_unit,
......
......@@ -24,7 +24,6 @@
#include <stdlib.h>
#include <string.h>
#include "nm-core-internal.h"
#include "nm-dispatcher-utils.h"
#include "nm-dispatcher-api.h"
......
......@@ -24,6 +24,10 @@
#ifndef __CRYPTO_H__
#define __CRYPTO_H__
#if !((NETWORKMANAGER_COMPILATION) & NM_NETWORKMANAGER_COMPILATION_WITH_LIBNM_CORE_PRIVATE)
#error Cannot use this header.
#endif
#define MD5_HASH_LEN 20
#define CIPHER_DES_EDE3_CBC "DES-EDE3-CBC"
#define CIPHER_DES_CBC "DES-CBC"
......
......@@ -142,7 +142,7 @@ deps = [
cflags = [
'-DG_LOG_DOMAIN="libnm"',
'-DNETWORKMANAGER_COMPILATION=NM_NETWORKMANAGER_COMPILATION_LIB',
'-DNETWORKMANAGER_COMPILATION=NM_NETWORKMANAGER_COMPILATION_LIBNM_CORE',
'-DLIBEXECDIR="@0@"'.format(nm_libexecdir),
'-DLOCALEDIR="@0@"'.format(nm_localedir),
'-DNMCONFDIR="@0@"'.format(nm_pkgconfdir),
......
......@@ -21,6 +21,10 @@
#ifndef __NM_CONNECTION_PRIVATE_H__
#define __NM_CONNECTION_PRIVATE_H__
#if !((NETWORKMANAGER_COMPILATION) & NM_NETWORKMANAGER_COMPILATION_WITH_LIBNM_CORE_PRIVATE)
#error Cannot use this header.
#endif
#include "nm-setting.h"
#include "nm-connection.h"
......
......@@ -31,6 +31,9 @@
* statically against libnm-core. This basically means libnm-core, libnm, NetworkManager
* and some test programs.
**/
#if !((NETWORKMANAGER_COMPILATION) & NM_NETWORKMANAGER_COMPILATION_WITH_LIBNM_CORE_INTERNAL)
#error Cannot use this header.
#endif
#include "nm-connection.h"
......
......@@ -22,6 +22,10 @@
#ifndef NM_CORE_TYPES_INTERNAL_H
#define NM_CORE_TYPES_INTERNAL_H
#if !((NETWORKMANAGER_COMPILATION) & NM_NETWORKMANAGER_COMPILATION_WITH_LIBNM_CORE_INTERNAL)
#error Cannot use this header.
#endif
typedef struct {
guint32 from;
guint32 to;
......
......@@ -22,6 +22,10 @@
#ifndef __NM_KEYFILE_INTERNAL_H__
#define __NM_KEYFILE_INTERNAL_H__
#if !((NETWORKMANAGER_COMPILATION) & NM_NETWORKMANAGER_COMPILATION_WITH_LIBNM_CORE_INTERNAL)
#error Cannot use this header.
#endif
#include <sys/types.h>
#include "nm-connection.h"
......
......@@ -21,7 +21,9 @@
#ifndef __NM_KEYFILE_UTILS_H__
#define __NM_KEYFILE_UTILS_H__
#include <glib.h>
#if !((NETWORKMANAGER_COMPILATION) & NM_NETWORKMANAGER_COMPILATION_WITH_LIBNM_CORE_PRIVATE)
#error Cannot use this header.
#endif
#define NM_KEYFILE_GROUP_VPN_SECRETS "vpn-secrets"
......
......@@ -23,6 +23,10 @@
#ifndef __NM_PROPERTY_COMPARE_H__
#define __NM_PROPERTY_COMPARE_H__
#if !((NETWORKMANAGER_COMPILATION) & NM_NETWORKMANAGER_COMPILATION_WITH_LIBNM_CORE_PRIVATE)
#error Cannot use this header.
#endif
int nm_property_compare (GVariant *value1, GVariant *value2);
#endif /* __NM_PROPERTY_COMPARE_H__ */
......@@ -21,6 +21,10 @@
#ifndef __NM_SETTING_PRIVATE_H__
#define __NM_SETTING_PRIVATE_H__
#if !((NETWORKMANAGER_COMPILATION) & NM_NETWORKMANAGER_COMPILATION_WITH_LIBNM_CORE_PRIVATE)
#error Cannot use this header.
#endif
#include "nm-setting.h"
#include "nm-connection.h"
#include "nm-core-enum-types.h"
......
......@@ -21,8 +21,8 @@
#ifndef __NM_UTILS_PRIVATE_H__
#define __NM_UTILS_PRIVATE_H__
#ifdef __NETWORKMANAGER_TYPES_H__
#error "nm-utils-private.h" must not be used outside of libnm-core/. Do you want "nm-core-internal.h"?
#if !((NETWORKMANAGER_COMPILATION) & NM_NETWORKMANAGER_COMPILATION_WITH_LIBNM_CORE_PRIVATE)
#error Cannot use this header.
#endif
#include "nm-setting-private.h"
......
......@@ -35,7 +35,11 @@ incs = [
test_cert_dir = join_paths(meson.current_source_dir(), 'certs')
cflags = '-DTEST_CERT_DIR="@0@"'.format(test_cert_dir)
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(
......
......@@ -12,8 +12,11 @@ common_deps = [
]
common_cflags = [
'-DNETWORKMANAGER_COMPILATION=NM_NETWORKMANAGER_COMPILATION_LIBNM_GLIB',
]
cflags = common_cflags + [
'-DG_LOG_DOMAIN="libnm-glib"',
'-DNETWORKMANAGER_COMPILATION=NM_NETWORKMANAGER_COMPILATION_LIB_LEGACY'
]
libnm_glib_inc = include_directories('.')
......@@ -64,17 +67,15 @@ install_headers(
incs = common_incs + [libnm_util_inc]
cflags = common_cflags + [
'-Wno-deprecated-declarations',
'-Wno-deprecated'
]
libdeprecated_nm_glib = static_library(
'deprecated-nm-glib',
sources: 'libnm_glib.c',
include_directories: incs,
dependencies: common_deps,
c_args: cflags
c_args: cflags + [
'-Wno-deprecated-declarations',
'-Wno-deprecated',
],
)
sources = files(
......@@ -119,7 +120,7 @@ libnm_glib_vpn = shared_library(
version: libnm_glib_vpn_version,
include_directories: common_incs,
dependencies: deps,
c_args: common_cflags,
c_args: cflags,
link_args: ldflags,
link_depends: symbol_map,
install: true
......@@ -200,8 +201,6 @@ deps = common_deps + [
libnm_util_dep
]
cflags = common_cflags + ['-DNMRUNDIR="@0@"'.format(nm_pkgrundir)]
symbol_map = join_paths(meson.current_source_dir(), 'libnm-glib.ver')
ldflags = []
......@@ -215,7 +214,9 @@ libnm_glib = shared_library(
version: libnm_glib_version,
include_directories: common_incs,
dependencies: deps,
c_args: cflags,
c_args: cflags + [
'-DNMRUNDIR="@0@"'.format(nm_pkgrundir),
],
link_with: libdeprecated_nm_glib,
link_args: ldflags,
link_depends: symbol_map,
......@@ -262,7 +263,9 @@ if enable_introspection
symbol_prefix: nm_id_prefix.to_lower(),
export_packages: ['libnm-glib', 'libnm-glib-vpn'],
includes: gir_includes,
extra_args: common_cflags + ['--include-uninstalled=' + libnm_util_gir[0].full_path()],
extra_args: cflags + [
'--include-uninstalled=' + libnm_util_gir[0].full_path(),
],
install: true
)
endif
......@@ -276,7 +279,7 @@ executable(
[name + '.c', libnm_utils_enum[1]],
include_directories: common_incs,
dependencies: deps,
c_args: common_cflags,
c_args: cflags,
link_with: libnm_glib
)
......
......@@ -11,11 +11,6 @@ deps = [
libnm_util_dep
]
cflags = [
'-DNETWORKMANAGER_COMPILATION=NM_NETWORKMANAGER_COMPILATION_LIB_LEGACY',
'-DTEST_NM_SERVICE="@0@"'.format(join_paths(meson.source_root(), 'tools', 'test-networkmanager-service.py'))
]
test_units = [
'test-nm-client',
'test-remote-settings-client'
......@@ -27,7 +22,10 @@ foreach test_unit: test_units
[test_unit + '.c', libnm_utils_enum[1]] + shared_test_utils,
include_directories: incs,
dependencies: deps,
c_args: cflags
c_args: common_cflags + [
'-DNETWORKMANAGER_COMPILATION_TEST',
'-DTEST_NM_SERVICE="@0@"'.format(join_paths(meson.source_root(), 'tools', 'test-networkmanager-service.py')),
],
)
test(test_unit, exe)
......
......@@ -104,10 +104,13 @@ deps = [
uuid_dep
]
cflags = [
common_cflags = [
'-DNETWORKMANAGER_COMPILATION=NM_NETWORKMANAGER_COMPILATION_LIBNM_UTIL',
'-DLOCALEDIR="@0@"'.format(nm_localedir),
]
cflags = common_cflags + [
'-DG_LOG_DOMAIN="libnm-util"',
'-DNETWORKMANAGER_COMPILATION=NM_NETWORKMANAGER_COMPILATION_LIB_LEGACY',
'-DLOCALEDIR="@0@"'.format(nm_localedir)
]
symbol_map = join_paths(meson.current_source_dir(), 'libnm-util.ver')
......
......@@ -10,9 +10,10 @@ deps = [
libnm_util_dep
]
cflags = [
cflags = common_cflags + [
'-DBUILD_DIR="@0@"'.format(meson.current_build_dir()),
'-DTEST_CERT_DIR="@0@"'.format(test_cert_dir)
'-DTEST_CERT_DIR="@0@"'.format(test_cert_dir),
'-DNETWORKMANAGER_COMPILATION_TEST',
]
test = 'test-libnm-linking'
......
......@@ -21,7 +21,7 @@ deps = [
cflags = [
'-DG_LOG_DOMAIN="libnm"',
'-DNETWORKMANAGER_COMPILATION=NM_NETWORKMANAGER_COMPILATION_LIB',
'-DNETWORKMANAGER_COMPILATION=NM_NETWORKMANAGER_COMPILATION_LIBNM',
'-DNMRUNDIR="@0@"'.format(nm_pkgrundir)
]
......
......@@ -21,6 +21,10 @@
#ifndef __NM_DBUS_HELPERS_PRIVATE_H__
#define __NM_DBUS_HELPERS_PRIVATE_H__
#if !((NETWORKMANAGER_COMPILATION) & NM_NETWORKMANAGER_COMPILATION_WITH_LIBNM_PRIVATE)
#error Cannot use this header.
#endif
#include "nm-dbus-compat.h"
GBusType _nm_dbus_bus_type (void);
......
......@@ -21,9 +21,11 @@
#ifndef __NM_DHCP4_CONFIG_H__
#define __NM_DHCP4_CONFIG_H__
#include "nm-dhcp-config.h"
#if !((NETWORKMANAGER_COMPILATION) & NM_NETWORKMANAGER_COMPILATION_WITH_LIBNM_PRIVATE)
#error Cannot use this header.
#endif
G_BEGIN_DECLS
#include "nm-dhcp-config.h"
#define NM_TYPE_DHCP4_CONFIG (nm_dhcp4_config_get_type ())
#define NM_DHCP4_CONFIG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_DHCP4_CONFIG, NMDhcp4Config))
......@@ -40,13 +42,8 @@ typedef struct {
typedef struct {
NMDhcpConfigClass parent;
/*< private >*/
gpointer padding[4];
} NMDhcp4ConfigClass;
GType nm_dhcp4_config_get_type (void);
G_END_DECLS
#endif /* __NM_DHCP4_CONFIG_H__ */
......@@ -21,9 +21,11 @@
#ifndef __NM_DHCP6_CONFIG_H__
#define __NM_DHCP6_CONFIG_H__
#include "nm-dhcp-config.h"
#if !((NETWORKMANAGER_COMPILATION) & NM_NETWORKMANAGER_COMPILATION_WITH_LIBNM_PRIVATE)
#error Cannot use this header.
#endif
G_BEGIN_DECLS
#include "nm-dhcp-config.h"
#define NM_TYPE_DHCP6_CONFIG (nm_dhcp6_config_get_type ())
#define NM_DHCP6_CONFIG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_DHCP6_CONFIG, NMDhcp6Config))
......@@ -40,13 +42,8 @@ typedef struct {
typedef struct {
NMDhcpConfigClass parent;
/*< private >*/
gpointer padding[4];
} NMDhcp6ConfigClass;
GType nm_dhcp6_config_get_type (void);
G_END_DECLS
#endif /* __NM_DHCP6_CONFIG_H__ */
......@@ -21,11 +21,13 @@
#ifndef __NM_DNS_MANAGER_H__
#define __NM_DNS_MANAGER_H__
#if !((NETWORKMANAGER_COMPILATION) & NM_NETWORKMANAGER_COMPILATION_WITH_LIBNM_PRIVATE)
#error Cannot use this header.
#endif
#include "nm-object.h"
#include "nm-client.h"
G_BEGIN_DECLS
#define NM_TYPE_DNS_MANAGER (nm_dns_manager_get_type ())
#define NM_DNS_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_DNS_MANAGER, NMDnsManager))
#define NM_DNS_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), NM_TYPE_DNS_MANAGER, NMDnsManagerClass))
......@@ -49,13 +51,8 @@ struct _NMDnsManager {
struct _NMDnsManagerClass {
NMObjectClass parent;
/*< private >*/
gpointer padding[8];
};
G_END_DECLS
GType nm_dns_manager_get_type (void);
const char *nm_dns_manager_get_mode (NMDnsManager *manager);
......
......@@ -22,9 +22,11 @@
#ifndef __NM_IP4_CONFIG_H__
#define __NM_IP4_CONFIG_H__
#include "nm-ip-config.h"
#if !((NETWORKMANAGER_COMPILATION) & NM_NETWORKMANAGER_COMPILATION_WITH_LIBNM_PRIVATE)
#error Cannot use this header.
#endif
G_BEGIN_DECLS
#include "nm-ip-config.h"
#define NM_TYPE_IP4_CONFIG (nm_ip4_config_get_type ())
#define NM_IP4_CONFIG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_IP4_CONFIG, NMIP4Config))
......@@ -42,13 +44,8 @@ typedef struct {
typedef struct {
NMIPConfigClass parent;
/*< private >*/
gpointer padding[4];
} NMIP4ConfigClass;
GType nm_ip4_config_get_type (void);
G_END_DECLS
#endif /* __NM_IP4_CONFIG_H__ */
......@@ -22,9 +22,11 @@
#ifndef __NM_IP6_CONFIG_H__
#define __NM_IP6_CONFIG_H__
#include "nm-ip-config.h"
#if !((NETWORKMANAGER_COMPILATION) & NM_NETWORKMANAGER_COMPILATION_WITH_LIBNM_PRIVATE)
#error Cannot use this header.
#endif
G_BEGIN_DECLS
#include "nm-ip-config.h"
#define NM_TYPE_IP6_CONFIG (nm_ip6_config_get_type ())
#define NM_IP6_CONFIG(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_IP6_CONFIG, NMIP6Config))
......@@ -42,13 +44,8 @@ typedef struct {
typedef struct {
NMIPConfigClass parent;
/*< private >*/
gpointer padding[4];
} NMIP6ConfigClass;
GType nm_ip6_config_get_type (void);
G_END_DECLS
#endif /* __NM_IP6_CONFIG_H__ */
......@@ -21,6 +21,10 @@
#ifndef __NM_LIBNM_UTILS_H__
#define __NM_LIBNM_UTILS_H__
#if !((NETWORKMANAGER_COMPILATION) & NM_NETWORKMANAGER_COMPILATION_WITH_LIBNM_PRIVATE)
#error Cannot use this header.
#endif
char *nm_utils_fixup_desc_string (const char *desc);
#endif /* __NM_LIBNM_UTILS_H__ */
......@@ -22,11 +22,13 @@
#ifndef __NM_MANAGER_H__
#define __NM_MANAGER_H__
#if !((NETWORKMANAGER_COMPILATION) & NM_NETWORKMANAGER_COMPILATION_WITH_LIBNM_PRIVATE)
#error Cannot use this header.
#endif
#include "nm-object.h"
#include "nm-client.h"
G_BEGIN_DECLS
#define NM_TYPE_MANAGER (nm_manager_get_type ())
#define NM_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_MANAGER, NMManager))
#define NM_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), NM_TYPE_MANAGER, NMManagerClass))
......@@ -75,8 +77,6 @@ typedef struct {
void (*permission_changed) (NMManager *manager,
NMClientPermission permission,
NMClientPermissionResult result);
/* nm-manager.h is internal API. We can add more slots without breaking ABI. */
} NMManagerClass;
GType nm_manager_get_type (void);
......@@ -102,13 +102,10 @@ gboolean nm_manager_wimax_get_enabled (NMManager *manager);
void nm_manager_wimax_set_enabled (NMManager *manager, gboolean enabled);
gboolean nm_manager_wimax_hardware_get_enabled (NMManager *manager);
NM_AVAILABLE_IN_1_10
gboolean nm_manager_connectivity_check_get_available (NMManager *manager);
NM_AVAILABLE_IN_1_10
gboolean nm_manager_connectivity_check_get_enabled (NMManager *manager);
NM_AVAILABLE_IN_1_10
void nm_manager_connectivity_check_set_enabled (NMManager *manager,
gboolean enabled);
......@@ -140,7 +137,6 @@ NMConnectivityState nm_manager_check_connectivity_finish (NMManager *manager,
/* Devices */
const GPtrArray *nm_manager_get_devices (NMManager *manager);
NM_AVAILABLE_IN_1_2
const GPtrArray *nm_manager_get_all_devices(NMManager *manager);
NMDevice *nm_manager_get_device_by_path (NMManager *manager, const char *object_path);
NMDevice *nm_manager_get_device_by_iface (NMManager *manager, const char *iface);
......@@ -215,6 +211,4 @@ GHashTable *nm_manager_checkpoint_rollback_finish (NMManager *manager,
GAsyncResult *result,
GError **error);
G_END_DECLS
#endif /* __NM_MANAGER_H__ */
......@@ -21,6 +21,10 @@
#ifndef __NM_OBJECT_PRIVATE_H__
#define __NM_OBJECT_PRIVATE_H__
#if !((NETWORKMANAGER_COMPILATION) & NM_NETWORKMANAGER_COMPILATION_WITH_LIBNM_PRIVATE)
#error Cannot use this header.
#endif
#include "nm-object.h"
typedef gboolean (*PropertyMarshalFunc) (NMObject *, GParamSpec *, GVariant *, gpointer);
......
......@@ -21,6 +21,10 @@
#ifndef __NM_REMOTE_CONNECTION_PRIVATE_H__
#define __NM_REMOTE_CONNECTION_PRIVATE_H__
#if !((NETWORKMANAGER_COMPILATION) & NM_NETWORKMANAGER_COMPILATION_WITH_LIBNM_PRIVATE)
#error Cannot use this header.
#endif
#define NM_REMOTE_CONNECTION_INIT_RESULT "init-result"
typedef enum {
......
......@@ -22,9 +22,11 @@
#ifndef __NM_REMOTE_SETTINGS_H__
#define __NM_REMOTE_SETTINGS_H__
#include "nm-object.h"
#if !((NETWORKMANAGER_COMPILATION) & NM_NETWORKMANAGER_COMPILATION_WITH_LIBNM_PRIVATE)
#error Cannot use this header.
#endif
G_BEGIN_DECLS
#include "nm-object.h"
#define NM_TYPE_REMOTE_SETTINGS (nm_remote_settings_get_type ())
#define NM_REMOTE_SETTINGS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), NM_TYPE_REMOTE_SETTINGS, NMRemoteSettings))
......@@ -53,14 +55,10 @@ struct _NMRemoteSettings {
struct _NMRemoteSettingsClass {
NMObjectClass parent;
/* Signals */
void (*connection_added) (NMRemoteSettings *settings,
NMRemoteConnection *connection);
void (*connection_removed) (NMRemoteSettings *settings,
NMRemoteConnection *connection);
/*< private >*/
gpointer padding[8];
};
GType nm_remote_settings_get_type (void);
......@@ -125,6 +123,4 @@ gboolean nm_remote_settings_save_hostname_finish (NMRemoteSettings *settings,
GAsyncResult *result,
GError **error);
G_END_DECLS
#endif /* __NM_REMOTE_SETTINGS_H__ */
......@@ -18,7 +18,8 @@ deps = [
]
cflags = [
'-DNETWORKMANAGER_COMPILATION=NM_NETWORKMANAGER_COMPILATION_LIB',
'-DNETWORKMANAGER_COMPILATION_TEST',
'-DNETWORKMANAGER_COMPILATION=NM_NETWORKMANAGER_COMPILATION_LIBNM',
'-DTEST_NM_SERVICE="@0@"'.format(join_paths(meson.source_root(), 'tools', 'test-networkmanager-service.py'))
]
......@@ -47,5 +48,6 @@ libnm_vpn_plugin_utils_test = static_library(
'nm-vpn-plugin-utils-test',
sources: shared_vpn_plugin_utils + [libnm_enum[1]],
include_directories: incs,
dependencies: glib_dep
dependencies: glib_dep,
c_args: cflags,
)
......@@ -22,19 +22,85 @@
#ifndef __NM_DEFAULT_H__
#define __NM_DEFAULT_H__
/* makefiles define NETWORKMANAGER_COMPILATION for compiling NetworkManager.
* Depending on which parts are compiled, different values are set. */
#define NM_NETWORKMANAGER_COMPILATION_DEFAULT 0x0001
#define NM_NETWORKMANAGER_COMPILATION_INSIDE_DAEMON 0x0002
#define NM_NETWORKMANAGER_COMPILATION_LIB 0x0004
#define NM_NETWORKMANAGER_COMPILATION_SYSTEMD 0x0008
#define NM_NETWORKMANAGER_COMPILATION_LIB_LEGACY 0x0010
#define NM_NETWORKMANAGER_COMPILATION_WITH_GLIB (1 << 0)
#define NM_NETWORKMANAGER_COMPILATION_WITH_GLIB_I18N_LIB (1 << 1)
#define NM_NETWORKMANAGER_COMPILATION_WITH_GLIB_I18N_PROG (1 << 2)
#define NM_NETWORKMANAGER_COMPILATION_WITH_LIBNM (1 << 3)
#define NM_NETWORKMANAGER_COMPILATION_WITH_LIBNM_PRIVATE (1 << 4)
#define NM_NETWORKMANAGER_COMPILATION_WITH_LIBNM_CORE (1 << 5)
#define NM_NETWORKMANAGER_COMPILATION_WITH_LIBNM_CORE_INTERNAL (1 << 6)
#define NM_NETWORKMANAGER_COMPILATION_WITH_LIBNM_CORE_PRIVATE (1 << 7)
#define NM_NETWORKMANAGER_COMPILATION_WITH_LIBNM_UTIL (1 << 8)
#define NM_NETWORKMANAGER_COMPILATION_WITH_LIBNM_GLIB (1 << 9)
#define NM_NETWORKMANAGER_COMPILATION_WITH_DAEMON (1 << 10)
#define NM_NETWORKMANAGER_COMPILATION_WITH_SYSTEMD (1 << 11)
#define NM_NETWORKMANAGER_COMPILATION_LIBNM_CORE ( 0 \
| NM_NETWORKMANAGER_COMPILATION_WITH_GLIB \
| NM_NETWORKMANAGER_COMPILATION_WITH_GLIB_I18N_LIB \
| NM_NETWORKMANAGER_COMPILATION_WITH_LIBNM_CORE \
| NM_NETWORKMANAGER_COMPILATION_WITH_LIBNM_CORE_PRIVATE \
| NM_NETWORKMANAGER_COMPILATION_WITH_LIBNM_CORE_INTERNAL \
)
#define NM_NETWORKMANAGER_COMPILATION_LIBNM ( 0 \
| NM_NETWORKMANAGER_COMPILATION_WITH_GLIB \
| NM_NETWORKMANAGER_COMPILATION_WITH_GLIB_I18N_LIB \
| NM_NETWORKMANAGER_COMPILATION_WITH_LIBNM \
| NM_NETWORKMANAGER_COMPILATION_WITH_LIBNM_PRIVATE \
| NM_NETWORKMANAGER_COMPILATION_WITH_LIBNM_CORE \
| NM_NETWORKMANAGER_COMPILATION_WITH_LIBNM_CORE_INTERNAL \
)
#define NM_NETWORKMANAGER_COMPILATION_LIBNM_UTIL ( 0 \
| NM_NETWORKMANAGER_COMPILATION_WITH_GLIB \
| NM_NETWORKMANAGER_COMPILATION_WITH_GLIB_I18N_LIB \
| NM_NETWORKMANAGER_COMPILATION_WITH_LIBNM_UTIL \
)
#define NM_NETWORKMANAGER_COMPILATION_LIBNM_GLIB ( 0 \
| NM_NETWORKMANAGER_COMPILATION_LIBNM_UTIL \
| NM_NETWORKMANAGER_COMPILATION_WITH_LIBNM_GLIB \
)
#define NM_NETWORKMANAGER_COMPILATION_CLIENT ( 0 \
| NM_NETWORKMANAGER_COMPILATION_WITH_GLIB \
| NM_NETWORKMANAGER_COMPILATION_WITH_GLIB_I18N_PROG \
| NM_NETWORKMANAGER_COMPILATION_WITH_LIBNM \
| NM_NETWORKMANAGER_COMPILATION_WITH_LIBNM_CORE \
)