[NetworkManager-openvpn] build: fix build after re-importing shared files



commit 1d39a14fe1efa557b9a1b359451832e68014f493
Author: Thomas Haller <thaller redhat com>
Date:   Mon Jul 9 18:52:57 2018 +0200

    build: fix build after re-importing shared files
    
    "shared/nm-utils" changed how to detect different compilation types [1].
    After re-import, we must adjust the code for the new scheme.
    
    Also, drop NM_VPN_OLD, which is redundant to NM_NETWORKMANAGER_COMPILATION_WITH_LIBNM_UTIL
    flag in NETWORKMANAGER_COMPILATION define.
    
    [1] 
https://cgit.freedesktop.org/NetworkManager/NetworkManager/commit/?id=22ef6a507a308f2fe495b60bef78ac2ca00fb6d2
    
    Fixes: 992b01312bbd101a8b09a45c2f8c7aa6d9c097c0

 Makefile.am                           |  9 ++++++---
 properties/import-export.c            |  6 +++---
 properties/nm-openvpn-editor-plugin.c |  6 +++---
 properties/nm-openvpn-editor.c        |  2 +-
 properties/tests/test-import-export.c |  4 ++--
 shared/nm-default.h                   | 21 +++++++++------------
 6 files changed, 24 insertions(+), 24 deletions(-)
---
diff --git a/Makefile.am b/Makefile.am
index 0e044aa..27bbec9 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -49,6 +49,7 @@ src_cppflags = \
        -DDATADIR=\"$(datadir)\" \
        -DNM_OPENVPN_LOCALEDIR=\"$(datadir)/locale\" \
        -DG_LOG_DOMAIN=\"nm-openvpn\" \
+       -DNETWORKMANAGER_COMPILATION=NM_NETWORKMANAGER_COMPILATION_DEFAULT \
        -I$(srcdir)/shared \
        $(GLIB_CFLAGS) \
        $(LIBNM_CFLAGS)
@@ -202,8 +203,7 @@ properties_libnm_openvpn_properties_core_la_SOURCES = \
        $(editor_sources)
 
 properties_libnm_openvpn_properties_core_la_CPPFLAGS = \
-       -DNM_VPN_OLD \
-       -DNETWORKMANAGER_COMPILATION=NM_NETWORKMANAGER_COMPILATION_LIB \
+       
-DNETWORKMANAGER_COMPILATION='NM_NETWORKMANAGER_COMPILATION_LIB|NM_NETWORKMANAGER_COMPILATION_WITH_LIBNM_UTIL'
 \
        $(properties_cppflags) \
        $(GTK_CFLAGS) \
        $(LIBNM_GLIB_CFLAGS) \
@@ -236,6 +236,7 @@ EXTRA_DIST += \
 ###############################################################################
 
 properties_tests_cppflags = \
+       -DNETWORKMANAGER_COMPILATION_TEST \
        -DTEST_SRCDIR="\"$(abs_srcdir)/properties/tests\"" \
        -DTEST_BUILDDIR="\"$(abs_builddir)/properties/tests\"" \
        -I$(srcdir)/shared \
@@ -249,6 +250,7 @@ properties_tests_test_import_export_SOURCES = \
        properties/tests/test-import-export.c
 
 properties_tests_test_import_export_CPPFLAGS = \
+       -DNETWORKMANAGER_COMPILATION=NM_NETWORKMANAGER_COMPILATION_DEFAULT \
        $(properties_tests_cppflags) \
        $(LIBNM_CFLAGS) \
        $(LIBNMA_CFLAGS)
@@ -268,7 +270,7 @@ properties_tests_test_import_export_glib_SOURCES = \
        properties/tests/test-import-export.c
 
 properties_tests_test_import_export_glib_CPPFLAGS = \
-       -DNM_VPN_OLD \
+       
-DNETWORKMANAGER_COMPILATION='NM_NETWORKMANAGER_COMPILATION_DEFAULT|NM_NETWORKMANAGER_COMPILATION_WITH_LIBNM_UTIL'
 \
        $(properties_tests_cppflags) \
        $(GTK_CFLAGS) \
        $(LIBNM_GLIB_CFLAGS) \
