From 1de8383ad9fdfc8f552117e5d109bdfa7005634b Mon Sep 17 00:00:00 2001 From: Lubomir Rintel Date: Tue, 5 Mar 2019 08:44:57 +0100 Subject: all: goodbye libnm-glib This removes libnm-glib, libnm-glib-vpn, and libnm-util for good. The it has been replaced with libnm since NetworkManager 1.0, disabled by default since 1.12 and no up-to-date distributions ship it for years now. Removing the libraries allows us to: * Remove the horrible hacks that were in place to deal with accidental use of both the new and old library in a single process. * Relief the translators of maintenance burden of similar yet different strings. * Get rid of known bad code without chances of ever getting fixed (libnm-glib/nm-object.c and libnm-glib/nm-object-cache.c) * Generally lower the footprint of the releases and our workspace If there are some really really legacy users; they can just build libnm-glib and friends from the NetworkManager-1.16 distribution. The D-Bus API is stable and old libnm-glib will keep working forever. https://github.com/NetworkManager/NetworkManager/pull/308 --- libnm/fake-typelib/NMClient.gir | 9 ---- libnm/fake-typelib/NetworkManager.gir | 10 ---- libnm/fake-typelib/meson.build | 30 ----------- libnm/fake-typelib/typelibs.gresource.xml | 7 --- libnm/meson.build | 5 -- libnm/nm-libnm-utils.c | 82 ------------------------------- 6 files changed, 143 deletions(-) delete mode 100644 libnm/fake-typelib/NMClient.gir delete mode 100644 libnm/fake-typelib/NetworkManager.gir delete mode 100644 libnm/fake-typelib/meson.build delete mode 100644 libnm/fake-typelib/typelibs.gresource.xml (limited to 'libnm') diff --git a/libnm/fake-typelib/NMClient.gir b/libnm/fake-typelib/NMClient.gir deleted file mode 100644 index 3002f8d630..0000000000 --- a/libnm/fake-typelib/NMClient.gir +++ /dev/null @@ -1,9 +0,0 @@ - - - - - diff --git a/libnm/fake-typelib/NetworkManager.gir b/libnm/fake-typelib/NetworkManager.gir deleted file mode 100644 index d15d29afc7..0000000000 --- a/libnm/fake-typelib/NetworkManager.gir +++ /dev/null @@ -1,10 +0,0 @@ - - - - - - diff --git a/libnm/fake-typelib/meson.build b/libnm/fake-typelib/meson.build deleted file mode 100644 index fdbb29202e..0000000000 --- a/libnm/fake-typelib/meson.build +++ /dev/null @@ -1,30 +0,0 @@ -g_ir_compiler = find_program('g-ir-compiler') - -girs = [ - 'NetworkManager', - 'NMClient', -] - -resource_data = [] - -foreach gir: girs - gir_typelib = gir + '.typelib' - - resource_data += custom_target( - gir_typelib, - input: gir + '.gir', - output: gir_typelib, - command: [g_ir_compiler, '@INPUT@', '-o', '@OUTPUT@'], - ) -endforeach - -resource = 'typelibs' - -libnm_utils_sources += gnome.compile_resources( - resource, - resource + '.gresource.xml', - source_dir: '.', - dependencies: resource_data, - extra_args: '--manual-register', - export: true, -) diff --git a/libnm/fake-typelib/typelibs.gresource.xml b/libnm/fake-typelib/typelibs.gresource.xml deleted file mode 100644 index 9a71d97544..0000000000 --- a/libnm/fake-typelib/typelibs.gresource.xml +++ /dev/null @@ -1,7 +0,0 @@ - - - - NetworkManager.typelib - NMClient.typelib - - diff --git a/libnm/meson.build b/libnm/meson.build index 558a587b4a..86345c7a6d 100644 --- a/libnm/meson.build +++ b/libnm/meson.build @@ -13,11 +13,6 @@ deps = [ nm_core_dep, ] -if have_fake_typelibs - deps += gir_dep - subdir('fake-typelib') -endif - libnm_utils = static_library( 'nm-utils', sources: libnm_utils_sources, diff --git a/libnm/nm-libnm-utils.c b/libnm/nm-libnm-utils.c index f740c37caf..580d576be6 100644 --- a/libnm/nm-libnm-utils.c +++ b/libnm/nm-libnm-utils.c @@ -561,85 +561,3 @@ nm_utils_fixup_product_string (const char *desc) return desc_full; } - -#if WITH_FAKE_TYPELIBS - -/* - * Here we register empty "NMClient" and "NetworkManager" GIR modules as soon - * as we are loaded (if gnome-introspection is being used). This prevents the - * real modules from being loaded because they would in turn load libnm-glib - * and abort() and crash. - * - * For the high level languages that utilize GIR the crash is highly inconvenient - * while the inability to resolve any methods and attributes is potentially - * recoverable. - */ - -#include - -GResource *typelibs_get_resource (void); -void typelibs_register_resource (void); - -static void __attribute__((constructor)) -_nm_libnm_utils_init (void) -{ - GITypelib *typelib; - GBytes *data; - const char *namespace; - GModule *self; - GITypelib *(*_g_typelib_new_from_const_memory) (const guint8 *memory, - gsize len, - GError **error) = NULL; - const char *(*_g_irepository_load_typelib) (GIRepository *repository, - GITypelib *typelib, - GIRepositoryLoadFlags flags, - GError **error) = NULL; - const char *names[] = { "/org/freedesktop/libnm/fake-typelib/NetworkManager.typelib", - "/org/freedesktop/libnm/fake-typelib/NMClient.typelib" }; - int i; - - self = g_module_open (NULL, 0); - if (!self) - return; - g_module_symbol (self, "g_typelib_new_from_const_memory", - (gpointer *) &_g_typelib_new_from_const_memory); - if (_g_typelib_new_from_const_memory) { - g_module_symbol (self, "g_irepository_load_typelib", - (gpointer *) &_g_irepository_load_typelib); - } - g_module_close (self); - - if (!_g_typelib_new_from_const_memory || !_g_irepository_load_typelib) - return; - - typelibs_register_resource (); - - for (i = 0; i < 2; i++) { - gs_free_error GError *error = NULL; - - data = g_resource_lookup_data (typelibs_get_resource (), - names[i], - G_RESOURCE_LOOKUP_FLAGS_NONE, - &error); - if (!data) { - g_warning ("Fake typelib %s could not be loaded: %s", names[i], error->message); - return; - } - - typelib = _g_typelib_new_from_const_memory (g_bytes_get_data (data, NULL), - g_bytes_get_size (data), - &error); - if (!typelib) { - g_warning ("Could not create fake typelib instance %s: %s", names[i], error->message); - return; - } - - namespace = _g_irepository_load_typelib (NULL, typelib, 0, &error); - if (!namespace) { - g_warning ("Could not load fake typelib %s: %s", names[i], error->message); - return; - } - } -} - -#endif /* WITH_FAKE_TYPELIBS */ -- cgit v1.2.1