Fix CMake documentation build path

This fixes a variety of issues related to building the documentation
with CMake. In particular it cleans up the dependency management and
fixes some issues where the documentation build was using generated
files from the source directory.
This commit is contained in:
ridiculousfish 2018-03-04 21:23:36 -08:00 committed by Peter Ammon
parent a85d2bf27a
commit df4b03d859
6 changed files with 22 additions and 18 deletions

View File

@ -419,7 +419,7 @@ doc_src/index.hdr: toc.txt doc_src/index.hdr.in | show-AWK
lexicon_filter: doc_src/commands.hdr $(FUNCTIONS_DIR_FILES) $(COMPLETIONS_DIR_FILES) \
lexicon_filter.in build_tools/build_lexicon_filter.sh \
share/functions/__fish_config_interactive.fish
$v build_tools/build_lexicon_filter.sh share/functions/ share/completions/ $(SED) < lexicon_filter.in > $@
$v build_tools/build_lexicon_filter.sh share/functions/ share/completions/ lexicon_filter.in $(SED) > $@
$v chmod a+x lexicon_filter
#

View File

@ -98,7 +98,7 @@ done
# Make some extra stuff to pass to doxygen
# Input is kept as . because we cd to the input directory beforehand
# This prevents doxygen from generating "documentation" for intermediate directories
PROJECT_NUMBER=$(echo "$FISH_BUILD_VERSION" | env sed "s/-.*//")
PROJECT_NUMBER=$(echo "$FISH_BUILD_VERSION" | env sed "s/-[a-z0-9-]*//")
echo "PROJECT_NUMBER: $FISH_BUILD_VERSION"
DOXYPARAMS=$(cat <<EOF
PROJECT_NUMBER=${PROJECT_NUMBER}

View File

@ -1,7 +1,7 @@
#!/bin/sh
# Builds the lexicon filter
# Usage: build_lexicon_filter.sh FUNCTIONS_DIR COMPLETIONS_DIR [SED_BINARY] < lexicon_filter.in > lexicon_filter
# Usage: build_lexicon_filter.sh FUNCTIONS_DIR COMPLETIONS_DIR lexicon_filter.in [SED_BINARY] > lexicon_filter
set -e
@ -14,11 +14,12 @@ set -e
# used in a 'cli' style context.
rm -f lexicon.tmp lexicon_catalog.tmp lexicon_catalog.txt lexicon.txt
FUNCTIONS_DIR=${1}
FUNCTIONS_DIR_FILES=${1}/*.fish
COMPLETIONS_DIR_FILES=${2}/*.fish
LEXICON_FILTER_IN=${3}
SED=${3:-$(command -v sed)}
SED=${4:-$(command -v sed)}
# Scan sources for commands/functions/binaries/colours. If GNU sed was portable, this could be much smarter.
$SED <command_list_toc.txt >>lexicon.tmp -n \
@ -32,14 +33,14 @@ printf "%s\n" ${FUNCTIONS_DIR_FILES} | $SED -n \
-e "s|[^ ]*/\([a-z][a-z_-]*\).fish|'\1'|p" | grep -F -vx -f lexicon_catalog.txt | $SED >>lexicon.tmp -n \
-e 'w lexicon_catalog.tmp' \
-e "s|'\(.*\)'|func \1|p";
$SED <share/functions/__fish_config_interactive.fish >>lexicon.tmp -n \
$SED < ${FUNCTIONS_DIR}/__fish_config_interactive.fish >>lexicon.tmp -n \
-e '/set_default/s/.*\(fish_[a-z][a-z_]*\).*$$/clrv \1/p'; \
$SED <lexicon_filter.in >>lexicon.tmp -n \
$SED < ${LEXICON_FILTER_IN} >>lexicon.tmp -n \
-e '/^#.!#/s/^#.!# \(.... [a-z][a-z_]*\)/\1/p';
mv lexicon.tmp lexicon.txt; rm -f lexicon_catalog.tmp lexicon_catalog.txt;
# Copy the filter to stdout. We're going to append sed commands to it after.
$SED -e 's|@sed@|'$SED'|'
$SED -e 's|@sed@|'$SED'|' < ${LEXICON_FILTER_IN}
# Scan through the lexicon, transforming each line to something useful to Doxygen.
if echo x | $SED "/[[:<:]]x/d" 2>/dev/null; then

View File

@ -7,7 +7,7 @@ LEXICON_FILTER=$2
(cat "${DOXYFILE}" ;\
echo INPUT_FILTER="${LEXICON_FILTER}"; \
echo PROJECT_NUMBER=${FISH_BUILD_VERSION} \
| /usr/bin/env sed "s/-.*//") \
| /usr/bin/env sed "s/-[a-z0-9-]*//") \
| doxygen - && touch user_doc
(cd ./user_doc/html/ && \

View File

@ -57,14 +57,14 @@ IF(BUILD_DOCS)
# Build lexicon_filter.
ADD_CUSTOM_COMMAND(OUTPUT lexicon_filter
COMMAND build_tools/build_lexicon_filter.sh
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/build_tools/build_lexicon_filter.sh
${CMAKE_CURRENT_SOURCE_DIR}/share/functions/
${CMAKE_CURRENT_SOURCE_DIR}/share/completions/
${CMAKE_CURRENT_SOURCE_DIR}/lexicon_filter.in
${SED}
< ${CMAKE_CURRENT_SOURCE_DIR}/lexicon_filter.in
> ${CMAKE_CURRENT_BINARY_DIR}/lexicon_filter
&& chmod a+x ${CMAKE_CURRENT_BINARY_DIR}/lexicon_filter
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
DEPENDS ${FUNCTIONS_DIR_FILES} ${COMPLETIONS_DIR_FILES}
doc_src/commands.hdr ${CMAKE_CURRENT_SOURCE_DIR}/lexicon_filter.in
share/functions/__fish_config_interactive.fish
@ -77,9 +77,9 @@ IF(BUILD_DOCS)
# builtins
#
FILE(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/doc_src)
ADD_CUSTOM_COMMAND(OUTPUT doc_src/commands.hdr
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
COMMAND build_tools/build_commands_hdr.sh ${HELP_SRC}
ADD_CUSTOM_COMMAND(OUTPUT doc_src/commands.hdr command_list_toc.txt
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/build_tools/build_commands_hdr.sh ${HELP_SRC}
< doc_src/commands.hdr.in
> ${CMAKE_CURRENT_BINARY_DIR}/doc_src/commands.hdr
DEPENDS ${HELP_SRC}
@ -103,7 +103,7 @@ IF(BUILD_DOCS)
COMMAND env `cat ${FBVF} | tr -d '\"'` ${CMAKE_CURRENT_SOURCE_DIR}/build_tools/build_toc_txt.sh
doc_src/index.hdr.in ${HDR_FILES_NO_INDEX}
> ${CMAKE_CURRENT_BINARY_DIR}/toc.txt
DEPENDS ${FBVF} ${HDR_FILES_NO_INDEX})
DEPENDS ${CFBVF} ${HDR_FILES_NO_INDEX})
# doc_src/index.hdr: toc.txt doc_src/index.hdr.in | show-AWK
# @echo " AWK CAT $(em)$@$(sgr0)"
@ -122,12 +122,12 @@ IF(BUILD_DOCS)
COMMAND env `cat ${FBVF}`
${CMAKE_CURRENT_SOURCE_DIR}/build_tools/build_user_doc.sh
${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.user ./lexicon_filter
DEPENDS ${FBVF} Doxyfile.user ${DOC_SRC_FILES} doc.h ${HDR_FILES} lexicon_filter)
DEPENDS ${CFBVF} Doxyfile.user ${DOC_SRC_FILES} doc.h ${HDR_FILES} build_lexicon_filter command_list_toc.txt)
ADD_CUSTOM_COMMAND(OUTPUT share/man/
COMMAND env `cat ${FBVF} | tr -d '\"' `
INPUT_FILTER=lexicon_filter ${CMAKE_CURRENT_SOURCE_DIR}/build_tools/build_documentation.sh ${CMAKE_CURRENT_SOURCE_DIR}/Doxyfile.help doc_src ./share
DEPENDS ${FBVF} ${HELP_SRC} ${CMAKE_CURRENT_BINARY_DIR}/lexicon_filter)
DEPENDS ${CFBVF} ${HELP_SRC} ${CMAKE_CURRENT_BINARY_DIR}/lexicon_filter)
ADD_CUSTOM_TARGET(BUILD_MANUALS ALL DEPENDS share/man/)

View File

@ -49,3 +49,6 @@ ADD_CUSTOM_TARGET(CHECK-FISH-BUILD-VERSION-FILE
ADD_CUSTOM_COMMAND(OUTPUT ${FBVF-OUTPUT}
DEPENDS CHECK-FISH-BUILD-VERSION-FILE)
# Abbreviation for the target.
SET(CFBVF CHECK-FISH-BUILD-VERSION-FILE)