From: Daniel Wagner Date: Fri, 12 Nov 2021 11:30:09 +0000 (+0100) Subject: build: Install additional files incl documentation X-Git-Tag: v2.0-rc0~47^2~5 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=629b5bc128b7e246d1fbce6188ea8aaf0eac107c;p=users%2Fsagi%2Fnvme-cli.git build: Install additional files incl documentation Install additional files such as dracut, systemd and udev scipts. Also add support for building and installing documentation. Introduce a build option '-Ddocs=[all,man,html]' which builds (if asciidoctor is availalbe) and installs the docs. meson doesn't support pre compiled sources updated in the source tree. This is a design decision. That means the man pages (Documentation/*.1) and the html pages (Documentation/*.html) can't be updated so easily as with Makefile. The workaround provide a shell script which updates the in tree pre compiled documentation Signed-off-by: Daniel Wagner --- diff --git a/Documentation/meson.build b/Documentation/meson.build new file mode 100644 index 00000000..ab5577c5 --- /dev/null +++ b/Documentation/meson.build @@ -0,0 +1,238 @@ +adoc_sources = [ + 'nvme-admin-passthru', + 'nvme-ana-log', + 'nvme-attach-ns', + 'nvme-boot-part-log', + 'nvme-capacity-mgmt', + 'nvme-changed-ns-list-log', + 'nvme-cmdset-ind-id-ns', + 'nvme-compare', + 'nvme-connect-all', + 'nvme-connect', + 'nvme-copy', + 'nvme-create-ns', + 'nvme-delete-ns', + 'nvme-dera-stat', + 'nvme-detach-ns', + 'nvme-device-self-test', + 'nvme-dir-receive', + 'nvme-dir-send', + 'nvme-disconnect-all', + 'nvme-disconnect', + 'nvme-discover', + 'nvme-dsm', + 'nvme-effects-log', + 'nvme-endurance-event-agg-log', + 'nvme-endurance-log', + 'nvme-error-log', + 'nvme-fid-support-effects-log', + 'nvme-flush', + 'nvme-format', + 'nvme-fw-commit', + 'nvme-fw-download', + 'nvme-fw-log', + 'nvme-gen-hostnqn', + 'nvme-get-feature', + 'nvme-get-lba-status', + 'nvme-get-log', + 'nvme-get-ns-id', + 'nvme-get-property', + 'nvme-help', + 'nvme-huawei-id-ctrl', + 'nvme-huawei-list', + 'nvme-id-ctrl', + 'nvme-id-domain', + 'nvme-id-iocs', + 'nvme-id-ns', + 'nvme-id-nvmset', + 'nvme-intel-id-ctrl', + 'nvme-intel-internal-log', + 'nvme-intel-lat-stats', + 'nvme-intel-market-name', + 'nvme-intel-smart-log-add', + 'nvme-intel-temp-stats', + 'nvme-io-passthru', + 'nvme-lba-status-log', + 'nvme-list-ctrl', + 'nvme-list-endgrp', + 'nvme-list-ns', + 'nvme-list-subsys', + 'nvme-list', + 'nvme-lnvm-create', + 'nvme-lnvm-diag-bbtbl', + 'nvme-lnvm-diag-set-bbtbl', + 'nvme-lnvm-factory', + 'nvme-lnvm-id-ns', + 'nvme-lnvm-info', + 'nvme-lnvm-init', + 'nvme-lnvm-list', + 'nvme-lnvm-remove', + 'nvme-lockdown', + 'nvme-micron-clear-pcie-errors', + 'nvme-micron-internal-log', + 'nvme-micron-nand-stats', + 'nvme-micron-pcie-stats', + 'nvme-micron-selective-download', + 'nvme-micron-smart-add-log', + 'nvme-micron-temperature-stats', + 'nvme-netapp-ontapdevices', + 'nvme-netapp-smdevices', + 'nvme-ns-descs', + 'nvme-ns-rescan', + 'nvme-nvm-id-ctrl', + 'nvme-persistent-event-log', + 'nvme-predictable-lat-log', + 'nvme-pred-lat-event-agg-log', + 'nvme-primary-ctrl-caps', + 'nvme-read', + 'nvme-reset', + 'nvme-resv-acquire', + 'nvme-resv-notif-log', + 'nvme-resv-register', + 'nvme-resv-release', + 'nvme-resv-report', + 'nvme-rpmb', + 'nvme-sanitize-log', + 'nvme-sanitize', + 'nvme-security-recv', + 'nvme-security-send', + 'nvme-self-test-log', + 'nvme-set-feature', + 'nvme-set-property', + 'nvme-show-hostnqn', + 'nvme-show-regs', + 'nvme-smart-log', + 'nvme-subsystem-reset', + 'nvme-supported-log-pages', + 'nvme-telemetry-log', + 'nvme-toshiba-clear-pcie-correctable-errors', + 'nvme-toshiba-vs-internal-log', + 'nvme-toshiba-vs-smart-add-log', + 'nvme-transcend-badblock', + 'nvme-transcend-healthvalue', + 'nvme', + 'nvme-verify', + 'nvme-virtium-save-smart-to-vtview-log', + 'nvme-virtium-show-identify', + 'nvme-wdc-capabilities', + 'nvme-wdc-cap-diag', + 'nvme-wdc-clear-assert-dump', + 'nvme-wdc-clear-fw-activate-history', + 'nvme-wdc-clear-pcie-correctable-errors', + 'nvme-wdc-cloud-SSD-plugin-version', + 'nvme-wdc-drive-essentials', + 'nvme-wdc-drive-log', + 'nvme-wdc-drive-resize', + 'nvme-wdc-enc-get-log', + 'nvme-wdc-get-crash-dump', + 'nvme-wdc-get-drive-status', + 'nvme-wdc-get-latency-monitor-log', + 'nvme-wdc-get-pfail-dump', + 'nvme-wdc-id-ctrl', + 'nvme-wdc-log-page-directory', + 'nvme-wdc-namespace-resize', + 'nvme-wdc-purge-monitor', + 'nvme-wdc-purge', + 'nvme-wdc-vs-drive-info', + 'nvme-wdc-vs-error-reason-identifier', + 'nvme-wdc-vs-fw-activate-history', + 'nvme-wdc-vs-internal-log', + 'nvme-wdc-vs-nand-stats', + 'nvme-wdc-vs-smart-add-log', + 'nvme-wdc-vs-telemetry-controller-option', + 'nvme-wdc-vs-temperature-stats', + 'nvme-write', + 'nvme-write-uncor', + 'nvme-write-zeroes', + 'nvme-zns-changed-zone-list', + 'nvme-zns-close-zone', + 'nvme-zns-finish-zone', + 'nvme-zns-id-ctrl', + 'nvme-zns-id-ns', + 'nvme-zns-offline-zone', + 'nvme-zns-open-zone', + 'nvme-zns-report-zones', + 'nvme-zns-reset-zone', + 'nvme-zns-set-zone-desc', + 'nvme-zns-zone-append', + 'nvme-zns-zone-mgmt-recv', + 'nvme-zns-zone-mgmt-send', +] + +want_docs = get_option('docs') +if want_docs != 'false' + mandir = join_paths(get_option('mandir'), 'man1') + htmldir = join_paths(get_option('htmldir'), 'nvme') + + asciidoctor = find_program('asciidoc', required : false) + if asciidoctor.found() + # Build documentation before installing + + # man pages + if want_docs == 'all' or want_docs == 'man' + xmlto = find_program('xmlto', required: false) + if xmlto.found() + foreach adoc : adoc_sources + input = adoc + '.txt' + xml = custom_target( + adoc.underscorify() + '_xml', + input: adoc + '.txt', + output: '@BASENAME@.xml', + command: [asciidoctor, + '-f', files('asciidoc.conf'), + '-b', 'docbook', + '-d', 'manpage', + '-o', '@OUTPUT@', + '@INPUT@'], + ) + custom_target( + adoc.underscorify() + '_man', + input: xml, + output: '@BASENAME@.1', + command: [xmlto, + '-m', files('manpage-normal.xsl'), + '-o', '@OUTDIR@', + '--skip-validation', + 'man', + '@INPUT@'], + install: true, + install_dir: mandir) + endforeach + endif + endif + + # html + if want_docs == 'all' or want_docs == 'html' + foreach adoc : adoc_sources + input = adoc + '.txt' + custom_target( + adoc.underscorify() + '_html', + input: adoc + '.txt', + output: '@BASENAME@.html', + command: [asciidoctor, + '-f', files('asciidoc.conf'), + '-b', 'xhtml11', + '-d', 'manpage', + '-o', '@OUTPUT@', + '@INPUT@'], + install: true, + install_dir: htmldir) + endforeach + endif + + else + # asciidoctor not found, install pre compiled documetationx + + foreach adoc : adoc_sources + if want_docs == 'all' or want_docs == 'man' + man = files(adoc + '.1') + install_data(man, install_dir: mandir) + endif + if want_docs == 'all' or want_docs == 'html' + html = files(adoc + '.html') + install_data(html, install_dir: htmldir) + endif + endforeach + + endif +endif diff --git a/meson.build b/meson.build index 498f7a40..7ebcc1c4 100644 --- a/meson.build +++ b/meson.build @@ -20,6 +20,11 @@ includedir = join_paths(prefixdir, get_option('includedir')) datadir = join_paths(prefixdir, get_option('datadir')) mandir = join_paths(prefixdir, get_option('mandir')) bindir = join_paths(prefixdir, get_option('bindir')) +sysconfdir = join_paths(prefixdir, get_option('sysconfdir')) + +udevrulesdir = join_paths(prefixdir, get_option('udevrulesdir')) +dracutrulesdir = join_paths(prefixdir, get_option('dracutrulesdir')) +systemddir = join_paths(prefixdir, get_option('systemddir')) ############################################################################### conf = configuration_data() @@ -119,10 +124,22 @@ substs = configuration_data() substs.set('NAME', meson.project_name()) substs.set('VERSION', meson.project_version()) substs.set('LICENSE', meson.project_license()[0]) +substs.set('UDEVRULESDIR', udevrulesdir) + configure_file( - input: 'nvme.spec.in', - output: 'nvme.spec', - configuration: substs, + input: 'nvme.spec.in', + output: 'nvme.spec', + configuration: substs, +) +configure_file( + input: 'nvmf-autoconnect/dracut-conf/70-nvmf-autoconnect.conf.in', + output: '70-nvmf-autoconnect.conf', + configuration: substs, +) +disc = configure_file( + input: 'etc/discovery.conf.in', + output: 'discovery.conf', + configuration: substs, ) ################################################################################ @@ -144,10 +161,34 @@ subdir('ccan') subdir('plugins') subdir('tests') subdir('util') +subdir('Documentation') executable( - 'nvme', - sources, - dependencies: [ libnvme_dep, libuuid, json_c ], - include_directories: incdir, + 'nvme', + sources, + dependencies: [ libnvme_dep, libuuid, json_c ], + include_directories: incdir, + install: true, + install_dir: get_option('sbindir') ) + +################################################################################ +install_data(meson.current_build_dir() + '/70-nvmf-autoconnect.conf', + install_dir: dracutrulesdir) + +install_data('completions/bash-nvme-completion.sh', + install_dir: datadir + '/bash-completion/completions/nvme') +install_data('completions/_nvme', + install_dir: datadir + '/zsh/site-functions') + +install_data(['nvmf-autoconnect/systemd/nvmefc-boot-connections.service', + 'nvmf-autoconnect/systemd/nvmf-autoconnect.service', + 'nvmf-autoconnect/systemd/nvmf-connect@.service', + 'nvmf-autoconnect/systemd/nvmf-connect.target'], + install_dir: systemddir) + +install_data(['nvmf-autoconnect/udev-rules/70-nvmf-autoconnect.rules', + 'nvmf-autoconnect/udev-rules/71-nvmf-iopolicy-netapp.rules'], + install_dir: udevrulesdir) +install_data(disc, + install_dir: join_paths(sysconfdir, 'nvme')) diff --git a/meson_options.txt b/meson_options.txt new file mode 100644 index 00000000..6fdc6817 --- /dev/null +++ b/meson_options.txt @@ -0,0 +1,6 @@ +option('udevrulesdir', type : 'string', value : 'etc/udev/rules.d', description : 'directory for udev rules files') +option('dracutrulesdir', type : 'string', value : 'lib/dracut/', description : 'directory for dracut rules files') +option('systemddir', type : 'string', value : 'lib/systemd/', description : 'directory for systemd files') +option('htmldir', type : 'string', value : '', description : 'directory for HTML documentation') + +option('docs', type : 'combo', choices : ['false', 'html', 'man', 'all'], description : 'install documentation') diff --git a/update-docs.sh b/update-docs.sh new file mode 100755 index 00000000..e2ceebc2 --- /dev/null +++ b/update-docs.sh @@ -0,0 +1,10 @@ +#!/bin/sh + +BUILDDIR="$(mktemp -d)" +trap 'rm -rf -- $BUILDDIR' EXIT + +meson $BUILDDIR -Ddocs=all +ninja -C $BUILDDIR +find $BUILDDIR/Documentation -maxdepth 1 \ + \( -name '*.1' -o -name '*.html' \) \ + -exec cp {} Documentation/ \;