build_lexicon_filter: pass sed binary as command line argument

Ensures toolchain is consistent throughout; fixes documentation builds
on Homebrew.
This commit is contained in:
David Adam 2017-11-28 21:17:38 +08:00
parent c8c129f7a5
commit b7fc3ee22e
2 changed files with 4 additions and 3 deletions

View file

@ -426,7 +426,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/ < lexicon_filter.in > $@
$v build_tools/build_lexicon_filter.sh share/functions/ share/completions/ $(SED) < lexicon_filter.in > $@
$v chmod a+x lexicon_filter
#

View file

@ -1,7 +1,7 @@
#!/bin/sh
# Builds the lexicon filter
# Usage: build_lexicon_filter.sh FUNCTIONS_DIR COMPLETIONS_DIR < lexicon_filter.in > lexicon_filter
# Usage: build_lexicon_filter.sh FUNCTIONS_DIR COMPLETIONS_DIR [SED_BINARY] < lexicon_filter.in > 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
SED=$(which sed)
FUNCTIONS_DIR_FILES=${1}/*.fish
COMPLETIONS_DIR_FILES=${2}/*.fish
SED=${3:-$(which 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 \
-e "s|^.*>\([a-z][a-z_]*\)</a>|'\1'|w lexicon_catalog.tmp" \