33309ad8b1
of TESTSBASE and/or TESTSDIR in base/head/. My observations suggest when TESTSBASE is specified as a make(1) variable, DESTDIR seems to get lost if NO_ROOT is also specified. To work around this, export DESTDIR earlier, and explicitly prefix TESTSBASE and TESTSDIR with its value. This fixed refreshing the man-refs.ent file from a recent checkout of base/head/. While here, bump the Copyright year. Sponsored by: The FreeBSD Foundation
110 lines
3.4 KiB
Bash
Executable file
110 lines
3.4 KiB
Bash
Executable file
#!/bin/sh
|
|
#-
|
|
# Copyright (c) 2014, 2015 The FreeBSD Foundation
|
|
# All rights reserved.
|
|
#
|
|
# This software was developed by Glen Barber under sponsorship
|
|
# from the FreeBSD Foundation.
|
|
#
|
|
# Redistribution and use in source and binary forms, with or without
|
|
# modification, are permitted provided that the following conditions
|
|
# are met:
|
|
# 1. Redistributions of source code must retain the above copyright
|
|
# notice, this list of conditions and the following disclaimer.
|
|
# 2. Redistributions in binary form must reproduce the above copyright
|
|
# notice, this list of conditions and the following disclaimer in the
|
|
# documentation and/or other materials provided with the distribution.
|
|
#
|
|
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
|
|
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
|
|
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
|
|
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
|
|
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
|
|
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
|
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
|
|
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
|
# SUCH DAMAGE.
|
|
#
|
|
# $FreeBSD$
|
|
#
|
|
|
|
# Creates an output directory and an obj/ directory,
|
|
# builds the manual pages from the specified src/ tree,
|
|
# installs to the output directory, and checks the results
|
|
# against man-refs.ent.
|
|
#
|
|
|
|
PATH="/usr/bin:/bin:/usr/local/bin:/usr/sbin:/sbin"
|
|
export PATH
|
|
|
|
docs=${1}
|
|
srcs=${2}
|
|
sects=$(seq 1 9)
|
|
|
|
usage() {
|
|
echo "Usage:"
|
|
echo "${0} <docs_tree> <src_tree>"
|
|
exit 1
|
|
}
|
|
|
|
if [ -z "${docs}" -o -z "${srcs}" ]; then
|
|
usage
|
|
fi
|
|
|
|
outdir=$(mktemp -d /tmp/manrefresh.outdir.XXXXXX)
|
|
objdir=$(mktemp -d /tmp/manrefresh.objdir.XXXXXX)
|
|
|
|
build_manpages() {
|
|
export MAKEOBJDIRPREFIX=${objdir}
|
|
export DESTDIR=${outdir}
|
|
export TESTSBASE=${DESTDIR}/usr/tests
|
|
export TESTSDIR=${DESTDIR}/usr/tests
|
|
make -s -C ${srcs} DESTDIR=${DESTDIR} \
|
|
SRCCONF=/dev/null __MAKE_CONF=/dev/null \
|
|
MANOWN=$USER MANGRP=$USER MANMODE=0666 \
|
|
NO_MLINKS=1 -DNO_ROOT obj hier all-man maninstall
|
|
echo "Packaging manual pages..."
|
|
tar -zcvf ${outdir}.tgz -C ${outdir} \
|
|
usr/share/man usr/share/openssl
|
|
}
|
|
|
|
build_cleanup() {
|
|
make -s -C ${srcs} DESTDIR=${outdir} \
|
|
SRCCONF=/dev/null __MAKE_CONF=/dev/null \
|
|
NO_MLINKS=1 -DNO_ROOT cleandir
|
|
}
|
|
|
|
add_manref() {
|
|
_man=${_m}
|
|
_man=$(echo ${_man} | sed -e 's/\./_/g')
|
|
# Ugly fix to the atf-c++-api manual; I'm still not sure
|
|
# why add-manref.sh insists the entity should contain the '+'
|
|
# characters.
|
|
_man=$(echo ${_man} | sed -e 's/\+\+/../g')
|
|
_man=${_man%%_[0-9]}
|
|
_sec=${_m##*.}
|
|
yes | sh $(realpath ${docs})/share/examples/add-manref.sh \
|
|
$(realpath ${docs})/share/xml/man-refs.ent ${_man} ${_sec}
|
|
}
|
|
|
|
main() {
|
|
build_manpages
|
|
for sect in ${sects}; do
|
|
cd ${outdir}/usr/share/man/man${sect}
|
|
for _m in $(find . -mindepth 1 -maxdepth 1 -type f | sort); do
|
|
_m=${_m%%\.gz}
|
|
_m=$(echo ${_m} | sed -e 's,\./,,')
|
|
_m=$(echo ${_m} | sed -e 's/_/./g')
|
|
grep -q "man.${_m}" \
|
|
${docs}/share/xml/man-refs.ent \
|
|
|| add_manref ${_m}
|
|
done
|
|
done
|
|
build_cleanup
|
|
rm -vr ${outdir} ${objdir}
|
|
echo "Packaged manual pages are in: ${outdir}.tgz"
|
|
}
|
|
|
|
main "$@"
|