termux-packages/packages/fish/build.sh
Yaksh Bariya 09156c3c88
fish: fix inconsistent behaviour executing hardcoded paths
When executing command as /bin/<command>, fish first checks whether <command> is present in /bin/ or not. If it is found, then it will execute the command. But as we are using termux-exec, fish will actually try to execute <command> in @TERMUX_PREFIX@/bin/.

An example of this:-
/bin/ls:
1) Fish will first try find whether ls binary exists in /bin and whether user has permissions to execute it
2) If both the above are true, fish will try to execute /bin/ls.
3) But since we are using termux-exec, the path will be remapped to @TERMUX_PREFIX@/bin/ls
4) This is a *highly* inconsistent behaviour.

This can cause weird bugs when a script tries to execute with hardcoded paths, it might get errors about command not found even if it exists, because fish is checking it at the wrong place.
2021-12-08 14:21:37 +05:30

35 lines
1.2 KiB
Bash

TERMUX_PKG_HOMEPAGE=https://fishshell.com/
TERMUX_PKG_DESCRIPTION="The user-friendly command line shell"
TERMUX_PKG_LICENSE="GPL-2.0"
TERMUX_PKG_MAINTAINER="@termux"
TERMUX_PKG_VERSION=3.3.1
TERMUX_PKG_REVISION=3
TERMUX_PKG_SRCURL=https://github.com/fish-shell/fish-shell/releases/download/$TERMUX_PKG_VERSION/fish-${TERMUX_PKG_VERSION}.tar.xz
TERMUX_PKG_SHA256=b5b4ee1a5269762cbbe993a4bd6507e675e4100ce9bbe84214a5eeb2b19fae89
TERMUX_PKG_AUTO_UPDATE=true
# fish calls 'tput' from ncurses-utils, at least when cancelling (Ctrl+C) a command line.
# man is needed since fish calls apropos during command completion.
TERMUX_PKG_DEPENDS="libc++, ncurses, libandroid-support, ncurses-utils, man, bc, pcre2, libandroid-spawn"
TERMUX_PKG_BUILD_IN_SRC=true
# Prevent clashing of shell completions
TERMUX_PKG_RM_AFTER_INSTALL="
share/fish/completions/rg.fish
share/fish/completions/yadm.fish
"
TERMUX_PKG_EXTRA_CONFIGURE_ARGS="
-DBUILD_DOCS=OFF
"
termux_step_pre_configure() {
CXXFLAGS+=" $CPPFLAGS"
}
termux_step_post_make_install() {
cat >> $TERMUX_PREFIX/etc/fish/config.fish <<HERE
function __fish_command_not_found_handler --on-event fish_command_not_found
$TERMUX_PREFIX/libexec/termux/command-not-found \$argv[1]
end
HERE
}