这是indexloc提供的服务,不要输入任何密码
Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 0 additions & 23 deletions packages/fish/CMakeLists.txt.patch

This file was deleted.

11 changes: 11 additions & 0 deletions packages/fish/Cargo.toml.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -31,7 +31,7 @@
bitflags = "2.5.0"
errno = "0.3.0"
lazy_static = "1.4.0"
-libc = "0.2.155"
+libc = "0.2.170"
# lru pulls in hashbrown by default, which uses a faster (though less DoS resistant) hashing algo.
# disabling default features uses the stdlib instead, but it doubles the time to rewrite the history
# files as of 22 April 2024.
13 changes: 0 additions & 13 deletions packages/fish/WIFSTOPPED.patch

This file was deleted.

12 changes: 0 additions & 12 deletions packages/fish/apt-autocompletion-sources-paths.patch

This file was deleted.

45 changes: 45 additions & 0 deletions packages/fish/backport-cmake-FindRust.cmake.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
From b38551dde9daaab501b4f20d5d16a65bef9fa43f Mon Sep 17 00:00:00 2001
From: Peter Ammon <rf@fishshell.com>
Date: Wed, 5 Mar 2025 21:37:21 -0800
Subject: [PATCH] Drag FindRust.cmake back into the land of the living

rustup has changed its output for 'rustup toolchain list --verbose`.
Teach FindRust.cmake about it, so that it may shamble on.

This was reported against BSD and also affects macOS and ALSO affects Linux; our
CI just doesn't have a new enough rustup. Anyways we can't have nice things.
---
cmake/FindRust.cmake | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)

diff --git a/cmake/FindRust.cmake b/cmake/FindRust.cmake
index cf68c4e27a21..493104accad5 100644
--- a/cmake/FindRust.cmake
+++ b/cmake/FindRust.cmake
@@ -306,18 +306,23 @@ if (Rust_RESOLVE_RUSTUP_TOOLCHAINS)
set(_DISCOVERED_TOOLCHAINS_VERSION "")

foreach(_TOOLCHAIN_RAW ${_TOOLCHAINS_RAW})
- if (_TOOLCHAIN_RAW MATCHES "([a-zA-Z0-9\\._\\-]+)[ \t\r\n]?(\\(default\\) \\(override\\)|\\(default\\)|\\(override\\))?[ \t\r\n]+(.+)")
+ # We're going to try to parse the output of `rustup toolchain list --verbose`.
+ # We expect output like this:
+ # stable-random-toolchain-junk (parenthesized-random-stuff-like-active-or-default) /path/to/toolchain/blah/more-blah
+ # In the following regex, we capture the toolchain name, any parenthesized stuff, and then the path.
+ message(STATUS "Parsing toolchain: ${_TOOLCHAIN_RAW}")
+ if (_TOOLCHAIN_RAW MATCHES "([^\t ]+)[\t ]*(\\(.*\\))?[\t ]*(.+)")
set(_TOOLCHAIN "${CMAKE_MATCH_1}")
set(_TOOLCHAIN_TYPE "${CMAKE_MATCH_2}")

set(_TOOLCHAIN_PATH "${CMAKE_MATCH_3}")
set(_TOOLCHAIN_${_TOOLCHAIN}_PATH "${CMAKE_MATCH_3}")

- if (_TOOLCHAIN_TYPE MATCHES ".*\\(default\\).*")
+ if (_TOOLCHAIN_TYPE MATCHES "default")
set(_TOOLCHAIN_DEFAULT "${_TOOLCHAIN}")
endif()

- if (_TOOLCHAIN_TYPE MATCHES ".*\\(override\\).*")
+ if (_TOOLCHAIN_TYPE MATCHES "override")
set(_TOOLCHAIN_OVERRIDE "${_TOOLCHAIN}")
endif()

