2018-06-24 16:41:58 +02:00
|
|
|
#!/usr/bin/env bash
|
2020-12-31 18:50:11 +01:00
|
|
|
# Copyright (c) 2016-2020 The Bitcoin Core developers
|
2020-01-16 21:57:24 +01:00
|
|
|
# Distributed under the MIT software license, see the accompanying
|
|
|
|
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
|
2016-09-13 10:25:41 +02:00
|
|
|
|
2018-06-18 13:12:07 +02:00
|
|
|
export LC_ALL=C
|
2016-09-13 10:25:41 +02:00
|
|
|
TOPDIR=${TOPDIR:-$(git rev-parse --show-toplevel)}
|
2018-02-19 00:04:54 +01:00
|
|
|
BUILDDIR=${BUILDDIR:-$TOPDIR}
|
|
|
|
|
|
|
|
BINDIR=${BINDIR:-$BUILDDIR/src}
|
2016-09-13 10:25:41 +02:00
|
|
|
MANDIR=${MANDIR:-$TOPDIR/doc/man}
|
|
|
|
|
2018-02-19 00:04:54 +01:00
|
|
|
BITCOIND=${BITCOIND:-$BINDIR/dashd}
|
|
|
|
BITCOINCLI=${BITCOINCLI:-$BINDIR/dash-cli}
|
|
|
|
BITCOINTX=${BITCOINTX:-$BINDIR/dash-tx}
|
2019-02-06 17:18:23 +01:00
|
|
|
WALLET_TOOL=${WALLET_TOOL:-$BINDIR/dash-wallet}
|
2018-02-19 00:04:54 +01:00
|
|
|
BITCOINQT=${BITCOINQT:-$BINDIR/qt/dash-qt}
|
2016-09-13 10:25:41 +02:00
|
|
|
|
|
|
|
[ ! -x $BITCOIND ] && echo "$BITCOIND not found or not executable." && exit 1
|
|
|
|
|
2020-12-07 10:15:32 +01:00
|
|
|
# Don't allow man pages to be generated for binaries built from a dirty tree
|
|
|
|
DIRTY=""
|
|
|
|
for cmd in $BITCOIND $BITCOINCLI $BITCOINTX $WALLET_TOOL $BITCOINQT; do
|
|
|
|
VERSION_OUTPUT=$($cmd --version)
|
|
|
|
if [[ $VERSION_OUTPUT == *"dirty"* ]]; then
|
|
|
|
DIRTY="${DIRTY}${cmd}\n"
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
if [ -n "$DIRTY" ]
|
|
|
|
then
|
|
|
|
echo -e "WARNING: the following binaries were built from a dirty tree:\n"
|
|
|
|
echo -e $DIRTY
|
|
|
|
echo "man pages generated from dirty binaries should NOT be committed."
|
|
|
|
echo "To properly generate man pages, please commit your changes to the above binaries, rebuild them, then run this script again."
|
|
|
|
fi
|
|
|
|
|
2016-09-13 10:25:41 +02:00
|
|
|
# The autodetected version git tag can screw up manpage output a little bit
|
2019-07-05 03:00:44 +02:00
|
|
|
read -r -a BTCVER <<< "$($BITCOINCLI --version | head -n1 | awk -F'[ -]' '{ print $6, $7 }')"
|
2016-09-13 10:25:41 +02:00
|
|
|
|
|
|
|
# Create a footer file with copyright content.
|
2020-06-11 10:39:04 +02:00
|
|
|
# This gets autodetected fine for dashd if --version-string is not set,
|
|
|
|
# but has different outcomes for dash-qt and dash-cli.
|
2016-09-13 10:25:41 +02:00
|
|
|
echo "[COPYRIGHT]" > footer.h2m
|
|
|
|
$BITCOIND --version | sed -n '1!p' >> footer.h2m
|
|
|
|
|
2019-02-06 17:18:23 +01:00
|
|
|
for cmd in $BITCOIND $BITCOINCLI $BITCOINTX $WALLET_TOOL $BITCOINQT; do
|
2016-09-13 10:25:41 +02:00
|
|
|
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
|