@@ -329,6 +331,7 @@ auth_dialog_nm_openvpn_auth_dialog_CPPFLAGS = \
        -DICONDIR=\""$(datadir)/pixmaps"\" \
        -DBINDIR=\""$(bindir)"\" \
        -DGNOMELOCALEDIR=\"$(datadir)/locale\" \
+       -DNETWORKMANAGER_COMPILATION=NM_NETWORKMANAGER_COMPILATION_DEFAULT \
        -I$(srcdir)/shared \
        $(GLIB_CFLAGS) \
        $(GTK_CFLAGS) \
diff --git a/properties/import-export.c b/properties/import-export.c
index e70433c..b956fb7 100644
--- a/properties/import-export.c
+++ b/properties/import-export.c
@@ -1424,7 +1424,7 @@ do_import (const char *path, const char *contents, gsize contents_len, GError **
                        }
 
                        {
-#ifdef NM_VPN_OLD
+#if ((NETWORKMANAGER_COMPILATION) & NM_NETWORKMANAGER_COMPILATION_WITH_LIBNM_UTIL)
                                NMIP4Route *route;
 
                                route = nm_ip4_route_new ();
@@ -2111,7 +2111,7 @@ do_export_create (NMConnection *connection, const char *path, GError **error)
 
        s_ip4 = nm_connection_get_setting_ip4_config (connection);
        if (s_ip4) {
-#ifdef NM_VPN_OLD
+#if ((NETWORKMANAGER_COMPILATION) & NM_NETWORKMANAGER_COMPILATION_WITH_LIBNM_UTIL)
                num = nm_setting_ip4_config_get_num_routes (s_ip4);
 #else
                num = nm_setting_ip_config_get_num_routes (s_ip4);
@@ -2124,7 +2124,7 @@ do_export_create (NMConnection *connection, const char *path, GError **error)
                        guint64 metric;
                        char metric_buf[50];
 
-#ifdef NM_VPN_OLD
+#if ((NETWORKMANAGER_COMPILATION) & NM_NETWORKMANAGER_COMPILATION_WITH_LIBNM_UTIL)
                        char next_hop_str_buf[INET_ADDRSTRLEN] = { 0 };
                        char dest_str_buf[INET_ADDRSTRLEN] = { 0 };
                        in_addr_t dest, next_hop;
diff --git a/properties/nm-openvpn-editor-plugin.c b/properties/nm-openvpn-editor-plugin.c
index 3fcf898..223c602 100644
--- a/properties/nm-openvpn-editor-plugin.c
+++ b/properties/nm-openvpn-editor-plugin.c
@@ -33,7 +33,7 @@
 #include <stdlib.h>
 #include <string.h>
 
-#ifdef NM_VPN_OLD
+#if ((NETWORKMANAGER_COMPILATION) & NM_NETWORKMANAGER_COMPILATION_WITH_LIBNM_UTIL)
 #include "nm-openvpn-editor.h"
 #else
 #include "nm-utils/nm-vpn-plugin-utils.h"
@@ -126,7 +126,7 @@ get_capabilities (NMVpnEditorPlugin *iface)
                NM_VPN_EDITOR_PLUGIN_CAPABILITY_IPV6);
 }
 