13 changes: 13 additions & 0 deletions packages/fish/build.rs.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
--- a/build.rs
+++ b/build.rs
@@ -96,7 +96,9 @@ fn detect_cfgs(target: &mut Target) {
Ok(target.has_symbol("localeconv_l"))
}),
("FISH_USE_POSIX_SPAWN", &|target| {
- Ok(target.has_header("spawn.h"))
+ // the command 'fish -c "uname"', and most other uses of fish's -c argument,
+ // are not working if this is enabled.
+ Ok(false)
}),
("HAVE_PIPE2", &|target| {
Ok(target.has_symbol("pipe2"))
69 changes: 43 additions & 26 deletions packages/fish/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,44 +2,61 @@ 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.7.1"
TERMUX_PKG_REVISION=2
TERMUX_PKG_VERSION="4.0.0"
TERMUX_PKG_SRCURL=https://github.com/fish-shell/fish-shell/releases/download/$TERMUX_PKG_VERSION/fish-${TERMUX_PKG_VERSION}.tar.xz
TERMUX_PKG_SHA256=614c9f5643cd0799df391395fa6bbc3649427bb839722ce3b114d3bbc1a3b250
TERMUX_PKG_SHA256=2fda5bd970357064d8d4c896e08285ba59965ca2a8c4829ca8a82bf3b89c69f3
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="bc, libandroid-support, libandroid-spawn, libc++, ncurses, ncurses-utils, man, pcre2"
TERMUX_PKG_BUILD_IN_SRC=true
TERMUX_PKG_EXTRA_CONFIGURE_ARGS="
-DBUILD_DOCS=OFF
-DFISH_USE_SYSTEM_PCRE2=ON
-DMAC_CODESIGN_ID=OFF
-DWITH_GETTEXT=OFF
"

termux_step_pre_configure() {
# fish releases tarballs that conflict with the way the toolchain
# currently is by putting a file in the tarball
# named "version" (not visible directly in the source code on github,
# generated by this code in fish's release workflow:
# https://github.com/fish-shell/fish-shell/blob/master/build_tools/make_tarball.sh#L69 )
# and, crucially, also placing the folder containing that file named "version"
# in the include path of building fish (since right next to this in the same folder,
# fish does have a file named "config.h" that it uses)
# here is the upstream, conflicting instance of file in internal llvm
# include path named "version" that is probably what propogates into the NDK's
# equivalent file,
# /home/builder/.termux-build/_cache/android-r27b-api-24-v1/sysroot/usr/include/c++/v1/version
# https://github.com/llvm/llvm-project/blob/main/libcxx/include/version
mv version fish_version
find build_tools -type f -exec sed -i {} \
-e 's/cat version/cat fish_version/g' \
-e 's/test -f version/test -f fish_version/g' \;
CXXFLAGS+=" $CPPFLAGS"
termux_setup_cmake
termux_setup_ninja
termux_setup_rust

# FindRust.cmake auto pick thumbv7neon-linux-androideabi
[[ "${TERMUX_ARCH}" == "arm" ]] && TERMUX_PKG_EXTRA_CONFIGURE_ARGS+=" -DCMAKE_ANDROID_ARM_MODE=ON"

# older than Android 8 dont have ctermid
"${CC}" ${CPPFLAGS} ${CFLAGS} -c ${TERMUX_PKG_BUILDER_DIR}/ctermid.c
"${AR}" cru libctermid.a ctermid.o

# cmake invokes rustc directly leaving CARGO_TARGET_*_RUSTFLAGS unused
local -u env_host="${CARGO_TARGET_NAME//-/_}"
export RUSTFLAGS=$(env | grep CARGO_TARGET_${env_host}_RUSTFLAGS | cut -d'=' -f2-)
RUSTFLAGS+=" -C link-arg=-landroid-spawn"
RUSTFLAGS+=" -L${TERMUX_PKG_BUILDDIR} -C link-arg=-l:libctermid.a"

: "${CARGO_HOME:=${HOME}/.cargo}"
export CARGO_HOME

rm -rf "$CARGO_HOME"/registry/src/*/libc-*
cargo fetch --target "${CARGO_TARGET_NAME}"

local libc p
for libc in "${CARGO_HOME}"/registry/src/*/libc-*; do
for p in "${TERMUX_PKG_BUILDER_DIR}"/libc-*.diff; do
[[ -f "${p}" ]] && patch -p1 -d "${libc}" -i "${p}" || termux_error_exit "fish: failed to apply patch '$p'"
done
done
}

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
cat >> "$TERMUX_PREFIX/etc/fish/config.fish" <<-EOF
function __fish_command_not_found_handler --on-event fish_command_not_found
$TERMUX_PREFIX/libexec/termux/command-not-found \$argv[1]
end
EOF
}

termux_step_post_massage() {
rm -rf "$CARGO_HOME"/registry/src/*/libc-*
}
12 changes: 0 additions & 12 deletions packages/fish/create_manpage_completions.py.patch

This file was deleted.

33 changes: 33 additions & 0 deletions packages/fish/ctermid.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
/*
Copyright © 2005-2020 Rich Felker, et al.

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/

// redefine ctermid since ndk-patches/*/stdio.h.patch inline ctermid
#define ctermid ctermid_orig
#include <stdio.h>
#include <string.h>
#undef ctermid

char *ctermid(char *s)
{
return s ? strcpy(s, "/dev/tty") : "/dev/tty";
}
95 changes: 95 additions & 0 deletions packages/fish/libc-src-unix-linux_like-android-mod.rs.diff
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
--- a/src/unix/linux_like/android/mod.rs
+++ b/src/unix/linux_like/android/mod.rs
@@ -54,6 +54,92 @@
pub type posix_spawn_file_actions_t = *mut c_void;
pub type posix_spawnattr_t = *mut c_void;

+pub const POSIX_SPAWN_USEVFORK: c_int = 64;
+pub const POSIX_SPAWN_SETSID: c_int = 128;
+
+pub const POSIX_SPAWN_RESETIDS: c_int = 0x01;
+pub const POSIX_SPAWN_SETPGROUP: c_int = 0x02;
+pub const POSIX_SPAWN_SETSIGDEF: c_int = 0x04;
+pub const POSIX_SPAWN_SETSIGMASK: c_int = 0x08;
+pub const POSIX_SPAWN_SETSCHEDPARAM: c_int = 0x10;
+pub const POSIX_SPAWN_SETSCHEDULER: c_int = 0x20;
+
+extern "C" {
+ pub fn posix_spawn(
+ pid: *mut crate::pid_t,
+ path: *const c_char,
+ file_actions: *const crate::posix_spawn_file_actions_t,
+ attrp: *const crate::posix_spawnattr_t,
+ argv: *const *mut c_char,
+ envp: *const *mut c_char,
+ ) -> c_int;
+ pub fn posix_spawnp(
+ pid: *mut crate::pid_t,
+ file: *const c_char,
+ file_actions: *const crate::posix_spawn_file_actions_t,
+ attrp: *const crate::posix_spawnattr_t,
+ argv: *const *mut c_char,
+ envp: *const *mut c_char,
+ ) -> c_int;
+ pub fn posix_spawnattr_init(attr: *mut posix_spawnattr_t) -> c_int;
+ pub fn posix_spawnattr_destroy(attr: *mut posix_spawnattr_t) -> c_int;
+ pub fn posix_spawnattr_getsigdefault(
+ attr: *const posix_spawnattr_t,
+ default: *mut crate::sigset_t,
+ ) -> c_int;
+ pub fn posix_spawnattr_setsigdefault(
+ attr: *mut posix_spawnattr_t,
+ default: *const crate::sigset_t,
+ ) -> c_int;
+ pub fn posix_spawnattr_getsigmask(
+ attr: *const posix_spawnattr_t,
+ default: *mut crate::sigset_t,
+ ) -> c_int;
+ pub fn posix_spawnattr_setsigmask(
+ attr: *mut posix_spawnattr_t,
+ default: *const crate::sigset_t,
+ ) -> c_int;
+ pub fn posix_spawnattr_getflags(attr: *const posix_spawnattr_t, flags: *mut c_short) -> c_int;
+ pub fn posix_spawnattr_setflags(attr: *mut posix_spawnattr_t, flags: c_short) -> c_int;
+ pub fn posix_spawnattr_getpgroup(
+ attr: *const posix_spawnattr_t,
+ flags: *mut crate::pid_t,
+ ) -> c_int;
+ pub fn posix_spawnattr_setpgroup(attr: *mut posix_spawnattr_t, flags: crate::pid_t) -> c_int;
+ pub fn posix_spawnattr_getschedpolicy(
+ attr: *const posix_spawnattr_t,
+ flags: *mut c_int,
+ ) -> c_int;
+ pub fn posix_spawnattr_setschedpolicy(attr: *mut posix_spawnattr_t, flags: c_int) -> c_int;
+ pub fn posix_spawnattr_getschedparam(
+ attr: *const posix_spawnattr_t,
+ param: *mut crate::sched_param,
+ ) -> c_int;
+ pub fn posix_spawnattr_setschedparam(
+ attr: *mut posix_spawnattr_t,
+ param: *const crate::sched_param,
+ ) -> c_int;
+
+ pub fn posix_spawn_file_actions_init(actions: *mut posix_spawn_file_actions_t) -> c_int;
+ pub fn posix_spawn_file_actions_destroy(actions: *mut posix_spawn_file_actions_t) -> c_int;
+ pub fn posix_spawn_file_actions_addopen(
+ actions: *mut posix_spawn_file_actions_t,
+ fd: c_int,
+ path: *const c_char,
+ oflag: c_int,
+ mode: crate::mode_t,
+ ) -> c_int;
+ pub fn posix_spawn_file_actions_addclose(
+ actions: *mut posix_spawn_file_actions_t,
+ fd: c_int,
+ ) -> c_int;
+ pub fn posix_spawn_file_actions_adddup2(
+ actions: *mut posix_spawn_file_actions_t,
+ fd: c_int,
+ newfd: c_int,
+ ) -> c_int;
+}
+
s! {
pub struct stack_t {
pub ss_sp: *mut c_void,
Loading