diff --git a/Makefile.am b/Makefile.am index 6e5b9446af..473a763d74 100644 --- a/Makefile.am +++ b/Makefile.am @@ -1602,8 +1602,20 @@ libnm_noinst_data = \ noinst_DATA += $(libnm_noinst_data) +EXTRA_DIST += clients/cli/generate-docs-nm-settings-nmcli.xml.in + +if BUILD_DOCS clients/cli/generate-docs-nm-settings-nmcli.xml: clients/cli/generate-docs-nm-settings-nmcli - $(AM_V_GEN) clients/cli/generate-docs-nm-settings-nmcli > $@ + $(AM_V_GEN) clients/cli/generate-docs-nm-settings-nmcli > "$@" +check-local-generate-docs-nm-settings-nmcli: clients/cli/generate-docs-nm-settings-nmcli.xml + $(srcdir)/tools/check-compare-generated.sh "$(srcdir)" "$(builddir)" "$<" +check_local += check-local-generate-docs-nm-settings-nmcli +DISTCLEANFILES += clients/cli/generate-docs-nm-settings-nmcli.xml +else +clients/cli/generate-docs-nm-settings-nmcli.xml: clients/cli/generate-docs-nm-settings-nmcli.xml.in + $(AM_V_GEN) cp $^ $@ +check-local-generate-docs-nm-settings-nmcli: +endif libnm_docs_sources = $(libnm_core_lib_c_settings_real) @@ -4453,12 +4465,12 @@ $(clients_common_libnmc_base_la_OBJECTS): $(libnm_lib_h_pub_mkenums) $(clients_common_libnmc_base_la_OBJECTS): clients/common/.dirstamp clients_common_settings_doc_h = clients/common/settings-docs.h -if HAVE_INTROSPECTION +if BUILD_DOCS $(clients_common_settings_doc_h): clients/common/settings-docs.xsl libnm/nm-settings-docs-gir.xml clients/common/.dirstamp $(AM_V_GEN) $(XSLTPROC) --output $@ $< $(word 2,$^) DISTCLEANFILES += $(clients_common_settings_doc_h) check-local-settings-docs: $(clients_common_settings_doc_h) - $(srcdir)/tools/check-settings-docs.sh "$(srcdir)" "$(builddir)" "$(clients_common_settings_doc_h)" + $(srcdir)/tools/check-compare-generated.sh "$(srcdir)" "$(builddir)" "$(clients_common_settings_doc_h)" check_local += check-local-settings-docs else $(clients_common_settings_doc_h): $(clients_common_settings_doc_h).in clients/common/.dirstamp @@ -5285,7 +5297,7 @@ EXTRA_DIST += \ tools/check-config-options.sh \ tools/check-docs.sh \ tools/check-exports.sh \ - tools/check-settings-docs.sh \ + tools/check-compare-generated.sh \ tools/create-exports-NetworkManager.sh \ tools/debug-helper.py \ tools/meson-post-install.sh \ diff --git a/clients/cli/generate-docs-nm-settings-nmcli.xml.in b/clients/cli/generate-docs-nm-settings-nmcli.xml.in new file mode 100644 index 0000000000..25675a1ec7 --- /dev/null +++ b/clients/cli/generate-docs-nm-settings-nmcli.xml.in @@ -0,0 +1,1108 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/clients/cli/meson.build b/clients/cli/meson.build index 517deffa69..585a5a7382 100644 --- a/clients/cli/meson.build +++ b/clients/cli/meson.build @@ -50,9 +50,23 @@ generate_docs_nm_settings_nmcli = executable( link_depends: linker_script_binary, ) -generate_docs_nm_settings_nmcli_xml = custom_target( - 'generate-docs-nm-settings-nmcli.xml', - output: 'generate-docs-nm-settings-nmcli.xml', - command: [ generate_docs_nm_settings_nmcli ], - capture: true, -) +if enable_docs + generate_docs_nm_settings_nmcli_xml = custom_target( + 'generate-docs-nm-settings-nmcli.xml', + output: 'generate-docs-nm-settings-nmcli.xml', + command: [ generate_docs_nm_settings_nmcli ], + capture: true, + ) + + test( + 'check-local-generate-docs-nm-settings-nmcli', + find_program(join_paths(source_root, 'tools', 'check-compare-generated.sh')), + args: [source_root, build_root, 'clients/cli/generate-docs-nm-settings-nmcli.xml'], + ) +else + settings_docs_source = configure_file( + input: 'generate-docs-nm-settings-nmcli.xml.in', + output: '@BASENAME@', + configuration: configuration_data(), + ) +endif diff --git a/clients/common/meson.build b/clients/common/meson.build index cefcfce02d..0e3f0d4f6f 100644 --- a/clients/common/meson.build +++ b/clients/common/meson.build @@ -31,7 +31,7 @@ libnmc_base_dep = declare_dependency( settings_docs = 'settings-docs.h' -if enable_introspection +if enable_docs settings_docs_source = custom_target( settings_docs, input: nm_settings_docs_xml_gir, @@ -41,7 +41,7 @@ if enable_introspection test( 'check-settings-docs', - find_program(join_paths(source_root, 'tools', 'check-settings-docs.sh')), + find_program(join_paths(source_root, 'tools', 'check-compare-generated.sh')), args: [source_root, build_root, 'clients/common/' + settings_docs], ) else diff --git a/meson.build b/meson.build index 6ee66ab01c..bd99b79ca6 100644 --- a/meson.build +++ b/meson.build @@ -751,6 +751,8 @@ if enable_nm_cloud_setup assert(libcurl_dep.found(), 'nm-cloud-setup requires libcurl library. Use -Dnm_cloud_setup=false to disable it') endif +enable_docs = get_option('docs') + more_asserts = get_option('more_asserts') if more_asserts == 'auto' if nm_minor_version % 2 == 0 @@ -920,8 +922,6 @@ if enable_qt subdir('examples/C/qt') endif -enable_docs = get_option('docs') - if enable_docs assert(enable_introspection, '-Ddocs=true requires -Dintrospection=true') assert(meson.version().version_compare('>= 0.46.0'), '-Ddocs requires meson >= 0.46') diff --git a/tools/check-compare-generated.sh b/tools/check-compare-generated.sh new file mode 100755 index 0000000000..44b70f95c6 --- /dev/null +++ b/tools/check-compare-generated.sh @@ -0,0 +1,18 @@ +#!/bin/sh + +set -e + +srcdir="$1" +builddir="$2" +doc_h="$3" + +[ -n "$NMTST_NO_CHECK_SETTINGS_DOCS" ] && exit 0 + +cmp -s "${srcdir}/${doc_h}.in" "${builddir}/${doc_h}" && exit 0 + +if [ "$NM_TEST_REGENERATE" = 1 ] ; then + cp -f "${builddir}/${doc_h}" "${srcdir}/${doc_h}.in" +else + echo "*** Error: the generated file '${builddir}/${doc_h}' differs from the source file '${srcdir}/${doc_h}.in'. You probably should copy the generated file over to the source file. You can skip this test by setting NMTST_NO_CHECK_SETTINGS_DOCS=yes. You can also automatically copy the file by rerunning the test with NM_TEST_REGENERATE=1" + exit 1 +fi diff --git a/tools/check-settings-docs.sh b/tools/check-settings-docs.sh deleted file mode 100755 index 8695ccc030..0000000000 --- a/tools/check-settings-docs.sh +++ /dev/null @@ -1,19 +0,0 @@ -#!/bin/sh - -srcdir=$1 -builddir=$2 -doc_h=$3 - -if [ -z "$NMTST_NO_CHECK_SETTINGS_DOCS" ] ; then - if ! cmp -s "${srcdir}/${doc_h}.in" "${builddir}/${doc_h}"; then - if [ "$NM_TEST_REGENERATE" = 1 ] ; then - cp -f "${builddir}/${doc_h}" "${srcdir}/${doc_h}.in" - else - echo "*** Error: the generated file '${builddir}/${doc_h}' differs from the source file '${srcdir}/${doc_h}.in'. You probably should copy the generated file over to the source file. You can skip this test by setting NMTST_NO_CHECK_SETTINGS_DOCS=yes. You can also automatically copy the file by rerunning the test with NM_TEST_REGENERATE=1" - exit 1 - fi - fi -fi - -exit 0 -