From e9bbff18e1cb7fc2ec209255c523780ad2e3dfce Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Thu, 9 May 2019 13:23:50 +0200 Subject: [PATCH 1/2] meson: add build/man/man and build/man/html to build and display pages Man page generation is generally very slow. I prefer to use -Dman=false when developing systemd, and only build specific pages when introducing changes. Those two little helper tools make it easy: $ build/man/man systemd.link $ build/man/html systemd.link will show systemd.link.8 and systemd.link.html from the build directory build/. --- man/html.in | 12 ++++++++++++ man/man.in | 15 +++++++++++++++ man/meson.build | 12 ++++++++++++ meson.build | 1 + 4 files changed, 40 insertions(+) create mode 100755 man/html.in create mode 100755 man/man.in diff --git a/man/html.in b/man/html.in new file mode 100755 index 0000000000..d4debcc340 --- /dev/null +++ b/man/html.in @@ -0,0 +1,12 @@ +#!/bin/sh +set -e + +if [ -z "$1" ]; then + echo "Use: $0 page-name (with no section suffix)" + exit 1 +fi + +target="man/$1.html" +ninja -C "@BUILD_ROOT@" "$target" +set -x +exec xdg-open build/"$target" diff --git a/man/man.in b/man/man.in new file mode 100755 index 0000000000..5700a642bd --- /dev/null +++ b/man/man.in @@ -0,0 +1,15 @@ +#!/bin/sh +set -e + +if [ -z "$1" ]; then + echo "Use: $0 page-name (with no section suffix)" + exit 1 +fi + +target=$(ninja -C "@BUILD_ROOT@" -t query man/man | grep -E -m1 "man/$1\.[0-9]$" | awk '{print $2}') +if [ -z "$target" ]; then + echo "Cannot find page $1" + exit 1 +fi +ninja -C "@BUILD_ROOT@" "$target" +exec man build/"$target" diff --git a/man/meson.build b/man/meson.build index ae9c941fcd..f3992b2834 100644 --- a/man/meson.build +++ b/man/meson.build @@ -204,3 +204,15 @@ if git.found() 'mv t @0@/rules/meson.build'.format(meson.current_source_dir())], depend_files : custom_entities_ent) endif + +############################################################ + +configure_file( + input : 'man.in', + output : 'man', + configuration : substs) + +configure_file( + input : 'html.in', + output : 'html', + configuration : substs) diff --git a/meson.build b/meson.build index eaf0eddcb1..35f8992345 100644 --- a/meson.build +++ b/meson.build @@ -283,6 +283,7 @@ substs.set('RC_LOCAL_SCRIPT_PATH_START', get_option('rc-loc substs.set('RC_LOCAL_SCRIPT_PATH_STOP', get_option('halt-local')) substs.set('MEMORY_ACCOUNTING_DEFAULT', memory_accounting_default ? 'yes' : 'no') substs.set('HIGH_RLIMIT_NOFILE', conf.get('HIGH_RLIMIT_NOFILE')) +substs.set('BUILD_ROOT', meson.current_build_dir()) ##################################################################### From 0b0673b61a777d642d5e4dfa06cca299339824b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zbigniew=20J=C4=99drzejewski-Szmek?= Date: Thu, 9 May 2019 13:26:57 +0200 Subject: [PATCH 2/2] meson: default to -Dman=false to make development quicker This makes the default build much quicker. If people are building systemd for packaging or actual installation, they probably need to set some more options anyway (-Ddns-servers=, -Dntp-servers=), so adding -Dman=true is not a big burden. For CIs configured locally, -Dman=true is added to restore status quo ante. --- meson_options.txt | 1 + semaphoreci/semaphore-runner.sh | 2 +- travis-ci/managers/debian.sh | 2 +- travis-ci/managers/fedora.sh | 2 +- travis-ci/managers/xenial.sh | 2 +- 5 files changed, 5 insertions(+), 4 deletions(-) diff --git a/meson_options.txt b/meson_options.txt index c1cb4617d0..5d68970ff6 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -126,6 +126,7 @@ option('hwdb', type : 'boolean', option('rfkill', type : 'boolean', description : 'support for the rfkill tools') option('man', type : 'combo', choices : ['auto', 'true', 'false'], + value : 'false', description : 'build and install man pages') option('html', type : 'combo', choices : ['auto', 'true', 'false'], value : 'false', diff --git a/semaphoreci/semaphore-runner.sh b/semaphoreci/semaphore-runner.sh index 5117bb4861..bc320962c1 100755 --- a/semaphoreci/semaphore-runner.sh +++ b/semaphoreci/semaphore-runner.sh @@ -87,7 +87,7 @@ EOF # disable autopkgtests which are not for upstream sed -i '/# NOUPSTREAM/ q' debian/tests/control # enable more unit tests - sed -i '/^CONFFLAGS =/ s/=/= -Dtests=unsafe -Dsplit-usr=true -Dslow-tests=true /' debian/rules + sed -i '/^CONFFLAGS =/ s/=/= -Dtests=unsafe -Dsplit-usr=true -Dslow-tests=true -Dman=true /' debian/rules # no orig tarball echo '1.0' > debian/source/format diff --git a/travis-ci/managers/debian.sh b/travis-ci/managers/debian.sh index 72ffcee439..df26b16e2c 100755 --- a/travis-ci/managers/debian.sh +++ b/travis-ci/managers/debian.sh @@ -44,7 +44,7 @@ for phase in "${PHASES[@]}"; do if [[ "$phase" = "RUN_CLANG" ]]; then ENV_VARS="-e CC=clang -e CXX=clang++" fi - docker exec $ENV_VARS -it $CONT_NAME meson --werror -Dtests=unsafe -Dslow-tests=true -Dsplit-usr=true build + docker exec $ENV_VARS -it $CONT_NAME meson --werror -Dtests=unsafe -Dslow-tests=true -Dsplit-usr=true -Dman=true build $DOCKER_EXEC ninja -v -C build docker exec -e "TRAVIS=$TRAVIS" -it $CONT_NAME ninja -C build test $DOCKER_EXEC tools/check-directives.sh diff --git a/travis-ci/managers/fedora.sh b/travis-ci/managers/fedora.sh index 760ed5b1ea..f821ee2640 100755 --- a/travis-ci/managers/fedora.sh +++ b/travis-ci/managers/fedora.sh @@ -53,7 +53,7 @@ for phase in "${PHASES[@]}"; do $DOCKER_EXEC tools/check-directives.sh ;; RUN_CLANG) - docker exec -e CC=clang -e CXX=clang++ -it $CONT_NAME meson --werror -Dtests=unsafe -Dslow-tests=true build + docker exec -e CC=clang -e CXX=clang++ -it $CONT_NAME meson --werror -Dtests=unsafe -Dslow-tests=true -Dman=true build $DOCKER_EXEC ninja -v -C build $DOCKER_EXEC ninja -C build test ;; diff --git a/travis-ci/managers/xenial.sh b/travis-ci/managers/xenial.sh index 4822bdd4b7..71a65e406d 100755 --- a/travis-ci/managers/xenial.sh +++ b/travis-ci/managers/xenial.sh @@ -12,7 +12,7 @@ cd $REPO_ROOT sed -i 's/2\.30/2.27/' meson.build -meson --werror -Db_sanitize=address,undefined -Dsplit-usr=true build +meson --werror -Db_sanitize=address,undefined -Dsplit-usr=true -Dman=true build ninja -v -C build make -C test/TEST-01-BASIC clean setup run TEST_NO_QEMU=yes NSPAWN_ARGUMENTS=--keep-unit RUN_IN_UNPRIVILEGED_CONTAINER=no