mirror of
https://github.com/dashpay/dash.git
synced 2024-12-26 20:42:59 +01:00
1cf2fff1c4
526e28220a
contrib: Add support for out-of-tree builds in gen-manpages.sh (Wladimir J. van der Laan)
Pull request description:
This adds support for setting the environment variable `BUILDDIR` to point to executables that are outside the source directory.
E.g. to invoke the tool when the build is in $PWD/build:
```bash
BUILDDIR=$PWD/build contrib/devtools/gen-manpages.sh
```
This avoids having to manually copy the generated manpages after they end up in the build instead of source path, when setting TOPDIR instead.
Tree-SHA512: 8dc6dd7a47a0c014ae7d27f0ac9d86f69238ec6bac8a3007b975bb88c9f37014755c716c5e62604dd91baad2f8a41fd1544cdca3ba4b59bc76602e6593f4a4a7
32 lines
1.0 KiB
Bash
Executable File
32 lines
1.0 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
TOPDIR=${TOPDIR:-$(git rev-parse --show-toplevel)}
|
|
BUILDDIR=${BUILDDIR:-$TOPDIR}
|
|
|
|
BINDIR=${BINDIR:-$BUILDDIR/src}
|
|
MANDIR=${MANDIR:-$TOPDIR/doc/man}
|
|
|
|
BITCOIND=${BITCOIND:-$BINDIR/dashd}
|
|
BITCOINCLI=${BITCOINCLI:-$BINDIR/dash-cli}
|
|
BITCOINTX=${BITCOINTX:-$BINDIR/dash-tx}
|
|
BITCOINQT=${BITCOINQT:-$BINDIR/qt/dash-qt}
|
|
|
|
[ ! -x $BITCOIND ] && echo "$BITCOIND not found or not executable." && exit 1
|
|
|
|
# The autodetected version git tag can screw up manpage output a little bit
|
|
BTCVER=($($BITCOINCLI --version | head -n1 | awk -F'[ -]' '{ print $6, $7 }'))
|
|
|
|
# Create a footer file with copyright content.
|
|
# This gets autodetected fine for dashd if --version-string is not set,
|
|
# but has different outcomes for dash-qt and dash-cli.
|
|
echo "[COPYRIGHT]" > footer.h2m
|
|
$BITCOIND --version | sed -n '1!p' >> footer.h2m
|
|
|
|
for cmd in $BITCOIND $BITCOINCLI $BITCOINTX $BITCOINQT; do
|
|
cmdname="${cmd##*/}"
|
|
help2man -N --version-string=${BTCVER[0]} --include=footer.h2m -o ${MANDIR}/${cmdname}.1 ${cmd}
|
|
sed -i "s/\\\-${BTCVER[1]}//g" ${MANDIR}/${cmdname}.1
|
|
done
|
|
|
|
rm -f footer.h2m
|