-#ifndef NM_VPN_OLD
+#if !((NETWORKMANAGER_COMPILATION) & NM_NETWORKMANAGER_COMPILATION_WITH_LIBNM_UTIL)
 static NMVpnEditor *
 _call_editor_factory (gpointer factory,
                       NMVpnEditorPlugin *editor_plugin,
@@ -148,7 +148,7 @@ get_editor (NMVpnEditorPlugin *iface, NMConnection *connection, GError **error)
        g_return_val_if_fail (!error || !*error, NULL);
 
        {
-#ifdef NM_VPN_OLD
+#if ((NETWORKMANAGER_COMPILATION) & NM_NETWORKMANAGER_COMPILATION_WITH_LIBNM_UTIL)
                return openvpn_editor_new (connection, error);
 #else
                return nm_vpn_plugin_utils_load_editor (NM_PLUGIN_DIR"/libnm-vpn-plugin-openvpn-editor.so",
diff --git a/properties/nm-openvpn-editor.c b/properties/nm-openvpn-editor.c
index c548c1c..1207ef7 100644
--- a/properties/nm-openvpn-editor.c
+++ b/properties/nm-openvpn-editor.c
@@ -2711,7 +2711,7 @@ openvpn_editor_plugin_widget_class_init (OpenvpnEditorClass *req_class)
 
 /*****************************************************************************/
 
-#ifndef NM_VPN_OLD
+#if !((NETWORKMANAGER_COMPILATION) & NM_NETWORKMANAGER_COMPILATION_WITH_LIBNM_UTIL)
 
 #include "nm-openvpn-editor-plugin.h"
 
diff --git a/properties/tests/test-import-export.c b/properties/tests/test-import-export.c
index 8e855d3..1938fba 100644
--- a/properties/tests/test-import-export.c
+++ b/properties/tests/test-import-export.c
@@ -35,7 +35,7 @@
 
 #define SRCDIR TEST_SRCDIR"/conf"
 
-#ifdef NM_VPN_OLD
+#if ((NETWORKMANAGER_COMPILATION) & NM_NETWORKMANAGER_COMPILATION_WITH_LIBNM_UTIL)
 #define TMPDIR TEST_BUILDDIR"/conf-tmp-old"
 #else
 #define TMPDIR TEST_BUILDDIR"/conf-tmp-new"
@@ -1048,7 +1048,7 @@ test_route_import (void)
        /* IP4 setting */
        s_ip4 = nm_connection_get_setting_ip4_config (connection);
        g_assert (s_ip4);
-#ifdef NM_VPN_OLD
+#if ((NETWORKMANAGER_COMPILATION) & NM_NETWORKMANAGER_COMPILATION_WITH_LIBNM_UTIL)
        {
                NMIP4Route *route;
                const char *expected_nh2   = "0.0.0.0";
diff --git a/shared/nm-default.h b/shared/nm-default.h
index 258b56e..663b4fd 100644
--- a/shared/nm-default.h
+++ b/shared/nm-default.h
@@ -29,12 +29,9 @@
 #define NM_NETWORKMANAGER_COMPILATION_LIB_EDITOR          0x0004
 #define NM_NETWORKMANAGER_COMPILATION_LIB                 (0x0002 | 0x0004)
 
-#ifndef NETWORKMANAGER_COMPILATION
-/* For convenience, we don't require our Makefile.am to define
- * -DNETWORKMANAGER_COMPILATION. As we now include this internal header,
- *  we know we do a NETWORKMANAGER_COMPILATION. */
-#define NETWORKMANAGER_COMPILATION NM_NETWORKMANAGER_COMPILATION_DEFAULT
-#endif
+/* special flag, to indicate that we build a legacy library. That is, we link against
+ * deprecated libnm-util/libnm-glib instead against libnm. */
+#define NM_NETWORKMANAGER_COMPILATION_WITH_LIBNM_UTIL     0x0010
 
 /*****************************************************************************/
 
@@ -61,7 +58,7 @@
 
 /*****************************************************************************/
 
-#ifdef NM_VPN_OLD
+#if ((NETWORKMANAGER_COMPILATION) & NM_NETWORKMANAGER_COMPILATION_WITH_LIBNM_UTIL)
 
 #define NM_VPN_LIBNM_COMPAT
 #include <nm-connection.h>
@@ -88,7 +85,7 @@
 
 #define _nm_utils_is_valid_iface_name(n)            nm_utils_iface_valid_name(n)
 
-#else /* NM_VPN_OLD */
+#else /* NM_NETWORKMANAGER_COMPILATION_WITH_LIBNM_UTIL */
 
 #include <NetworkManager.h>
 
@@ -102,19 +99,19 @@
 
 #define _nm_utils_is_valid_iface_name(n)            nm_utils_is_valid_iface_name(n, NULL)
 
-#endif /* NM_VPN_OLD */
+#endif /* NM_NETWORKMANAGER_COMPILATION_WITH_LIBNM_UTIL */
 
 /*****************************************************************************/
 
 #if (NETWORKMANAGER_COMPILATION) & NM_NETWORKMANAGER_COMPILATION_LIB_EDITOR
 
-#ifdef NM_VPN_OLD
+#if ((NETWORKMANAGER_COMPILATION) & NM_NETWORKMANAGER_COMPILATION_WITH_LIBNM_UTIL)
 #include <nm-ui-utils.h>
 #include <nm-cert-chooser.h>
-#else /* NM_VPN_OLD */
+#else
 #include <nma-ui-utils.h>
 #include <nma-cert-chooser.h>
-#endif /* NM_VPN_OLD */
+#endif
 
 #endif /* NM_NETWORKMANAGER_COMPILATION_LIB_EDITOR */
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]