summaryrefslogtreecommitdiff
path: root/Makefile.am
diff options
context:
space:
mode:
authorLubomir Rintel <lkundrak@v3.sk>2017-11-04 20:41:45 +0100
committerLubomir Rintel <lkundrak@v3.sk>2017-11-06 11:47:05 +0100
commit4d1f090aedf05c0e2955d431638e311d1e18a52f (patch)
treea4ba2dab0c144b48407cbe125d06c007f40a6c07 /Makefile.am
parentd529641756b5443ba86141ab13ed14952b02bdbf (diff)
downloadNetworkManager-4d1f090aedf05c0e2955d431638e311d1e18a52f.tar.gz
libnm: register empty NMClient and NetworkManager when loading libnm with GIR
Register empty "NMClient" and "NetworkManager" GIR modules as soon as libnm is loaded witch gnome-introspection. This prevents the real modules from being loaded because they would in turn load libnm-glib and abort() and crash. In particular this prevents the GNOME shell from crashing with libnm-glib abort and allows gracefully disabling the extensions which use the obsolete library. Test: $ cat test.js const NM = imports.gi.NM; print (NM.SecretAgentGetSecretsFlags.ALLOW_INTERACTION); const NMClient = imports.gi.NMClient; print (NMClient.SecretAgentGetSecretsFlags.ALLOW_INTERACTION); Before: $ gjs test.js 1 (gjs:16253): libnm-util-ERROR **: libnm symbols detected; Mixing libnm with libnm-util/libnm-glib is not supported Trace/breakpoint trap (core dumped) $ After: $ gjs test.js 1 Gjs-Message: JS WARNING: [test.js 5]: reference to undefined property "SecretAgentGetSecretsFlags" (gjs:16228): Gjs-WARNING **: JS ERROR: TypeError: NMClient.SecretAgentGetSecretsFlags is undefined @test.js:5:1 JS_EvaluateScript() failed
Diffstat (limited to 'Makefile.am')
-rw-r--r--Makefile.am18
1 files changed, 18 insertions, 0 deletions
diff --git a/Makefile.am b/Makefile.am
index cda851a094..58be8ef91c 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -858,6 +858,7 @@ nodist_libnminclude_HEADERS += \
noinst_LTLIBRARIES += libnm/libnm-utils.la
libnm_libnm_utils_la_CPPFLAGS = \
+ $(INTROSPECTION_CFLAGS) \
$(libnm_lib_cppflags)
libnm_libnm_utils_la_SOURCES = \
@@ -956,6 +957,23 @@ libnm/libnm.typelib: libnm/libnm.gir
$(INTROSPECTION_COMPILER) --includedir=$(srcdir)/libnm-core --includedir=$(builddir)/libnm-core --includedir=$(srcdir)/libnm --includedir=$(builddir)/libnm $< -o $@
INTROSPECTION_GIRS += libnm/NM-1.0.gir
+
+if WITH_FAKE_TYPELIBS
+
+libnm/fake-typelib/NetworkManager.typelib: libnm/fake-typelib/NetworkManager.gir
+ $(AM_V_GEN) $(INTROSPECTION_COMPILER) $< -o $@
+
+libnm/fake-typelib/NMClient.typelib: libnm/fake-typelib/NMClient.gir
+ $(AM_V_GEN) $(INTROSPECTION_COMPILER) $< -o $@
+
+libnm/fake-typelib/typelibs.c: libnm/fake-typelib/typelibs.gresource.xml libnm/fake-typelib/NetworkManager.typelib libnm/fake-typelib/NMClient.typelib
+ $(AM_V_GEN) $(GLIB_COMPILE_RESOURCES) $< --target=$@ --sourcedir=$(srcdir)/libnm/fake-typelib --generate-source --manual-register --internal
+
+libnm_libnm_utils_la_SOURCES += \
+ libnm/fake-typelib/typelibs.c
+
+endif
+
endif
if HAVE_INTROSPECTION