From 377f72a66f0f3794780da77aa3090fd575639b43 Mon Sep 17 00:00:00 2001 From: Dan Winship Date: Fri, 27 Jun 2014 12:25:54 -0400 Subject: [PATCH] build: fix nm-setting-docs build in various configurations Certain build configurations (like --enable-gtk-doc --disable-introspection) were broken with respect to nm-setting-docs. Fix this. Also, we don't require just gobject-introspection, we need pygobject specifically as well. --- Makefile.am | 11 +++++------ cli/src/Makefile.am | 2 +- cli/src/settings.c | 2 +- configure.ac | 24 +++++++++++++++++++++--- docs/api/Makefile.am | 20 +++++++++++++------- docs/api/network-manager-docs.xml | 12 +++++++++++- libnm-util/Makefile.am | 4 ++++ man/Makefile.am | 22 +++++++++++++--------- 8 files changed, 69 insertions(+), 28 deletions(-) diff --git a/Makefile.am b/Makefile.am index 2da8f194bd..86102abbae 100644 --- a/Makefile.am +++ b/Makefile.am @@ -44,16 +44,15 @@ DISTCHECK_CONFIGURE_FLAGS = \ --enable-ifupdown \ --enable-ifnet -if HAVE_INTROSPECTION -dist-check-introspection: +if BUILD_SETTING_DOCS +dist-check-setting-docs: else -dist-check-introspection: - @echo "*** gobject-introspection is needed to run 'make dist'. ***" - @echo "*** It was not enabled when 'configure' ran. ***" +dist-check-setting-docs: + @echo "*** gobject-introspection and pygobject are needed to run 'make dist'. ***" @false endif -dist: dist-check-introspection +dist: dist-check-setting-docs DISTCLEANFILES = intltool-extract intltool-merge intltool-update diff --git a/cli/src/Makefile.am b/cli/src/Makefile.am index d30725c5c7..2dc67b5399 100644 --- a/cli/src/Makefile.am +++ b/cli/src/Makefile.am @@ -38,7 +38,7 @@ nmcli_LDADD = \ $(top_builddir)/libnm-util/libnm-util.la \ $(top_builddir)/libnm-glib/libnm-glib.la -if HAVE_INTROSPECTION +if BUILD_SETTING_DOCS settings-docs.c: settings-docs.xsl $(top_builddir)/libnm-util/nm-setting-docs.xml $(AM_V_GEN) xsltproc --output $@ $^ diff --git a/cli/src/settings.c b/cli/src/settings.c index c0e8841f0c..ea78c74504 100644 --- a/cli/src/settings.c +++ b/cli/src/settings.c @@ -6368,7 +6368,7 @@ nmc_setting_get_property_allowed_values (NMSetting *setting, const char *prop) return NULL; } -#ifdef HAVE_INTROSPECTION +#if defined (BUILD_SETTING_DOCS) || defined (HAVE_SETTING_DOCS) #include "settings-docs.c" #else #define nmc_setting_get_property_doc(setting, prop) _("(not available)") diff --git a/configure.ac b/configure.ac index e152fa0e0d..e3102d15da 100644 --- a/configure.ac +++ b/configure.ac @@ -267,9 +267,6 @@ AC_SUBST(GUDEV_CFLAGS) AC_SUBST(GUDEV_LIBS) GOBJECT_INTROSPECTION_CHECK([0.9.6]) -if test -n "$INTROSPECTION_MAKEFILE"; then - AC_DEFINE(HAVE_INTROSPECTION, [1], [Define if you have gobject-introspection]) -fi # Qt4 PKG_CHECK_MODULES(QT, [QtCore >= 4 QtDBus QtNetwork], [have_qt=yes],[have_qt=no]) @@ -772,6 +769,27 @@ if test "$enable_gtk_doc" != "yes" \ fi AM_CONDITIONAL(INSTALL_PREGEN_MANPAGES, test "x${install_pregen_manpages}" = "xyes") +# check if we can build setting property documentation +if test -n "$INTROSPECTION_MAKEFILE" -a "$enable_gtk_doc" = "yes"; then + # If g-i is installed we know we have python, but we might not have pygobject + if python -c 'from gi.repository import GObject' >& /dev/null; then + AC_DEFINE(BUILD_SETTING_DOCS, [1], [Define if you we can build nm-setting-docs.xml]) + build_setting_docs=yes + fi +fi + +# check for pre-built setting docs +if test "$build_setting_docs" != "yes" \ + -a -f man/nm-settings.xml \ + -a -f docs/api/settings-spec.xml \ + -a -f cli/src/settings-docs.c; then + AC_DEFINE(HAVE_SETTING_DOCS, [1], [Define if you have pre-built settings docs]) + have_setting_docs=yes +fi + +AM_CONDITIONAL(BUILD_SETTING_DOCS, test "$build_setting_docs" = "yes") +AM_CONDITIONAL(SETTING_DOCS_AVAILABLE, test "$build_setting_docs" = "yes" -o "$have_setting_docs" = "yes") + AC_CONFIG_FILES([ Makefile diff --git a/docs/api/Makefile.am b/docs/api/Makefile.am index 219aff3b4a..683340e684 100644 --- a/docs/api/Makefile.am +++ b/docs/api/Makefile.am @@ -11,7 +11,19 @@ OTHER_FILES= \ $(top_srcdir)/tools/doc-generator.xsl \ $(top_srcdir)/introspection/generic-types.xml -GENERATED_FILES = spec.html settings-spec.xml +GENERATED_FILES = spec.html + +if SETTING_DOCS_AVAILABLE + +settings-spec.xml: settings-spec.xsl $(top_builddir)/libnm-util/nm-setting-docs.xml + $(AM_V_GEN) xsltproc --output $@ $^ + +# Top-level SGML file includes (depends on) settings-spec.xml +$(DOC_MAIN_SGML_FILE): settings-spec.xml + +GENERATED_FILES += settings-spec.xml + +endif if ENABLE_GTK_DOC @@ -20,16 +32,10 @@ spec.html: $(XMLS) $(OTHER_FILES) html-build.stamp mkdir -p $(builddir)/html/ cp spec.html $(builddir)/html/ -settings-spec.xml: settings-spec.xsl $(top_builddir)/libnm-util/nm-setting-docs.xml - $(AM_V_GEN) xsltproc --output $@ $^ - all: $(GENERATED_FILES) endif -# Top-level SGML file includes (depends on) settings-spec.xml -$(DOC_MAIN_SGML_FILE): settings-spec.xml - #################################### # The name of the module. diff --git a/docs/api/network-manager-docs.xml b/docs/api/network-manager-docs.xml index fadc886288..0f9c7dbb43 100644 --- a/docs/api/network-manager-docs.xml +++ b/docs/api/network-manager-docs.xml @@ -54,7 +54,17 @@ setting names (like "wimax" or "bluetooth") to a dictionary of key/value pairs that represents each itself. - + + +
+ Configuration Settings + + (NetworkManager was built without full introspection support. Setting + documentation is not available.) + +
+
+
Secret flag types diff --git a/libnm-util/Makefile.am b/libnm-util/Makefile.am index e8c7e92d77..c01dadc55d 100644 --- a/libnm-util/Makefile.am +++ b/libnm-util/Makefile.am @@ -182,6 +182,10 @@ typelib_DATA = $(INTROSPECTION_GIRS:.gir=.typelib) CLEANFILES += $(gir_DATA) $(typelib_DATA) +endif + +if BUILD_SETTING_DOCS + noinst_DATA = nm-setting-docs.xml nm-setting-docs.xml: generate-setting-docs.py NetworkManager-1.0.gir libnm-util.la diff --git a/man/Makefile.am b/man/Makefile.am index 8e34d56f77..014e737971 100644 --- a/man/Makefile.am +++ b/man/Makefile.am @@ -23,6 +23,10 @@ if ENABLE_GTK_DOC %.5: %.xml $(AM_V_GEN) xsltproc $(XSLTPROC_MAN_FLAGS) $< +endif + +if BUILD_SETTING_DOCS + nm-settings.xml: nm-settings.xsl $(top_builddir)/libnm-util/nm-setting-docs.xml $(AM_V_GEN) xsltproc \ --output $@ \ @@ -45,10 +49,6 @@ docbook_generated_man_pages = \ docbook_autogenerated_man_pages = \ nm-settings.5 -generated_man_pages = \ - $(docbook_generated_man_pages) \ - $(docbook_autogenerated_man_pages) - EXTRA_DIST += \ nm-settings.xml \ nm-settings.xsl \ @@ -61,13 +61,17 @@ DISTCLEANFILES = \ man_MANS += $(configure_generated_man_pages) if ENABLE_GTK_DOC -man_MANS += $(generated_man_pages) -CLEANFILES += \ - $(docbook_autogenerated_man_pages) \ - $(docbook_generated_man_pages) +man_MANS += $(docbook_generated_man_pages) +CLEANFILES += $(docbook_generated_man_pages) +if BUILD_SETTING_DOCS +man_MANS += $(docbook_autogenerated_man_pages) +CLEANFILES += $(docbook_autogenerated_man_pages) +endif else if INSTALL_PREGEN_MANPAGES -man_MANS += $(generated_man_pages) +man_MANS += \ + $(docbook_generated_man_pages) \ + $(docbook_autogenerated_man_pages) endif endif