This commit is contained in:
David Adam 2016-09-18 17:26:43 +08:00
commit 92e3a3c8ef
3 changed files with 324 additions and 287 deletions

View file

@ -25,29 +25,30 @@
# Verbosity # Verbosity
# make V=1 causes a noisy make, V=0 is silent/quiet. If one uses (lower case v) # make V=1 causes a noisy make, V=0 is silent/quiet. If one uses (lower case v)
# $(v) as a substitute for @, it will be replaced with an empty string for the # $v as a substitute for @, it will be replaced with an empty string for the
# default (V=1) case and replaced with @ in the V=0 case. You can use a bare @ # default (V=1) case and replaced with @ in the V=0 case. You can use a bare @
# for things that should almost never print. # for things that should almost never print.
V := 0 V := 0
#
# This is the default value for SHELL but I like to be explicit about such
# things. Especially in a project like fish where someone might otherwise
# think fish will be used to execute make recipes.
#
SHELL = /bin/sh
# #
# Used by docdir # Used by docdir
# #
PACKAGE_TARNAME = @PACKAGE_TARNAME@ PACKAGE_TARNAME := @PACKAGE_TARNAME@
# The default: /bin/sh
# Fish won't work.
SHELL := @SHELL@
#
# Programs # Programs
# #
CXX = @CXX@ CXX := @CXX@
INSTALL := @INSTALL@ INSTALL := @INSTALL@
LN_S := @LN_S@
SED := @SED@ SED := @SED@
MKDIR_P := @MKDIR_P@
AWK := @AWK@
GREP := @GREP@
FGREP := @FGREP@
# #
# Installation directories # Installation directories
@ -126,8 +127,7 @@ FISH_TESTS_OBJS := $(FISH_OBJS) obj/fish_tests.o
# All of the sources that produce object files # All of the sources that produce object files
# (that is, are not themselves #included in other source files) # (that is, are not themselves #included in other source files)
# #
FISH_ALL_OBJS := $(sort $(FISH_OBJS) $(FISH_INDENT_OBJS) $(FISH_TESTS_OBJS) $(FISH_KEYREAD_OBJS) \ FISH_ALL_OBJS := $(sort $(FISH_OBJS) $(FISH_INDENT_OBJS) $(FISH_TESTS_OBJS) $(FISH_KEYREAD_OBJS) obj/fish.o)
obj/fish.o)
# #
# Files containing user documentation # Files containing user documentation
@ -137,8 +137,7 @@ FISH_ALL_OBJS := $(sort $(FISH_OBJS) $(FISH_INDENT_OBJS) $(FISH_TESTS_OBJS) $(FI
# These files are the source files, they contain a few @FOO@-style substitutions # These files are the source files, they contain a few @FOO@-style substitutions
# Note that this order defines the order that they appear in the documentation # Note that this order defines the order that they appear in the documentation
# #
HDR_FILES_SRC := doc_src/index.hdr.in doc_src/tutorial.hdr doc_src/design.hdr \ HDR_FILES_SRC := doc_src/index.hdr.in doc_src/tutorial.hdr doc_src/design.hdr doc_src/license.hdr doc_src/commands.hdr.in doc_src/faq.hdr
doc_src/license.hdr doc_src/commands.hdr.in doc_src/faq.hdr
# #
# These are the generated result files # These are the generated result files
@ -156,8 +155,7 @@ HELP_SRC := $(wildcard doc_src/*.txt)
# #
# HTML includes needed for HTML help # HTML includes needed for HTML help
# #
HTML_SRC := doc_src/user_doc.header.html doc_src/user_doc.footer.html \ HTML_SRC := doc_src/user_doc.header.html doc_src/user_doc.footer.html doc_src/user_doc.css
doc_src/user_doc.css
# #
# Files in the test directory # Files in the test directory
@ -205,51 +203,52 @@ else
share_man= share_man=
endif endif
T_COLORS:=$(shell tput colors || echo 0 2> /dev/null)
# t_co:=$(shell tput colors || echo '') 2> /dev/null
# Functions for status output green := $(shell ( tput setaf 2 || tput AF 2 ) 2> /dev/null )
# yellow := $(shell ( tput setaf 3 || tput AF 3 ) 2> /dev/null )
T_GREEN := $(shell ( tput setaf 2 || tput AF 2 ) 2> /dev/null ) cyan := $(shell ( tput setaf 6 || tput AF 6 ) 2> /dev/null )
T_YELLOWB := $(shell ( tput setaf 3 || tput AF 3 ) 2> /dev/null ) red := $(shell ( tput setaf 1 || tput AF 1 ) 2> /dev/null )
T_CYAN := $(shell ( tput setaf 6 || tput AF 6 ) 2> /dev/null ) bo := $(shell ( tput bold || tput md ) 2> /dev/null )
T_RED := $(shell ( tput setaf 1 || tput AF 1 ) 2> /dev/null )
T_BOLD := $(shell ( tput bold || tput md ) 2> /dev/null )
# * Italic: Rarely defined - it's common for it to work despite # * Italic: Rarely defined - it's common for it to work despite
# terminfo entries and isn't known to cause any recent > 256-color terminals # terminfo entries and isn't known to cause any recent > 256-color terminals
# to explode. If terminfo says a terminal supports 256 colors - it's fancy enough # to explode. If terminfo says a terminal supports 256 colors - it's fancy enough
# and won't have trouble the escape. # and won't have trouble the escape.
ifeq ($(T_COLORS), 256) ifeq ($(t_co), 256)
T_ITALIC := $(shell ( tput sitm || tput ZH || echo "\\033[3m" ) 2> /dev/null ) em := $(shell ( tput sitm || tput ZH || echo "\\033[3m" ) 2> /dev/null )
# * Half-bright/faint 'dim' mode - rarely works - rarely in terminfo when it does - but it's cool. # * Half-bright/faint 'dim' mode - rarely works - rarely in terminfo when it does
# Use it with one of the basic colors to get a fainter version of it. # but it's cool. Use it with one of the basic colors to get a fainter version
T_DIM := $(shell ( tput dim || tput mh || [ $(TERM_PROGRAM) = Apple_Terminal ] && echo "\\033[2m") 2> /dev/null ) # of it. We use this to shade the output from any reconfigures we trigger.
dim := $(shell ( tput dim || tput mh || [ $(TERM_PROGRAM) = Apple_Terminal ] && echo "\\033[2m") 2> /dev/null )
else else
T_ITALIC := $(shell ( tput sitm || tput ZH ) 2> /dev/null ) em := $(shell ( tput sitm || tput ZH ) 2> /dev/null )
T_DIM := $(shell ( tput dim || tput mh) 2> /dev/null ) dim := $(shell ( tput dim || tput mh) 2> /dev/null )
endif endif
T_RESET := $(shell ( tput sgr0 || tput me) 2> /dev/null ) sgr0 := $(shell ( tput sgr0 || tput me) 2> /dev/null )
# #
# A target that prettily shows VAR='$(VAR)' (properly escaped) # A target that shows VAR='$(VAR)' (properly escaped)
# Cool trick: `make show-$var` (e.g. make show-HAVE_DOXYGEN) to quickly see what $var is. # Cool trick: `make show-$var` (e.g. make show-HAVE_DOXYGEN) to quickly see what $var is.
# #
show-%: show-%:
@echo " $* = $(T_ITALIC)$(T_CYAN)'$(subst ',''',$($*))'$(T_RESET)" ||: @echo " $* = $(em)$(cyan)'$(subst ',''',$($*))'$(sgr0)" ||:
# #
# Make everything needed for installing fish # Make everything needed for installing fish
# #
all: show-CXX show-CXXFLAGS $(PROGRAMS) $(user_doc) $(share_man) $(TRANSLATIONS) fish.pc share/__fish_build_paths.fish all: show-CXX show-CXXFLAGS $(PROGRAMS) $(user_doc) $(share_man) $(TRANSLATIONS) fish.pc share/__fish_build_paths.fish
@echo $(MAKECMDGOALS) | grep -vq install && echo "$(T_GREEN)fish has now been built.$(T_RESET)" ||: ifneq (,$(findstring install,$(MAKECMDGOALS)))
@echo "Run $(T_YELLOWB)$(notdir $(MAKE)) install$(T_RESET) to install fish.$(T_RESET)" ||: # Fish has been built, but if the goal was 'install', we aren't done yet and this output isnt't desirable
@echo "$(green)fish has now been built.$(sgr0)"
@echo "Run $(yellow)$(notdir $(MAKE)) install$(sgr0) to install fish.$(sgr0)"
endif
.PHONY: all .PHONY: all
# #
# Pull version information # Pull version information
# #
FISH-BUILD-VERSION-FILE: FORCE | FISH-BUILD-VERSION-FILE: FORCE | show-FISH_BUILD_VERSION
$(v)build_tools/git_version_gen.sh 2> /dev/null $v build_tools/git_version_gen.sh 2> /dev/null
-include FISH-BUILD-VERSION-FILE -include FISH-BUILD-VERSION-FILE
CPPFLAGS += -DFISH_BUILD_VERSION=\"$(FISH_BUILD_VERSION)\" CPPFLAGS += -DFISH_BUILD_VERSION=\"$(FISH_BUILD_VERSION)\"
.PHONY: FORCE .PHONY: FORCE
@ -260,14 +259,14 @@ obj/fish_version.o: FISH-BUILD-VERSION-FILE
# when the source code for the build configuration has changed. # when the source code for the build configuration has changed.
# #
configure: configure.ac configure: configure.ac
@echo "Rechecking config.status; rerunning ./configure if necessary..."$(T_DIM) @echo "Rechecking config.status; rerunning ./configure if necessary...$(dim)"
$(v) ./config.status --recheck $v ./config.status --recheck
@echo $(T_RESET) @echo "$(sgr0)"
Makefile: Makefile.in configure Makefile: Makefile.in configure
@echo "Checking config.status..."$(T_DIM) @echo "Checking config.status...$(dim)"
$(v) ./config.status $v ./config.status
@echo $(T_RESET) @echo "$(sgr0)"
# #
# Build fish with some debug flags specified. This is GCC specific, # Build fish with some debug flags specified. This is GCC specific,
@ -286,21 +285,19 @@ prof: all
# after the first -, for simpler version numbers. Cleans up the user_doc/html # after the first -, for simpler version numbers. Cleans up the user_doc/html
# directory once Doxygen is done. # directory once Doxygen is done.
# #
doc: $(HDR_FILES_SRC) Doxyfile.user $(HTML_SRC) $(HELP_SRC) doc.h $(HDR_FILES) lexicon_filter | show-SED doc: $(HDR_FILES_SRC) Doxyfile.user $(HTML_SRC) $(HELP_SRC) doc.h $(HDR_FILES) lexicon_filter | show-HDR_FILES_SRC show-HTML_SRC show-HELP_SRC show-HDR_FILES
@echo " doxygen $(T_ITALIC)user_doc$(T_RESET)" @echo " SED doxygen $(em)user_doc$(sgr0)"
$(v)(cat Doxyfile.user; echo INPUT_FILTER=./lexicon_filter; \ $v (cat Doxyfile.user; echo INPUT_FILTER=./lexicon_filter; echo PROJECT_NUMBER=$(FISH_BUILD_VERSION) | $(SED) "s/-.*//") | doxygen - && touch user_doc
echo PROJECT_NUMBER=$(FISH_BUILD_VERSION) | $(SED) "s/-.*//") | \ $v rm -f $(wildcard $(addprefix ./user_doc/html/,arrow*.png bc_s.png bdwn.png closed.png doc.png folder*.png ftv2*.png nav*.png open.png splitbar.png sync_*.png tab*.* doxygen.* dynsections.js jquery.js pages.html)
doxygen - && touch user_doc
$(v)cd user_doc/html && rm -f arrow*.png bc_s.png bdwn.png closed.png \
doc.png folder*.png ftv2*.png nav*.png open.png splitbar.png \
sync_*.png tab*.* doxygen.* dynsections.js jquery.js pages.html
# #
# PDF version of the source code documentation. # PDF version of the source code documentation.
# #
doc/refman.pdf: doc doc/refman.pdf: doc
$(v)cd doc/latex && $(MAKE) V=$(V) && mv refman.pdf .. @echo " MAKE $(em)doc/latex$(sgr0)"
$(v)rm -rf doc/latex $v cd doc/latex
$v $(MAKE) V=$(V)
$v mv refman.pdf ..
# #
# Prep the environment for running the unit tests. When specifying DESTDIR on # Prep the environment for running the unit tests. When specifying DESTDIR on
@ -308,13 +305,13 @@ doc/refman.pdf: doc
# installed fish using the same prefix; e.g., `./configure --prefix=/usr/local` # installed fish using the same prefix; e.g., `./configure --prefix=/usr/local`
# followed by `make install`. # followed by `make install`.
# #
test-prep: test-prep: show-DESTDIR show-LN_S show-FISH_VERSION
$(v)rm -rf test $v rm -rf test
$(v)mkdir test test/data test/home test/temp $v $(MKDIR_P) test/data test/home test/temp
ifdef DESTDIR ifdef DESTDIR
$(v)ln -s $(DESTDIR) test/root $v $(LN_S) $(DESTDIR) test/root
else else
$(v)mkdir test/root $v $(MKDIR_P) test/root
endif endif
.PHONY: test-prep .PHONY: test-prep
@ -327,8 +324,8 @@ endif
test: DESTDIR = $(PWD)/test/root/ test: DESTDIR = $(PWD)/test/root/
test: prefix = . test: prefix = .
test: test-prep install-force test_low_level test_high_level test: test-prep install-force test_low_level test_high_level
$(v)rm -f /tmp/file_truncation_test.txt /tmp/tee_test.txt /tmp/fish_foo.txt $v rm -f /tmp/file_truncation_test.txt /tmp/tee_test.txt /tmp/fish_foo.txt
$(v)rm -rf /tmp/is_potential_path_test $v rm -rf /tmp/is_potential_path_test
.PHONY: test .PHONY: test
# #
@ -345,12 +342,12 @@ test_test_deps = test_low_level $(test_high_level_test_deps)
test_high_level_test_deps = test_fishscript test_interactive test_high_level_test_deps = test_fishscript test_interactive
active_test_goals = $(filter $(test_goals),$(foreach a,$(or $(MAKECMDGOALS),$(.DEFAULT_GOAL)),$(a) $($(a)_test_deps))) active_test_goals = $(filter $(test_goals),$(foreach a,$(or $(MAKECMDGOALS),$(.DEFAULT_GOAL)),$(a) $($(a)_test_deps)))
filter_up_to = $(eval b:=1)$(foreach a,$(2),$(and $(b),$(if $(subst $(1),,$(a)),$(a),$(eval b:=)))) filter_up_to = $(eval b:=1)$(foreach a,$(2),$(and $(bo),$(if $(subst $(1),,$(a)),$(a),$(eval b:=))))
# The values for XDG_DATA_HOME and XDG_CONFIG_HOME mimic those from tests/test_util.fish. # The values for XDG_DATA_HOME and XDG_CONFIG_HOME mimic those from tests/test_util.fish.
test_low_level: fish_tests $(call filter_up_to,test_low_level,$(active_test_goals)) test_low_level: fish_tests $(call filter_up_to,test_low_level,$(active_test_goals))
rm -rf test/data test/home $v rm -rf test/data test/home
mkdir -p test/data test/home $(MKDIR_P) test/data test/home
env XDG_DATA_HOME=test/data XDG_CONFIG_HOME=test/home ./fish_tests env XDG_DATA_HOME=test/data XDG_CONFIG_HOME=test/home ./fish_tests
.PHONY: test_low_level .PHONY: test_low_level
@ -369,39 +366,42 @@ test_interactive: $(call filter_up_to,test_interactive,$(active_test_goals))
# commands.hdr collects documentation on all commands, functions and # commands.hdr collects documentation on all commands, functions and
# builtins # builtins
# #
doc_src/commands.hdr:$(HELP_SRC) doc_src/commands.hdr.in doc_src/commands.hdr:$(HELP_SRC) doc_src/commands.hdr.in |
$(v)rm -f command_list.tmp command_list_toc.tmp $@ @echo " CAT AWK $(em)$@$(sgr0)"
$(v)for i in `printf "%s\n" $(HELP_SRC)|sort`; do \ $v rm -f command_list.tmp command_list_toc.tmp $@
$v for i in $(sort $(HELP_SRC)); do \
echo "<hr>" >>command_list.tmp; \ echo "<hr>" >>command_list.tmp; \
cat $$i >>command_list.tmp; \ cat $$i >>command_list.tmp; \
echo >>command_list.tmp; \ echo >>command_list.tmp; \
echo >>command_list.tmp; \ echo >>command_list.tmp; \
NAME=`basename $$i .txt`; \ NAME=`basename $$i .txt`; \
echo '- <a href="#'$$NAME'">'$$NAME'</a>' >> command_list_toc.tmp; \ echo '- <a href="#'$$NAME'">'$$NAME'</a>' >> command_list_toc.tmp; \
echo "Back to <a href='index.html#toc-commands'>index</a>". >>command_list.tmp; \ echo "Back to <a href='index.html#toc-commands'>command index</a>". >>command_list.tmp; \
done done
$(v)mv command_list.tmp command_list.txt $v mv command_list.tmp command_list.txt
$(v)mv command_list_toc.tmp command_list_toc.txt $v mv command_list_toc.tmp command_list_toc.txt
$(v)cat $@.in | awk '{if ($$0 ~ /@command_list_toc@/) { system("cat command_list_toc.txt"); } else if ($$0 ~ /@command_list@/){ system("cat command_list.txt");} else{ print $$0;}}' >$@ $v cat $@.in | $(AWK) '{if ($$0 ~ /@command_list_toc@/) { system("cat command_list_toc.txt"); } else if ($$0 ~ /@command_list@/){ system("cat command_list.txt");} else{ print $$0;}}' >$@
toc.txt: $(HDR_FILES:index.hdr=index.hdr.in) toc.txt: $(HDR_FILES:index.hdr=index.hdr.in) | show-SED
$(v)rm -f toc.tmp $@ @echo " SED $(em)$@$(sgr0)"
$v rm -f toc.tmp $@
# Ugly hack to set the toc initial title for the main page # Ugly hack to set the toc initial title for the main page
$(v)echo '- <a href="index.html" id="toc-index">Documentation</a>' > toc.tmp $v echo '- <a href="index.html" id="toc-index">fish shell documentation - $FISH_BUILD_VERSION</a>' > toc.tmp
# The first sed command captures the page name, followed by the description # The first sed command captures the page name, followed by the description
# The second sed command captures the command name \1 and the description \2, but only up to a dash # The second sed command captures the command name \1 and the description \2, but only up to a dash
# This is to reduce the size of the TOC in the command listing on the main page # This is to reduce the size of the TOC in the command listing on the main page
$(v)for i in $(HDR_FILES:index.hdr=index.hdr.in); do\ $v for i in $(HDR_FILES:index.hdr=index.hdr.in); do\
NAME=`basename $$i .hdr`; \ NAME=`basename $$i .hdr`; \
NAME=`basename $$NAME .hdr.in`; \ NAME=`basename $$NAME .hdr.in`; \
$(SED) <$$i >>toc.tmp -n \ $(SED) <$$i >>toc.tmp -n \
-e 's,.*\\page *\([^ ]*\) *\(.*\)$$,- <a href="'$$NAME'.html" id="toc-'$$NAME'">\2</a>,p' \ -e 's,.*\\page *\([^ ]*\) *\(.*\)$$,- <a href="'$$NAME'.html" id="toc-'$$NAME'">\2</a>,p' \
-e 's,.*\\section *\([^ ]*\) *\([^-]*\)\(.*\)$$, - <a href="'$$NAME'.html#\1">\2</a>,p'; \ -e 's,.*\\section *\([^ ]*\) *\([^-]*\)\(.*\)$$, - <a href="'$$NAME'.html#\1">\2</a>,p'; \
done done
$(v)mv toc.tmp $@ $v mv toc.tmp $@
doc_src/index.hdr: toc.txt doc_src/index.hdr.in doc_src/index.hdr: toc.txt doc_src/index.hdr.in | show-AWK
$(v)cat $@.in | awk '{if ($$0 ~ /@toc@/){ system("cat toc.txt");} else{ print $$0;}}' >$@ @echo " AWK CAT $(em)$@$(sgr0)"
$v cat $@.in | $(AWK) '{if ($$0 ~ /@toc@/){ system("cat toc.txt");} else{ print $$0;}}' >$@
# #
# To enable the lexicon filter, we first need to be aware of what fish # To enable the lexicon filter, we first need to be aware of what fish
@ -412,26 +412,26 @@ doc_src/index.hdr: toc.txt doc_src/index.hdr.in
# colour defaults from __fish_config_interactive to set the docs colours when # colour defaults from __fish_config_interactive to set the docs colours when
# used in a 'cli' style context. # used in a 'cli' style context.
# #
lexicon.txt: doc_src/commands.hdr $(FUNCTIONS_DIR_FILES) $(COMPLETIONS_DIR_FILES) share/functions/__fish_config_interactive.fish | show-SED lexicon.txt: doc_src/commands.hdr $(FUNCTIONS_DIR_FILES) $(COMPLETIONS_DIR_FILES) share/functions/__fish_config_interactive.fish | show-SED show-FGREP
$(v)rm -f lexicon.tmp lexicon_catalog.tmp lexicon_catalog.txt $@ $v rm -f lexicon.tmp lexicon_catalog.tmp lexicon_catalog.txt $@
# Scan sources for commands/functions/binaries/colours. If GNU sed was portable, this could be much smarter. # Scan sources for commands/functions/binaries/colours. If GNU sed was portable, this could be much smarter.
@echo " SED $(T_ITALIC)$@$(T_RESET)" @echo "SEDFGREPSE $(em)$@$(sgr0)"
$(v)$(SED) <command_list_toc.txt >>lexicon.tmp -n \ $v $(SED) <command_list_toc.txt >>lexicon.tmp -n \
-e "s|^.*>\([a-z][a-z_]*\)</a>|'\1'|w lexicon_catalog.tmp" \ -e "s|^.*>\([a-z][a-z_]*\)</a>|'\1'|w lexicon_catalog.tmp" \
-e "s|'\(.*\)'|bltn \1|p"; mv lexicon_catalog.tmp lexicon_catalog.txt; \ -e "s|'\(.*\)'|bltn \1|p"; mv lexicon_catalog.tmp lexicon_catalog.txt
printf "%s\n" $(COMPLETIONS_DIR_FILES) | $(SED) -n \ $v printf "%s\n" $(COMPLETIONS_DIR_FILES) | $(SED) -n \
-e "s|[^ ]*/\([a-z][a-z_-]*\).fish|'\1'|p" | fgrep -vx -f lexicon_catalog.txt | $(SED) >>lexicon.tmp -n \ -e "s|[^ ]*/\([a-z][a-z_-]*\).fish|'\1'|p" | $(FGREP) -vx -f lexicon_catalog.txt | $(SED) >>lexicon.tmp -n \
-e 'w lexicon_catalog.tmp' \ -e 'w lexicon_catalog.tmp' \
-e "s|'\(.*\)'|cmnd \1|p"; cat lexicon_catalog.tmp >> lexicon_catalog.txt; \ -e "s|'\(.*\)'|cmnd \1|p"; cat lexicon_catalog.tmp >> lexicon_catalog.txt;
printf "%s\n" $(FUNCTIONS_DIR_FILES) | $(SED) -n \ $v printf "%s\n" $(FUNCTIONS_DIR_FILES) | $(SED) -n \
-e "s|[^ ]*/\([a-z][a-z_-]*\).fish|'\1'|p" | fgrep -vx -f lexicon_catalog.txt | $(SED) >>lexicon.tmp -n \ -e "s|[^ ]*/\([a-z][a-z_-]*\).fish|'\1'|p" | $(FGREP) -vx -f lexicon_catalog.txt | $(SED) >>lexicon.tmp -n \
-e 'w lexicon_catalog.tmp' \ -e 'w lexicon_catalog.tmp' \
-e "s|'\(.*\)'|func \1|p"; \ -e "s|'\(.*\)'|func \1|p";
$(SED) <share/functions/__fish_config_interactive.fish >>lexicon.tmp -n \ $v $(SED) <share/functions/__fish_config_interactive.fish >>lexicon.tmp -n \
-e '/set_default/s/.*\(fish_[a-z][a-z_]*\).*$$/clrv \1/p'; \ -e '/set_default/s/.*\(fish_[a-z][a-z_]*\).*$$/clrv \1/p'; \
$(SED) <lexicon_filter.in >>lexicon.tmp -n \ $v $(SED) <lexicon_filter.in >>lexicon.tmp -n \
-e '/^#.!#/s/^#.!# \(.... [a-z][a-z_]*\)/\1/p'; \ -e '/^#.!#/s/^#.!# \(.... [a-z][a-z_]*\)/\1/p';
mv lexicon.tmp lexicon.txt; rm -f lexicon_catalog.tmp lexicon_catalog.txt; $v mv lexicon.tmp lexicon.txt; rm -f lexicon_catalog.tmp lexicon_catalog.txt;
# #
# Compile Doxygen Input Filter from the lexicon. This is an executable sed # Compile Doxygen Input Filter from the lexicon. This is an executable sed
@ -444,12 +444,12 @@ lexicon.txt: doc_src/commands.hdr $(FUNCTIONS_DIR_FILES) $(COMPLETIONS_DIR_FILES
# providing suitable CSS in user_doc.css.in # providing suitable CSS in user_doc.css.in
# #
lexicon_filter: lexicon.txt lexicon_filter.in | show-SED lexicon_filter: lexicon.txt lexicon_filter.in | show-SED
$(v)rm -f $@.tmp $@ $v rm -f $@.tmp $@
@echo " SED $(T_ITALIC)$@$(T_RESET)" @echo " SED $(em)$@.tmp$(sgr0)"
# Set the shebang as sed can reside in multiple places. # Set the shebang as sed can reside in multiple places.
$(v)$(SED) <$@.in >$@.tmp -e 's|@sed@|'$(SED)'|' $v $(SED) <$@.in >$@.tmp -e 's|@sed@|'$(SED)'|'
# Scan through the lexicon, transforming each line to something useful to Doxygen. # Scan through the lexicon, transforming each line to something useful to Doxygen.
$(v)if echo x | $(SED) "/[[:<:]]x/d" 2>/dev/null; then \ $v if echo x | $(SED) "/[[:<:]]x/d" 2>/dev/null; then \
WORDBL='[[:<:]]'; WORDBR='[[:>:]]'; \ WORDBL='[[:<:]]'; WORDBR='[[:>:]]'; \
else \ else \
WORDBL='\\<'; WORDBR='\\>'; \ WORDBL='\\<'; WORDBR='\\>'; \
@ -457,7 +457,8 @@ lexicon_filter: lexicon.txt lexicon_filter.in | show-SED
$(SED) <lexicon.txt >>$@.tmp -n \ $(SED) <lexicon.txt >>$@.tmp -n \
-e "s|^\([a-z][a-z][a-z][a-z]\) \([a-z_-]*\)$$|s,$$WORDBL\2$$WORDBR,@\1{\2},g|p" \ -e "s|^\([a-z][a-z][a-z][a-z]\) \([a-z_-]*\)$$|s,$$WORDBL\2$$WORDBR,@\1{\2},g|p" \
-e '$$G;s/.*\n/b tidy/p'; \ -e '$$G;s/.*\n/b tidy/p'; \
mv $@.tmp $@; if test -x $@; then true; else chmod a+x $@; fi mv $@.tmp $@; test -x $@ || chmod a+x $@; fi
# #
# doc.h is a compilation of the various snipptes of text used both for # doc.h is a compilation of the various snipptes of text used both for
@ -466,7 +467,8 @@ lexicon_filter: lexicon.txt lexicon_filter.in | show-SED
# documentation. # documentation.
# #
doc.h: $(HDR_FILES) doc.h: $(HDR_FILES)
$(v)cat $(HDR_FILES) >$@ @echo " HDR_FILES $(em)$@$(sgr0)"
$v cat $(HDR_FILES) >$@
# #
# This rule creates complete doxygen headers from each of the various # This rule creates complete doxygen headers from each of the various
@ -475,16 +477,19 @@ doc.h: $(HDR_FILES)
# the internal help function text. # the internal help function text.
# #
%.doxygen:%.txt %.doxygen:%.txt
echo "/** \page " `basename $*` >$@; @echo " cat * $(em)$@$(sgr0)"
cat $*.txt >>$@; $v echo "/** \page " `basename $*` >$@;
echo "*/" >>$@ $v cat $*.txt >>$@;
$v echo "*/" >>$@
# #
# Depend on Makefile because I don't see a better way of rebuilding # Depend on Makefile because I don't see a better way of rebuilding
# if any of the paths change. # if any of the paths change.
# #
%: %.in Makefile FISH-BUILD-VERSION-FILE | show-prefix show-sysconfdir show-docdir show-extra_completionsdir show-extra_functionsdir show-extra_confdir show-prefix show-FISH_BUILD_VERSION %: %.in Makefile FISH-BUILD-VERSION-FILE | show-prefix show-sysconfdir show-docdir show-extra_completionsdir show-extra_functionsdir show-extra_confdir show-prefix show-FISH_BUILD_VERSION
$(v)$(SED) <$< >$@ \ @echo " SED $(em)$@$(sgr0)"
$v $(SED) <$< >$@ \
-e "s,@sysconfdir\@,$(sysconfdir),g" \ -e "s,@sysconfdir\@,$(sysconfdir),g" \
-e "s,@datadir\@,$(datadir),g" \ -e "s,@datadir\@,$(datadir),g" \
-e "s,@docdir\@,$(docdir),g" \ -e "s,@docdir\@,$(docdir),g" \
@ -500,15 +505,15 @@ doc.h: $(HDR_FILES)
# Compile translation files to binary format # Compile translation files to binary format
# #
%.gmo: %.gmo:
@echo " msgfmt $(T_ITALIC)$@$(T_RESET)" @echo " msgfmt $(em)$@$(sgr0)"
$(v)msgfmt -o $@ $*.po $v msgfmt -o $@ $*.po
# #
# Update existing po file or copy messages.pot # Update existing po file or copy messages.pot
# #
%.po:messages.pot %.po:messages.pot
@echo " msgmerge $(T_ITALIC)$@$(T_RESET)" @echo " msgmerge $(em)$@$(sgr0)"
$(v)if test -f $*.po; then \ $v if test -f $*.po; then \
msgmerge -U --backup=existing $*.po messages.pot;\ msgmerge -U --backup=existing $*.po messages.pot;\
else \ else \
cp messages.pot $*.po;\ cp messages.pot $*.po;\
@ -517,10 +522,10 @@ doc.h: $(HDR_FILES)
# #
# Create a template translation object # Create a template translation object
# #
messages.pot: src/*.cpp src/*.h share/completions/*.fish share/functions/*.fish messages.pot: $(wildcard src/*.cpp src/*.h share/completions/*.fish share/functions/*.fish)
@echo " xgettext $(T_ITALIC)$@$(T_RESET)" @echo " xgettext $(em)$@$(sgr0)"
$(v)xgettext -k_ -kN_ src/*.cpp src/*.h -o messages.pot xgettext -k_ -kN_ $(wildcard src/*.cpp src/*.h) -o messages.pot
$(v)xgettext -j -k_ -kN_ -k--description -LShell --from-code=UTF-8 share/completions/*.fish share/functions/*.fish -o messages.pot $v xgettext -j -k_ -kN_ -k--description -LShell --from-code=UTF-8 $(wildcard share/completions/*.fish share/functions/*.fish) share/fish.config -o messages.pot
ifdef EXTRA_PCRE2 ifdef EXTRA_PCRE2
src/builtin_string.cpp: $(PCRE2_H) src/builtin_string.cpp: $(PCRE2_H)
@ -553,13 +558,12 @@ endif
# There ought to be something simpler. # There ought to be something simpler.
# #
share/man: $(HELP_SRC) lexicon_filter | show-FISH_BUILD_VERSION show-SED share/man: $(HELP_SRC) lexicon_filter | show-FISH_BUILD_VERSION show-SED
-$(v)mkdir -p share/man -$v $(MKDIR_P) share/man
@echo " doxygen $(T_ITALIC)$@$(T_RESET)" @echo " doxygen $(em)$@$(sgr0)"
$(v)touch share/man $v touch share/man
-$(v)rm -Rf share/man/man1 -$v rm -Rf share/man/man1
$(v)echo "$(T_DIM)" && \ $v echo "$(dim)" && PROJECT_NUMBER=`echo $(FISH_BUILD_VERSION) \
PROJECT_NUMBER=`echo $(FISH_BUILD_VERSION)| $(SED) "s/-.*//"` INPUT_FILTER=./lexicon_filter \ | $(SED) "s/-.*//"` INPUT_FILTER=./lexicon_filter build_tools/build_documentation.sh Doxyfile.help ./doc_src ./share;
build_tools/build_documentation.sh Doxyfile.help ./doc_src ./share; echo "$(T_RESET)";
# #
# The build rules for installing/uninstalling fish # The build rules for installing/uninstalling fish
@ -567,44 +571,44 @@ share/man: $(HELP_SRC) lexicon_filter | show-FISH_BUILD_VERSION show-SED
check-legacy-binaries: check-legacy-binaries:
@echo "Checking for legacy binaries..." @echo "Checking for legacy binaries..."
$(v)KR_LOC=$(prefix)/bin/key_reader;\ $v KR_LOC=$(prefix)/bin/key_reader;\
if test -x "$$KR_LOC" && env TERM=dumb "$$KR_LOC" cr | grep -q 26; then\ if test -x "$$KR_LOC" && env TERM=dumb "$$KR_LOC" cr | grep -q 26; then\
echo "$(T_RED)A key_reader binary was found. You might want to remove this, and use 'fish_key_reader':";\ echo "$(red)A key_reader binary was found. You might want to remove this, and use 'fish_key_reader':";\
echo " '$$KR_LOC'$(T_RESET)";\ echo " '$$KR_LOC'$(sgr0)";\
fi; fi;
$(v)SEQLOC=$(prefix)/bin/seq;\ $v SEQLOC=$(prefix)/bin/seq;\
if test -f "$$SEQLOC" && grep -q '\(^#!/.*/fish\|^#!/usr/bin/env fish\)' "$$SEQLOC"; then\ if test -f "$$SEQLOC" && grep -q '\(^#!/.*/fish\|^#!/usr/bin/env fish\)' "$$SEQLOC"; then\
echo "$(T_RED)An outdated seq from a previous fish install was found. You should remove it with:";\ echo "$(red)An outdated seq from a previous fish install was found. You should remove it with:";\
echo " rm '$$SEQLOC'$(T_RESET)";\ echo " rm '$$SEQLOC'$(sgr0)";\
fi; fi;
$(v)SETCOLOR_LOC=$(prefix)/bin/set_color;\ $v SETCOLOR_LOC=$(prefix)/bin/set_color;\
if test -x "$$SETCOLOR_LOC" && $$SETCOLOR_LOC -v 2>&1 >/dev/null | grep -q "^set_color, version "; then\ if test -x "$$SETCOLOR_LOC" && $$SETCOLOR_LOC -v 2>&1 >/dev/null | grep -q "^set_color, version "; then\
echo "$(T_RED)An outdated set_color from a previous fish install was found. You should remove it with:";\ echo "$(red)An outdated set_color from a previous fish install was found. You should remove it with:";\
echo " rm '$$SETCOLOR_LOC'$(T_RESET)";\ echo " rm '$$SETCOLOR_LOC'$(sgr0)";\
fi; fi;
$(v)MIMEDB_LOC=$(prefix)/bin/mimedb;\ $v MIMEDB_LOC=$(prefix)/bin/mimedb;\
if test -x "$$MIMEDB_LOC" && $$MIMEDB_LOC --version 2>&1 | grep -q "^mimedb, version "; then\ if test -x "$$MIMEDB_LOC" && $$MIMEDB_LOC --version 2>&1 | grep -q "^mimedb, version "; then\
echo "$(T_RED)An outdated mimedb binary from a previous fish install was found. You should remove it with:";\ echo "$(red)An outdated mimedb binary from a previous fish install was found. You should remove it with:";\
echo " rm '$$MIMEDB_LOC'$(T_RESET)";\ echo " rm '$$MIMEDB_LOC'$(sgr0)";\
fi; fi;
$(v)FISHD_LOC=$(prefix)/bin/fishd;\ $v FISHD_LOC=$(prefix)/bin/fishd;\
if test -x "$$FISHD_LOC" && $$FISHD_LOC --version 2>&1 | grep -q "^fishd: fishd, version "; then\ if test -x "$$FISHD_LOC" && $$FISHD_LOC --version 2>&1 | grep -q "^fishd: fishd, version "; then\
echo "$(T_RED)An outdated fishd binary from a previous fish install was found. You should remove it with:";\ echo "$(red)An outdated fishd binary from a previous fish install was found. You should remove it with:";\
echo " rm '$$FISHD_LOC'$(T_RESET)";\ echo " rm '$$FISHD_LOC'$(sgr0)";\
fi; fi;
$(v)true; $v true;
.PHONY: check-legacy-binaries .PHONY: check-legacy-binaries
install: all install-force | check-legacy-binaries install: all install-force | check-legacy-binaries
@echo @echo
@echo "$(T_BOLD)fish is now installed on your system.$(T_RESET)" @echo "$(bo)fish is now installed on your system.$(sgr0)"
@echo "To run fish, type $(T_BOLD)$(T_GREEN)fish$(T_RESET) in your terminal." @echo "To run fish, type $(bo)$(green)fish$(sgr0) in your terminal."
@echo "$(T_YELLOW)Even if you are already in fish, you should now start a new fish session.$(T_RESET)" @echo "$(T_YELLOW)Even if you are already in fish, you should now start a new fish session.$(sgr0)"
@echo @echo
@if type chsh >/dev/null 2>&1; then \ @if type chsh >/dev/null 2>&1; then \
echo To use fish as your login shell:; \ echo To use fish as your login shell:; \
grep -q -- "$(DESTDIR)$(bindir)/fish" /etc/shells || echo \* add the line \'$(DESTDIR)$(bindir)/fish\' to the file \'/etc/shells\'; \ grep -q -- "$(DESTDIR)$(bindir)/fish" /etc/shells || echo \* add the line \'$(DESTDIR)$(bindir)/fish\' to the file \'/etc/shells\'; \
echo " * run $(T_YELLOWB)chsh -s $(DESTDIR)$(bindir)/fish$(T_RESET)"; \ echo " * run $(yellow)chsh -s $(DESTDIR)$(bindir)/fish$(sgr0)"; \
echo; \ echo; \
fi; fi;
@if type chcon >/dev/null 2>&1; then \ @if type chcon >/dev/null 2>&1; then \
@ -612,11 +616,11 @@ install: all install-force | check-legacy-binaries
echo \* use the command \'chcon -t shell_exec_t $(DESTDIR)$(bindir)/fish\'.; \ echo \* use the command \'chcon -t shell_exec_t $(DESTDIR)$(bindir)/fish\'.; \
echo; \ echo; \
fi; fi;
@echo "To set your colors, run $(T_GREEN)$(T_BOLD)fish_config$(T_RESET)" @echo "To set your colors, run $(green)$(bo)fish_config$(sgr0)"
@echo "To scan your man pages for completions, run $(T_GREEN)$(T_BOLD)fish_update_completions$(T_RESET)" @echo "To scan your man pages for completions, run $(green)$(bo)fish_update_completions$(sgr0)"
@echo "To accept autosuggestions (in $(T_DIM)grey$(T_RESET)) as you type, hit $(T_BOLD)ctrl-F$(T_RESET) or right arrow key." @echo "To accept autosuggestions (in $(dim)grey$(sgr0)) as you type, hit $(bo)ctrl-F$(sgr0) or right arrow key."
@echo @echo
@echo "$(T_BOLD)Have fun! <><$(T_RESET)" @echo "$(bo)Have fun! <><$(sgr0)"
.PHONY: install .PHONY: install
# #
@ -624,7 +628,7 @@ install: all install-force | check-legacy-binaries
# #
xcode-install: xcode-install:
rm -Rf /tmp/fish_build rm -Rf /tmp/fish_build
xcodebuild install DSTROOT=/tmp/fish_build xcrun xcodebuild install DSTROOT=/tmp/fish_build
ditto /tmp/fish_build ditto /tmp/fish_build
.PHONY: xcode-install .PHONY: xcode-install
@ -634,85 +638,81 @@ xcode-install:
# writeable prefix. # writeable prefix.
# #
install-force: all install-translations | show-datadir show-sysconfdir show-extra_completionsdir show-extra_functionsdir show-extra_confdir show-mandir install-force: all install-translations | show-datadir show-sysconfdir show-extra_completionsdir show-extra_functionsdir show-extra_confdir show-mandir
$(v)$(INSTALL) -m 755 -d $(DESTDIR)$(bindir) $v $(INSTALL) -m 755 -d $(DESTDIR)$(bindir)
$(v)for i in $(PROGRAMS); do\ $v for i in $(PROGRAMS); do\
$(INSTALL) -m 755 $$i $(DESTDIR)$(bindir);\ $(INSTALL) -m 755 $$i $(DESTDIR)$(bindir);\
echo " Installing $(T_BOLD)$$i$(T_RESET)";\ echo " Installing $(bo)$$i$(sgr0)";\
true ;\ true ;\
done; done;
@echo "Creating sysconfdir tree" @echo "Creating sysconfdir tree"
$(v)$(INSTALL) -m 755 -d $(DESTDIR)$(sysconfdir)/fish $v $(INSTALL) -m 755 -d $(DESTDIR)$(sysconfdir)/fish
$(v)$(INSTALL) -m 755 -d $(DESTDIR)$(sysconfdir)/fish/conf.d $v $(INSTALL) -m 755 -d $(DESTDIR)$(sysconfdir)/fish/conf.d
$(v)$(INSTALL) -m 644 etc/config.fish $(DESTDIR)$(sysconfdir)/fish/ $v $(INSTALL) -m 644 etc/config.fish $(DESTDIR)$(sysconfdir)/fish/
@echo "Creating datadir tree" @echo "Creating datadir tree"
$(v)$(INSTALL) -m 755 -d $(DESTDIR)$(datadir)/fish $v $(INSTALL) -m 755 -d $(DESTDIR)$(datadir)/fish
$(v)$(INSTALL) -m 755 -d $(DESTDIR)$(datadir)/fish/completions $v $(INSTALL) -m 755 -d $(DESTDIR)$(datadir)/fish/completions
$(v)$(INSTALL) -m 755 -d $(DESTDIR)$(datadir)/fish/functions $v $(INSTALL) -m 755 -d $(DESTDIR)$(datadir)/fish/functions
$(v)$(INSTALL) -m 755 -d $(DESTDIR)$(datadir)/fish/man/man1 $v $(INSTALL) -m 755 -d $(DESTDIR)$(datadir)/fish/man/man1
$(v)$(INSTALL) -m 755 -d $(DESTDIR)$(datadir)/fish/tools $v $(INSTALL) -m 755 -d $(DESTDIR)$(datadir)/fish/tools
$(v)$(INSTALL) -m 755 -d $(DESTDIR)$(datadir)/fish/tools/web_config $v $(INSTALL) -m 755 -d $(DESTDIR)$(datadir)/fish/tools/web_config
$(v)$(INSTALL) -m 755 -d $(DESTDIR)$(datadir)/fish/tools/web_config/js $v $(INSTALL) -m 755 -d $(DESTDIR)$(datadir)/fish/tools/web_config/js
$(v)$(INSTALL) -m 755 -d $(DESTDIR)$(datadir)/fish/tools/web_config/partials $v $(INSTALL) -m 755 -d $(DESTDIR)$(datadir)/fish/tools/web_config/partials
$(v)$(INSTALL) -m 755 -d $(DESTDIR)$(datadir)/fish/tools/web_config/sample_prompts $v $(INSTALL) -m 755 -d $(DESTDIR)$(datadir)/fish/tools/web_config/sample_prompts
$(v)$(INSTALL) -m 644 share/config.fish $(DESTDIR)$(datadir)/fish/ $v $(INSTALL) -m 644 share/config.fish $(DESTDIR)$(datadir)/fish/
$(v)$(INSTALL) -m 644 share/__fish_build_paths.fish $(DESTDIR)$(datadir)/fish/ $v $(INSTALL) -m 644 share/__fish_build_paths.fish $(DESTDIR)$(datadir)/fish/
$(v)$(INSTALL) -m 755 -d $(DESTDIR)$(datadir)/pkgconfig $v $(INSTALL) -m 755 -d $(DESTDIR)$(datadir)/pkgconfig
@echo "Creating empty vendor/'extra_' directories" @echo "Creating placeholder vendor/'extra_' directories"
$(v)$(INSTALL) -m 755 -d $(DESTDIR)$(extra_completionsdir) ||: $v $(INSTALL) -m 755 -d $(DESTDIR)$(extra_completionsdir) ||:
$(v)$(INSTALL) -m 755 -d $(DESTDIR)$(extra_functionsdir) ||: $v $(INSTALL) -m 755 -d $(DESTDIR)$(extra_functionsdir) ||:
$(v)$(INSTALL) -m 755 -d $(DESTDIR)$(extra_confdir) ||: $v $(INSTALL) -m 755 -d $(DESTDIR)$(extra_confdir) ||:
@echo "Installing pkgconfig file" @echo "Installing pkgconfig file"
$(v)$(INSTALL) -m 644 fish.pc $(DESTDIR)$(datadir)/pkgconfig $v $(INSTALL) -m 644 fish.pc $(DESTDIR)$(datadir)/pkgconfig
@echo "Installing the $(T_BOLD)fish completion libraryn$(T_RESET)..."; @echo "Installing the $(bo)fish completion libraryn$(sgr0)...";
$(v)for i in $(COMPLETIONS_DIR_FILES:%='%'); do \ $v for i in $(COMPLETIONS_DIR_FILES:%='%'); do \
$(INSTALL) -m 644 $$i $(DESTDIR)$(datadir)/fish/completions/; \ $(INSTALL) -m 644 $$i $(DESTDIR)$(datadir)/fish/completions/; \
true; \
done; done;
@echo "Installing $(T_BOLD)fish functions$(T_RESET)"; @echo "Installing $(bo)fish functions$(sgr0)";
$(v)for i in $(FUNCTIONS_DIR_FILES:%='%'); do \ $v for i in $(FUNCTIONS_DIR_FILES:%='%'); do \
$(INSTALL) -m 644 $$i $(DESTDIR)$(datadir)/fish/functions/; \ $(INSTALL) -m 644 $$i $(DESTDIR)$(datadir)/fish/functions/; \
true; \
done; done;
@echo "Installing $(T_BOLD)man pages$(T_RESET)"; @echo "Installing $(bo)man pages$(sgr0)";
$(v)for i in share/man/man1/*.1; do \ $v for i in $(wildcard share/man/man1/*.1); do \
$(INSTALL) -m 644 $$i $(DESTDIR)$(datadir)/fish/man/man1/; \ $(INSTALL) -m 644 $$i $(DESTDIR)$(datadir)/fish/man/man1/; \
true; \
done; done;
@echo "Installing $(T_BOLD)fish tools$(T_RESET)"; @echo "Installing helper tools";
$(v)for i in share/tools/*.py; do\ $v for i in $(wildcard share/tools/*.py); do\
$(INSTALL) -m 755 $$i $(DESTDIR)$(datadir)/fish/tools/; \ $(INSTALL) -m 755 $$i $(DESTDIR)$(datadir)/fish/tools/; \
true; \
done; done;
$(v)for i in share/tools/web_config/*.*; do\ $v for i in share/tools/web_config/*.*; do\
$(INSTALL) -m 644 $$i $(DESTDIR)$(datadir)/fish/tools/web_config/; \ $(INSTALL) -m 644 $$i $(DESTDIR)$(datadir)/fish/tools/web_config/; \
true; \ true; \
done; done;
$(v)for i in share/tools/web_config/js/*.*; do\ $v for i in share/tools/web_config/js/*.*; do\
$(INSTALL) -m 644 $$i $(DESTDIR)$(datadir)/fish/tools/web_config/js/; \ $(INSTALL) -m 644 $$i $(DESTDIR)$(datadir)/fish/tools/web_config/js/; \
true; \ true; \
done; done;
$(v)for i in share/tools/web_config/partials/*; do\ $v for i in share/tools/web_config/partials/*; do\
$(INSTALL) -m 644 $$i $(DESTDIR)$(datadir)/fish/tools/web_config/partials/; \ $(INSTALL) -m 644 $$i $(DESTDIR)$(datadir)/fish/tools/web_config/partials/; \
true; \ true; \
done; done;
$(v)for i in share/tools/web_config/sample_prompts/*.fish; do\ $v for i in share/tools/web_config/sample_prompts/*.fish; do\
$(INSTALL) -m 644 $$i $(DESTDIR)$(datadir)/fish/tools/web_config/sample_prompts/; \ $(INSTALL) -m 644 $$i $(DESTDIR)$(datadir)/fish/tools/web_config/sample_prompts/; \
true; \ true; \
done; done;
$(v)for i in share/tools/web_config/*.py; do\ $v for i in share/tools/web_config/*.py; do\
$(INSTALL) -m 755 $$i $(DESTDIR)$(datadir)/fish/tools/web_config/; \ $(INSTALL) -m 755 $$i $(DESTDIR)$(datadir)/fish/tools/web_config/; \
true; \ true; \
done; done;
@echo "Installing HTML documentation"; @echo "Installing online user documentation";
$(v)$(INSTALL) -m 755 -d $(DESTDIR)$(docdir) $v $(INSTALL) -m 755 -d $(DESTDIR)$(docdir)
$(v) for i in user_doc/html/* CHANGELOG.md; do \ $v for i in user_doc/html/* CHANGELOG.md; do \
if test -f $$i; then \ if test -f $$i; then \
$(INSTALL) -m 644 $$i $(DESTDIR)$(docdir); \ $(INSTALL) -m 644 $$i $(DESTDIR)$(docdir); \
fi; \ fi; \
done; done;
@echo "Installing more man pages"; @echo "Installing more man pages";
$(v)$(INSTALL) -m 755 -d $(DESTDIR)$(mandir)/man1; $v $(INSTALL) -m 755 -d $(DESTDIR)$(mandir)/man1;
$(v) for i in $(MANUALS); do \ $v for i in $(MANUALS); do \
$(INSTALL) -m 644 $$i $(DESTDIR)$(mandir)/man1/; \ $(INSTALL) -m 644 $$i $(DESTDIR)$(mandir)/man1/; \
true; \ true; \
done; done;
@ -723,70 +723,70 @@ install-force: all install-translations | show-datadir show-sysconfdir show-extr
# #
uninstall: uninstall-translations | show-prefix show-bindir show-sysconfdir show-datadir show-docdir show-mandir uninstall: uninstall-translations | show-prefix show-bindir show-sysconfdir show-datadir show-docdir show-mandir
@echo @echo
@echo "$(T_BOLD)$(T_YELLOWB)Uninstalling fish$(T_RESET) from configured \$$prefix: $(T_BOLD)$(prefix)$(T_RESET)" @echo "$(bo)$(yellow)Uninstalling fish$(sgr0) from configured \$$prefix: $(bo)$(prefix)$(sgr0)"
@echo @echo
@echo "Deleting programs: [ $(T_BOLD)$(PROGRAMS)$(T_RESET) ] in $(T_ITALIC)$(bindir)$(T_RESET)" @echo "Deleting programs: [ $(bo)$(PROGRAMS)$(sgr0) ] in $(em)$(bindir)$(sgr0)"
-$(v)for i in $(PROGRAMS); do \ -$v for i in $(PROGRAMS); do \
rm -f $(DESTDIR)$(bindir)/$$i; \ rm -f $(DESTDIR)$(bindir)/$$i; \
done; done;
@echo "Deleting configuration: $(T_BOLD)$(DESTDIR)$(sysconfdir)/fish/*$(T_RESET)" @echo "Deleting configuration: $(bo)$(DESTDIR)$(sysconfdir)/fish/*$(sgr0)"
-$(v)rm -rf $(DESTDIR)$(sysconfdir)/fish -$v rm -rf $(DESTDIR)$(sysconfdir)/fish
@echo @echo
@echo "In 5 seconds, $(T_RED)all data$(T_RESET) (includes functions, completions, tools) in" @echo "In 5 seconds, $(red)all data$(sgr0) (includes functions, completions, tools) in"
@echo $$"\t$(T_BOLD)$(DESTDIR)$(datadir)/fish$(T_RESET) will be deleted!" @echo $$"\t$(bo)$(DESTDIR)$(datadir)/fish$(sgr0) will be deleted!"
@echo @echo
@echo $$"If you put things there, $(T_RED)stop now!$(T_RESET) $(T_BOLD)\\c" @echo $$"If you put things there, $(red)stop now!$(sgr0) $(bo)\\c"
@echo $$"$(T_BOLD)5$(T_RESET) \\c" @echo $$"$(bo)5$(sgr0) \\c"
@sleep 1 @sleep 1
@echo $$"$(T_BOLD)4$(T_RESET) \\c" @echo $$"$(bo)4$(sgr0) \\c"
@sleep 1 @sleep 1
@echo $$"$(T_BOLD)3$(T_RESET) \\c" @echo $$"$(bo)3$(sgr0) \\c"
@sleep 1 @sleep 1
@echo $$"$(T_BOLD)2$(T_RESET) \\c" @echo $$"$(bo)2$(sgr0) \\c"
@sleep 1 @sleep 1
@echo $$"$(T_BOLD)1$(T_RESET) \\c" @echo $$"$(bo)1$(sgr0) \\c"
@sleep 1 @sleep 1
@echo ... @echo ...
@sleep 2 @sleep 2
@echo "... deleting $(T_BOLD)$(DESTDIR)$(datadir)/fish/*$(T_RESET)" @echo "... deleting $(bo)$(DESTDIR)$(datadir)/fish/*$(sgr0)"
-$(v) if test -d $(DESTDIR)$(datadir)/fish; then \ -$v if test -d $(DESTDIR)$(datadir)/fish; then \
rm -rf $(DESTDIR)$(datadir)/fish; \ rm -rf $(DESTDIR)$(datadir)/fish; \
fi fi
@echo @echo
@echo "Deleting documentation: $(T_BOLD)$(DESTDIR)$(docdir)/*$(T_RESET)" @echo "Deleting documentation: $(bo)$(DESTDIR)$(docdir)/*$(sgr0)"
-$(v) if test -d $(DESTDIR)$(docdir); then \ -$v if test -d $(DESTDIR)$(docdir); then \
rm -rf $(DESTDIR)$(docdir);\ rm -rf $(DESTDIR)$(docdir);\
fi fi
@echo @echo
@echo "Deleting pkgconfig file: $(T_BOLD)$(DESTDIR)$(datadir)/pkgconfig/fish.pc$(T_RESET)" @echo "Deleting pkgconfig file: $(bo)$(DESTDIR)$(datadir)/pkgconfig/fish.pc$(sgr0)"
-$(v) if test -f $(DESTDIR)$(datadir)/pkgconfig/fish.pc; then \ -$v if test -f $(DESTDIR)$(datadir)/pkgconfig/fish.pc; then \
rm -f $(DESTDIR)$(datadir)/pkgconfig/fish.pc;\ rm -f $(DESTDIR)$(datadir)/pkgconfig/fish.pc;\
fi fi
@echo @echo
@echo $$"Deleting \\c" @echo $$"Deleting \\c"
@echo "[ $(T_BOLD)"`basename $(MANUALS)`$(T_RESET) $$"] in \\c" @echo "[ $(bo)"$(basename $(MANUALS))$(sgr0) $$"] in \\c"
@echo "$(T_ITALIC)$(mandir)/man1$(T_RESET)" @echo "$(em)$(mandir)/man1$(sgr0)"
-$(v) for i in $(MANUALS); do \ -$v for i in $(MANUALS); do \
rm -rf $(DESTDIR)$(mandir)/man1/`basename $$i`*; \ rm -rf "$(DESTDIR)$(mandir)/man1/"$$$(basename $i)$$$(wildcard .*);
done; done;
@echo @echo
@echo "$(T_GREEN)Fish (likely) unintalled$(T_RESET)" @echo "$(green)Fish (likely) unintalled$(sgr0)"
@echo @echo
@echo "$(T_BOLD)./configure --prefix=$(T_RESET) to uninstall fish from a different prefix" @echo "$(bo)./configure --prefix=$(sgr0) to uninstall fish from a different prefix"
.PHONY: uninstall .PHONY: uninstall
install-translations: $(TRANSLATIONS) install-translations: $(TRANSLATIONS) | show-HAVE_GETTEXT
ifdef HAVE_GETTEXT ifdef HAVE_GETTEXT
@echo "Installing translations..." @echo "Installing translations..."
$(v)for i in $(TRANSLATIONS); do \ $v for i in $(TRANSLATIONS); do \
$(INSTALL) -m 755 -d $(DESTDIR)$(localedir)/`basename $$i .gmo`/LC_MESSAGES; \ $(INSTALL) -m 755 -d $(DESTDIR)$(localedir)/`basename $$i .gmo`/LC_MESSAGES; \
$(INSTALL) -m 644 $$i $(DESTDIR)$(localedir)/`basename $$i .gmo`/LC_MESSAGES/fish.mo; \ $(INSTALL) -m 644 $$i $(DESTDIR)$(localedir)/`basename $$i .gmo`/LC_MESSAGES/fish.mo; \
done done
endif endif
.PHONY: install-translations .PHONY: install-translations
uninstall-translations: uninstall-translations: show-DESTDIR show-localedir
$(v)rm -f $(DESTDIR)$(localedir)/*/LC_MESSAGES/fish.mo $v rm -f $(DESTDIR)$(localedir)/*/LC_MESSAGES/fish.mo
.PHONY: uninstall-translations .PHONY: uninstall-translations
# #
@ -796,50 +796,52 @@ uninstall-translations:
# #
# How basic files get compiled # How basic files get compiled
# #
obj/%.o: src/%.cpp | obj obj/%.o: src/%.cpp | show-CXX show-CXXFLAGS show-CPPFLAGS obj
@echo " CXX $(T_ITALIC)$@$(T_RESET)" @echo " CXX $(em)$@$(sgr0)"
$(v)$(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $< -o $@ $v $(CXX) $(CPPFLAGS) $(CXXFLAGS) -c $< -o $@
# #
# obj directory # obj directory
# #
obj: obj: | show-MKDIR_P
$(v)mkdir obj @echo " MKDIR_P $(em)$@$(sgr0)"
$v $(MKDIR_P) obj
# #
# Build the fish program. # Build the fish program.
# #
fish: obj/fish.o $(FISH_OBJS) $(EXTRA_PCRE2) fish: obj/fish.o $(FISH_OBJS) $(EXTRA_PCRE2)
@echo " CXXLD $(T_ITALIC)$@$(T_RESET)" @echo " CXX LD $(em)$@$(sgr0)"
$(v)$(CXX) $(CPPFLAGS) $(CXXFLAGS) $(LDFLAGS_FISH) $(FISH_OBJS) obj/fish.o $(LIBS) -o $@ $v $(CXX) $(CPPFLAGS) $(CXXFLAGS) $(LDFLAGS_FISH) $(FISH_OBJS) obj/fish.o $(LIBS) -o $@
$(PCRE2_LIB): $(PCRE2_H) $(PCRE2_LIB): $(PCRE2_H)
@echo " MAKE $(T_ITALIC)$@$(T_RESET)" @echo " MAKE $(em)$@$(sgr0)"
@$(MAKE) V=$(V) -C $(PCRE2_DIR) libpcre2-$(PCRE2_WIDTH).la $v $(MAKE) V=$(V) -C $(PCRE2_DIR) libpcre2-$(PCRE2_WIDTH).la
$(PCRE2_H): $(PCRE2_H):
$(v)(cd $(PCRE2_DIR) && ./config.status) @echo " autoconf $(em)$@$(sgr0)"
$v (cd $(PCRE2_DIR) && ./config.status)
# #
# Build the fish_tests program. # Build the fish_tests program.
# #
fish_tests: $(FISH_TESTS_OBJS) $(EXTRA_PCRE2) fish_tests: $(FISH_TESTS_OBJS) $(EXTRA_PCRE2)
@echo " CXXLD $(T_ITALIC)$@$(T_RESET)" @echo " CXX LD $(em)$@$(sgr0)"
$(v)$(CXX) $(CXXFLAGS) $(LDFLAGS_FISH) $(FISH_TESTS_OBJS) $(LIBS) -o $@ $v $(CXX) $(CXXFLAGS) $(LDFLAGS_FISH) $(FISH_TESTS_OBJS) $(LIBS) -o $@
# #
# Build the fish_indent program. # Build the fish_indent program.
# #
fish_indent: $(FISH_INDENT_OBJS) $(EXTRA_PCRE2) fish_indent: $(FISH_INDENT_OBJS) $(EXTRA_PCRE2)
@echo " CXXLD $(T_ITALIC)$@$(T_RESET)" @echo " CXX LD $(em)$@$(sgr0)"
$(v)$(CXX) $(CXXFLAGS) $(LDFLAGS) $(FISH_INDENT_OBJS) $(LIBS) -o $@ $v $(CXX) $(CXXFLAGS) $(LDFLAGS) $(FISH_INDENT_OBJS) $(LIBS) -o $@
# #
# Build the fish_key_reader program to show input from the terminal. # Build the fish_key_reader program to show input from the terminal.
# #
fish_key_reader: $(FISH_KEYREAD_OBJS) $(EXTRA_PCRE2) fish_key_reader: $(FISH_KEYREAD_OBJS) $(EXTRA_PCRE2)
@echo " CXXLD $(T_ITALIC)$@$(T_RESET)" @echo " CXX LD $(em)$@$(sgr0)"
$(v)$(CXX) $(CXXFLAGS) $(LDFLAGS_FISH) $^ $(LIBS) -o $@ $v $(CXX) $(CXXFLAGS) $(LDFLAGS_FISH) $^ $(LIBS) -o $@
# #
# Update dependencies # Update dependencies
@ -852,24 +854,26 @@ fish_key_reader: $(FISH_KEYREAD_OBJS) $(EXTRA_PCRE2)
# exactly the files that result in objects, leaving the #include'd files # exactly the files that result in objects, leaving the #include'd files
# behind. # behind.
# #
depend: depend: | show-MKDIR_P
@echo $(T_ITALIC)"Running makedepend..."$(T_RESET) @echo " CXX LD $(em)$@$(sgr0)"
$(v)mkdir -p /tmp/fish_make_depend/src $v $(MKDIR_P) /tmp/fish_make_depend/src
$(v)cp src/*.cpp src/*.h /tmp/fish_make_depend/src # This is ran only once in a blue moon - full verbosity so we are reminded what it does.
$(v)cp config.h /tmp/fish_make_depend/ cp $(wildcard src/*.cpp src/*.h) /tmp/fish_make_depend/src
$(v)mv $(subst obj/,/tmp/fish_make_depend/src/,$(FISH_ALL_OBJS:.o=.cpp)) /tmp/fish_make_depend/ cp config.h /tmp/fish_make_depend/
$(v)cd /tmp/fish_make_depend && makedepend -f$(CURDIR)/Makefile.in -pobj/ -Y -Isrc *.cpp mv $(subst obj/,/tmp/fish_make_depend/src/,$(FISH_ALL_OBJS:.o=.cpp)) /tmp/fish_make_depend/
$(v)rm -Rf /tmp/fish_make_depend cd /tmp/fish_make_depend && makedepend -f$(CURDIR)/Makefile.in -pobj/ -Y -Isrc *.cpp
$(v)./config.status rm -Rf /tmp/fish_make_depend
$v ./config.status
.PHONY: depend .PHONY: depend
# #
# Lint the code. This only deals with C++ # Lint the code. This only deals with C++
# TODO - why not have the Makefile run lint.fish on actual files itself (generate a report target?)
# #
lint: lint:
$(v)build_tools/lint.fish $(CXX) $(CXXFLAGS) $(CPPFLAGS) $v build_tools/lint.fish $(CXX) $(CXXFLAGS) $(CPPFLAGS)
lint-all: lint-all:
$(v)build_tools/lint.fish $(CXX) --all $(CXXFLAGS) $(CPPFLAGS) $v build_tools/lint.fish $(CXX) --all $(CXXFLAGS) $(CPPFLAGS)
.PHONY: lint lint-all .PHONY: lint lint-all
# #
@ -877,17 +881,17 @@ lint-all:
# fish scripts (*.fish). # fish scripts (*.fish).
# #
style: style:
$(v)build_tools/style.fish $v build_tools/style.fish
style-all: style-all:
$(v)build_tools/style.fish --all $v build_tools/style.fish --all
.PHONY: style style-all .PHONY: style style-all
# #
# Restore the source tree to the state right after extracting a tarball. # Restore the source tree to the state right after extracting a tarball.
# #
distclean: clean distclean: clean
$(v)$(MAKE) V=$(V) -C $(PCRE2_DIR) distclean ||: $v $(MAKE) V=$(V) -C $(PCRE2_DIR) distclean ||:
$(v)rm -f config.status config.log config.h Makefile $v rm -f config.status config.log config.h Makefile
.PHONY: distclean .PHONY: distclean
# #
@ -899,7 +903,7 @@ distclean: clean
# them. # them.
# #
clean: clean:
@echo "$(T_BOLD)Removing everything built by the Makefile...$(T_RESET)" @echo "$(bo)Removing everything built by the Makefile...$(sgr0)"
# PCRE's make clean has a few slightly annoying exceptions to the V= rule. If V=0 # PCRE's make clean has a few slightly annoying exceptions to the V= rule. If V=0
# send all output to /dev/null - unless there's an error, in which case run it again not silenced. # send all output to /dev/null - unless there's an error, in which case run it again not silenced.
ifeq ($(V), 0 ) ifeq ($(V), 0 )
@ -907,29 +911,29 @@ ifeq ($(V), 0 )
else else
@$(MAKE) -s -C $(PCRE2_DIR) clean > /dev/null || $(MAKE) -s -C $(PCRE2_DIR) clean ||: @$(MAKE) -s -C $(PCRE2_DIR) clean > /dev/null || $(MAKE) -s -C $(PCRE2_DIR) clean ||:
endif endif
$(v)rm -f obj/*.o *.o doc.h doc.tmp $v rm -f obj/*.o *.o doc.h doc.tmp
$(v)rm -f doc_src/*.doxygen doc_src/*.cpp doc_src/*.o doc_src/commands.hdr $v rm -f doc_src/*.doxygen doc_src/*.cpp doc_src/*.o doc_src/commands.hdr
$(v)rm -f tests/tmp.err tests/tmp.out tests/tmp.status tests/foo.txt $v rm -f tests/tmp.err tests/tmp.out tests/tmp.status tests/foo.txt
$(v)rm -f $(PROGRAMS) fish_tests fish_key_reader $v rm -f $(PROGRAMS) fish_tests fish_key_reader
$(v)rm -f command_list.txt command_list_toc.txt toc.txt $v rm -f command_list.txt command_list_toc.txt toc.txt
$(v)rm -f doc_src/index.hdr doc_src/commands.hdr $v rm -f doc_src/index.hdr doc_src/commands.hdr
$(v)rm -f lexicon_filter lexicon.txt lexicon.log $v rm -f lexicon_filter lexicon.txt lexicon.log
$(v)rm -f compile_commands.json xcodebuild.log $v rm -f compile_commands.json xcodebuild.log
$(v)rm -f FISH-BUILD-VERSION-FILE fish.pc share/__fish_build_paths.fish $v rm -f FISH-BUILD-VERSION-FILE fish.pc share/__fish_build_paths.fish
$(v)if test "$(HAVE_DOXYGEN)" = 1; then \ $v if test "$(HAVE_DOXYGEN)" = 1; then \
rm -rf doc user_doc share/man; \ rm -rf doc user_doc share/man; \
fi fi
$(v)rm -f po/*.gmo $v rm -f po/*.gmo
$(v)rm -rf obj build test $v rm -rf obj build test
.PHONY: clean .PHONY: clean
# For silent build # For silent build
# These rules need to stay at the end - $(v) won't work after this. # These rules need to stay at the end - $v won't work after this.
# if V=0: # if V=0:
# $(v)cmd ⇒ @cmd # $v cmd ⇒ @cmd
V0 := @ V0 := @
# if V=1 # if V=1
# $(v)cmd ⇒ cmd # $v cmd ⇒ cmd
V1 := V1 :=
v = $(V$(V)) v = $(V$(V))

View file

@ -14,7 +14,7 @@ AC_PREREQ([2.60])
AC_INIT(fish, AC_INIT(fish,
m4_esyscmd([cut -f 3 -d ' ' FISH-BUILD-VERSION-FILE | tr -d '\n']), m4_esyscmd([cut -f 3 -d ' ' FISH-BUILD-VERSION-FILE | tr -d '\n']),
fish-users@lists.sourceforge.net) fish-users@lists.sourceforge.net)
ac_clean_files=a.out.dSYM
# #
# List of output variables produced by this configure script # List of output variables produced by this configure script
# #
@ -25,7 +25,6 @@ AC_SUBST(LDFLAGS_FISH)
AC_SUBST(WCHAR_T_BITS) AC_SUBST(WCHAR_T_BITS)
AC_SUBST(EXTRA_PCRE2) AC_SUBST(EXTRA_PCRE2)
# #
# If needed, run autoconf to regenerate the configure file # If needed, run autoconf to regenerate the configure file
# #
@ -50,7 +49,7 @@ if test configure -ot configure.ac; then
AC_MSG_ERROR( AC_MSG_ERROR(
[cannot find the autoconf program in your path. [cannot find the autoconf program in your path.
This program needs to be run whenever the configure.ac file is modified. This program needs to be run whenever the configure.ac file is modified.
Please install it and try again.] Please install autoconf and try again.]
) )
fi fi
else else
@ -75,7 +74,7 @@ if test ! -f ./config.h.in -o config.h.in -ot configure.ac; then
AC_MSG_ERROR( AC_MSG_ERROR(
[cannot find the autoheader program in your path. [cannot find the autoheader program in your path.
This program needs to be run whenever the configure.ac file is modified. This program needs to be run whenever the configure.ac file is modified.
Please install it and try again.] Please install autotools and try again.]
) )
fi fi
else else
@ -86,22 +85,26 @@ fi
# Set up various programs needed for install # Set up various programs needed for install
# Note AC_PROG_CXX sets CXXFLAGS if not set, which we want # Note AC_PROG_CXX sets CXXFLAGS if not set, which we want
# So ensure this happens before we modify CXXFLAGS below # So ensure this happens before we modify CXXFLAGS below
# # Do CC also, because PCRE2 will use it. Prefer clang++,
# targets like FreeBSD ship an ancient one.
AC_PROG_CXX([g++ c++]) AC_PROG_CC([clang llvm-gcc gcc cc])
AC_PROG_INSTALL AC_PROG_CC_STDC # c99
AC_PROG_SED AC_PROG_CXX([clang++ llvm-g++ g++ c++])
AC_PROG_CXXCPP([clang++ llvm-g++ g++ c++])
AC_LANG(C++) AC_LANG(C++)
AC_PROG_INSTALL
AC_PROG_LN_S
AC_PROG_MKDIR_P
AC_PROG_AWK
AC_PROG_FGREP
AC_PROG_SED
AC_USE_SYSTEM_EXTENSIONS AC_USE_SYSTEM_EXTENSIONS
AC_CANONICAL_TARGET
echo "CXXFLAGS: $CXXFLAGS"
# #
# Tell autoconf to create config.h header # Tell autoconf to create config.h header
# #
AC_CONFIG_HEADERS(config.h) AC_CONFIG_HEADERS(config.h)
AC_CANONICAL_TARGET
# #
@ -212,7 +215,7 @@ CXXFLAGS="$CXXFLAGS -fno-exceptions"
# But signed comparison warnings are way too aggressive # But signed comparison warnings are way too aggressive
# #
CXXFLAGS="$CXXFLAGS -Wall -Wno-sign-compare" CXXFLAGS="$CXXFLAGS -Wextra"
# #
# This is needed in order to get the really cool backtraces on Linux # This is needed in order to get the really cool backtraces on Linux
@ -254,7 +257,6 @@ AC_SEARCH_LIBS( nanosleep, rt, , [AC_MSG_ERROR([Cannot find the rt library, need
AC_SEARCH_LIBS( shm_open, rt, , [AC_MSG_ERROR([Cannot find the rt library, needed to build this package.] )] ) AC_SEARCH_LIBS( shm_open, rt, , [AC_MSG_ERROR([Cannot find the rt library, needed to build this package.] )] )
AC_SEARCH_LIBS( pthread_create, pthread, , [AC_MSG_ERROR([Cannot find the pthread library, needed to build this package.] )] ) AC_SEARCH_LIBS( pthread_create, pthread, , [AC_MSG_ERROR([Cannot find the pthread library, needed to build this package.] )] )
AC_SEARCH_LIBS( setupterm, [ncurses tinfo curses], , [AC_MSG_ERROR([Could not find a curses implementation, needed to build fish. If this is Linux, try running 'sudo apt-get install libncurses5-dev' or 'sudo yum install ncurses-devel'])] ) AC_SEARCH_LIBS( setupterm, [ncurses tinfo curses], , [AC_MSG_ERROR([Could not find a curses implementation, needed to build fish. If this is Linux, try running 'sudo apt-get install libncurses5-dev' or 'sudo yum install ncurses-devel'])] )
AC_SEARCH_LIBS( [nan], [m], [AC_DEFINE( [HAVE_NAN], [1], [Define to 1 if you have the nan function])] )
AC_SEARCH_LIBS( [dladdr], [dl] ) AC_SEARCH_LIBS( [dladdr], [dl] )
if test x$local_gettext != xno; then if test x$local_gettext != xno; then
@ -630,5 +632,3 @@ AC_CONFIG_FILES([Makefile])
AC_OUTPUT AC_OUTPUT
echo "fish is now configured." echo "fish is now configured."
echo "Use 'make' and 'make install' to build and install fish."

View file

@ -6,8 +6,41 @@
# If we see that there is an external command by that name we just return. That will cause fish to # If we see that there is an external command by that name we just return. That will cause fish to
# run the external command. On the other hand, if an external command isn't found we define a # run the external command. On the other hand, if an external command isn't found we define a
# function that will provide fallback behavior. # function that will provide fallback behavior.
if not type -q -P realpath if not command -s realpath >/dev/null
function realpath --description 'fallback realpath implementation'
builtin fish_realpath $argv[-1] if command -s grealpath >/dev/null
function realpath -w grealpath -d "print the resolved path [grealpath]"
grealpath $argv
end
else
function realpath -w fish_realpath -d "get an absolute path without symlinks [fish_realpath]"
if test -z $argv
printf "usage: %s%s%s %sfile%s …\n" (set_color -o) $_ (set_color normal) (set_color -u) (set_color normal)
echo " resolves files as absolute paths without symlinks"
return 1
end
for arg in $argv
switch $arg
# These - no can do our realpath
case -s --strip --no-symlinks -z --zero --relative-base\* --relative-to\*
__fish_print_help fish_realpath
return 2
case -h --help --version
__fish_print_help fish_realpath
return 0
# Service commands called with these arguments by
# dropping the arguments to protext fish_realpath from them
# There are no sure things here
case -e --canonicalize-existing --physical -P -q --quiet -m --canonicalize-missing
continue
case "*"
fish_realpath $argv
end
end
end
end end
end end