build: install pre-disted manpages if available

When building from a release tarball of NetworkManager,
`meson.add_dist_script()` has copied various prebuilt manpages into the
tarball and building them again is not really necessary. We can just
install those directly.

This means that *all* manpages could be installed even without
introspection, even though some of them can only be *built* when
introspection is enabled.

It also means that manpages can be installed even when xsltproc is not
available at build time.
This commit is contained in:
Eli Schwartz
2024-11-18 16:35:37 -05:00
committed by Íñigo Huguet
parent ee078be745
commit f656675b57
2 changed files with 49 additions and 21 deletions

View File

@@ -1,5 +1,52 @@
# SPDX-License-Identifier: LGPL-2.1-or-later
mans = [
['NetworkManager', '8'],
['NetworkManager-dispatcher', '8'],
['NetworkManager-wait-online.service', '8'],
['NetworkManager.conf', '5'],
['nm-online', '1'],
['nmcli-examples', '7'],
['nmcli', '1'],
['nmtui', '1'],
['nm-initrd-generator', '8'],
]
if enable_ovs
mans += [['nm-openvswitch', '7']]
endif
if enable_nm_cloud_setup
mans += [['nm-cloud-setup', '8']]
endif
introspection_mans = [
['nm-settings-keyfile', '5'],
['nm-settings-dbus', '5'],
['nm-settings-nmcli', '5'],
]
if enable_ifcfg_rh
introspection_mans += [['nm-settings-ifcfg-rh', '5']]
endif
built_mans = []
foreach man: mans + introspection_mans
name = man[0] + '.' + man[1]
if not fs.exists(name)
built_mans = []
break
endif
built_mans += name
endforeach
if built_mans.length() > 0
install_man(built_mans)
subdir_done()
endif
common_ent_file = configure_file(
input: 'common.ent.in',
output: '@BASENAME@',
@@ -24,26 +71,6 @@ docbook_xls = 'http://docbook.sourceforge.net/release/xsl/current/manpages/docbo
mans_xmls = []
mans = [
['NetworkManager', '8'],
['NetworkManager-dispatcher', '8'],
['NetworkManager-wait-online.service', '8'],
['NetworkManager.conf', '5'],
['nm-online', '1'],
['nmcli-examples', '7'],
['nmcli', '1'],
['nmtui', '1'],
['nm-initrd-generator', '8'],
]
if enable_ovs
mans += [['nm-openvswitch', '7']]
endif
if enable_nm_cloud_setup
mans += [['nm-cloud-setup', '8']]
endif
foreach man: mans
input = man[0] + '.xml'
content_files += join_paths(meson.current_source_dir(), input)

View File

@@ -12,7 +12,7 @@ project(
'c_std=gnu11',
'warning_level=2' # value "2" will add "-Wall" and "-Wextra" to the compiler flags
],
meson_version: '>= 0.51.0',
meson_version: '>= 0.53.0',
)
nm_name = meson.project_name()
@@ -77,6 +77,7 @@ libnm_version = '@0@.@1@.@2@'.format(current - age, age, revision)
libnm_pkgincludedir = join_paths(nm_includedir, libnm_name)
fs = import('fs')
gnome = import('gnome')
i18n = import('i18n')
pkg = import('pkgconfig')