File: meson_dist_convert.sh

package info (click to toggle)
cryptsetup 2%3A2.7.5-2
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 19,624 kB
  • sloc: ansic: 62,955; sh: 16,774; cpp: 994; xml: 920; makefile: 488; perl: 486
file content (27 lines) | stat: -rwxr-xr-x 678 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/bin/sh

# generates manpages from AsciiDoc files when building dist tarball
# run asciidoctor in parallel on `nproc` cores

set -e

[ -z "$MESON_DIST_ROOT" ] && echo "This script is meant to be run only from meson while generating dist tarball." && exit 1

if [ $# -lt 3 ]; then
        echo "Usage: $0 <asciidoctor path> <release version> <adocfiles>"
        exit 1
fi

ASCIIDOCTOR="$1"
RELEASE_VERSION="$2"
shift 2

cd $MESON_DIST_ROOT/man
i=1
N=$(nproc)
for adocfile in "$@"
do
    $ASCIIDOCTOR -b manpage --failure-level ERROR -a release-version=$RELEASE_VERSION --base-dir=$MESON_DIST_ROOT $adocfile &
    if [ $(( $i % $N )) -eq 0 ]; then wait; fi
    i=$((i+1))
done