这是indexloc提供的服务,不要输入任何密码
Skip to content

re-enable alacritty copy/paste #25238

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 12 commits into
base: master
Choose a base branch
from
Open
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
48 changes: 0 additions & 48 deletions x11-packages/alacritty/0001-disable-clipboard.patch

This file was deleted.

126 changes: 53 additions & 73 deletions x11-packages/alacritty/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,98 +3,78 @@ TERMUX_PKG_DESCRIPTION="A fast, cross-platform, OpenGL terminal emulator"
TERMUX_PKG_LICENSE="Apache-2.0, MIT"
TERMUX_PKG_MAINTAINER="Joshua Kahn @TomJo2000"
TERMUX_PKG_VERSION="0.15.1"
TERMUX_PKG_REVISION=1
TERMUX_PKG_REVISION=2
TERMUX_PKG_SRCURL=https://github.com/alacritty/alacritty/archive/refs/tags/v${TERMUX_PKG_VERSION}.tar.gz
TERMUX_PKG_SHA256=b814e30c6271ae23158c66e0e2377c3600bb24041fa382a36e81be564eeb2e36
TERMUX_PKG_DEPENDS="fontconfig, freetype, libxi, libxcursor, libxrandr"
TERMUX_PKG_BUILD_DEPENDS="libxcb, libxkbcommon, ncurses"
TERMUX_PKG_BUILD_IN_SRC=true
TERMUX_PKG_AUTO_UPDATE=true

__cargo_fetch_dep_source_for_rust_windowing() {
local _name="$1"
local _version
_version=$(cargo metadata --format-version=1 --no-deps | jq -r ".packages[0].dependencies[] | select(.name==\"$_name\") | .req")
_version="${_version/^/}"
local _url="https://github.com/rust-windowing/$_name/archive/refs/tags/v$_version.tar.gz"
local _path="$TERMUX_PKG_CACHEDIR/$_name-v$_version.tar.gz"
termux_download "$_url" "$_path" SKIP_CHECKSUM
tar xf "$_path" -C "$TERMUX_PKG_SRCDIR"
mv "$_name-$_version" "$_name-source"
}

termux_step_pre_configure() {
termux_step_configure() {
termux_setup_cmake
termux_setup_rust
cargo clean
cargo vendor

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

__cargo_fetch_dep_source_for_rust_windowing "winit"
__cargo_fetch_dep_source_for_rust_windowing "glutin"

patch="$TERMUX_PKG_BUILDER_DIR/patch-root-Cargo.diff"
patch -p1 -d "$TERMUX_PKG_SRCDIR" < "$patch"

cat "$TERMUX_PKG_BUILDER_DIR"/winit-*.diff | patch -p1 -d "$TERMUX_PKG_SRCDIR/winit-source"
cat "$TERMUX_PKG_BUILDER_DIR"/glutin-*.diff | patch -p1 -d "$TERMUX_PKG_SRCDIR/glutin-source"

cargo update
for dir in ./vendor/rustix*; do
if [[ -d "$dir/src/backend/libc/shm" && -d "$dir/src/backend/linux_raw/shm" ]]; then
rm -rf "$dir/src/backend/libc/shm/"*
cp "$dir/src/backend/linux_raw/shm/"* "$dir/src/backend/libc/shm/"
fi
done

rm -rf "$CARGO_HOME"/registry/src/index.crates.io-*/expat-sys-*
rm -rf "$CARGO_HOME"/registry/src/index.crates.io-*/freetype-sys-*
rm -rf "$CARGO_HOME"/registry/src/index.crates.io-*/rustix-*
rm -rf "$CARGO_HOME"/registry/src/index.crates.io-*/servo-fontconfig-sys-*
rm -rf "$CARGO_HOME"/registry/src/index.crates.io-*/x11rb-protocol-*
cargo fetch --target "${CARGO_TARGET_NAME}"
if grep -q '^\[patch\.crates-io\]' Cargo.toml; then
sed -i '/^\[patch.crates-io\]/,$d' Cargo.toml
fi

local crate
for crate in {{expat,freetype,servo-fontconfig}-sys,rustix,x11rb-protocol}; do
local patch="$TERMUX_PKG_BUILDER_DIR/${crate}.diff"
local dir
for dir in "$CARGO_HOME"/registry/src/index.crates.io-*/"${crate}"-*; do
local _crate_name
_crate_name=$(basename "$dir")
# shellcheck disable=SC2295
if [[ ! "${_crate_name#$crate-}" =~ ^[0-9] ]]; then
continue
fi
if [[ "$crate" == 'rustix' ]]; then
rm -rf "$dir"/src/backend/libc/shm/*
cp "$dir"/src/backend/linux_raw/shm/* "$dir"/src/backend/libc/shm/
fi
echo "Applying patch for '$crate'"
patch -p1 -d "$dir" < "${patch}"
done
local patch_lines="" patch_file crate dir
for patch_file in "$TERMUX_PKG_BUILDER_DIR"/*.vendor.diff; do
[[ -e "$patch_file" ]] || break
crate="$(basename "$patch_file" .vendor.diff)"
dir="./vendor/$crate"
if [[ ! -d "$dir" ]]; then
echo "No vendor dir for $crate"
exit 1
fi
sed "s|@TERMUX_PREFIX@|${TERMUX_PREFIX}|g" "$patch_file" | \
patch --fuzz=0 -p1 -d "$dir"
patch_lines="${patch_lines}${crate} = { path = \"$dir\" }\n"
done

if [[ -n "$patch_lines" ]]; then
printf "\n[patch.crates-io]\n$patch_lines" >> Cargo.toml
fi
}

termux_step_make() {
cargo build --jobs "$TERMUX_PKG_MAKE_PROCESSES" --target "$CARGO_TARGET_NAME" --release
cargo build \
--jobs "$TERMUX_PKG_MAKE_PROCESSES" \
--target "$CARGO_TARGET_NAME" \
--release
}

termux_step_make_install() {
install -Dm755 -t "$TERMUX_PREFIX/bin" "target/$CARGO_TARGET_NAME/release/alacritty"

# man pages
scdoc < extra/man/alacritty.1.scd | gzip -c > "$TERMUX_PREFIX/share/man/man1/alacritty.1.gz"
scdoc < extra/man/alacritty-msg.1.scd | gzip -c > "$TERMUX_PREFIX/share/man/man1/alacritty-msg.1.gz"
scdoc < extra/man/alacritty.5.scd | gzip -c > "$TERMUX_PREFIX/share/man/man5/alacritty.5.gz"
scdoc < extra/man/alacritty-bindings.5.scd | gzip -c > "$TERMUX_PREFIX/share/man/man5/alacritty-bindings.5.gz"
install -Dm755 -t "$TERMUX_PREFIX/bin" \
"target/$CARGO_TARGET_NAME/release/alacritty"

# shell completions
install -Dm644 extra/completions/_alacritty "$TERMUX_PREFIX/share/zsh/site-functions/_alacritty"
install -Dm644 extra/completions/alacritty.bash "$TERMUX_PREFIX/share/bash-completion/completions/alacritty.bash"
install -Dm644 extra/completions/alacritty.fish "$TERMUX_PREFIX/share/fish/vendor_completions.d/alacritty.fish"

# .desktop
install -Dm644 extra/linux/Alacritty.desktop "$TERMUX_PREFIX/share/applications/Alacritty.desktop"
}
scdoc < extra/man/alacritty.1.scd | gzip -c \
> "$TERMUX_PREFIX/share/man/man1/alacritty.1.gz"
scdoc < extra/man/alacritty-msg.1.scd | gzip -c \
> "$TERMUX_PREFIX/share/man/man1/alacritty-msg.1.gz"
scdoc < extra/man/alacritty.5.scd | gzip -c \
> "$TERMUX_PREFIX/share/man/man5/alacritty.5.gz"
scdoc < extra/man/alacritty-bindings.5.scd | gzip -c \
> "$TERMUX_PREFIX/share/man/man5/alacritty-bindings.5.gz"

termux_step_post_massage() {
rm -rf "$CARGO_HOME"/registry/src/index.crates.io-*/expat-sys-*
rm -rf "$CARGO_HOME"/registry/src/index.crates.io-*/freetype-sys-*
rm -rf "$CARGO_HOME"/registry/src/index.crates.io-*/rustix-*
rm -rf "$CARGO_HOME"/registry/src/index.crates.io-*/servo-fontconfig-sys-*
rm -rf "$CARGO_HOME"/registry/src/index.crates.io-*/x11rb-protocol-*
install -Dm644 extra/completions/_alacritty \
"$TERMUX_PREFIX/share/zsh/site-functions/_alacritty"
install -Dm644 extra/completions/alacritty.bash \
"$TERMUX_PREFIX/share/bash-completion/completions/alacritty.bash"
install -Dm644 extra/completions/alacritty.fish \
"$TERMUX_PREFIX/share/fish/vendor_completions.d/alacritty.fish"
install -Dm644 extra/linux/Alacritty.desktop \
"$TERMUX_PREFIX/share/applications/Alacritty.desktop"
install -Dm644 extra/logo/alacritty-term.svg \
"$TERMUX_PREFIX/share/icons/hicolor/scalable/apps/Alacritty.svg"
}
62 changes: 62 additions & 0 deletions x11-packages/alacritty/copypasta.vendor.diff
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
diff --git b/src/lib.rs.orig a/src/lib.rs
index 092a23c5..e4495354 100644
--- b/src/lib.rs.orig
+++ a/src/lib.rs
@@ -20,7 +20,6 @@ pub use crate::common::ClipboardProvider;
unix,
not(any(
target_os = "macos",
- target_os = "android",
target_os = "ios",
target_os = "emscripten"
))
@@ -31,7 +30,6 @@ pub mod wayland_clipboard;
unix,
not(any(
target_os = "macos",
- target_os = "android",
target_os = "ios",
target_os = "emscripten"
))
@@ -51,7 +49,6 @@ pub mod nop_clipboard;
unix,
not(any(
target_os = "macos",
- target_os = "android",
target_os = "ios",
target_os = "emscripten"
))
@@ -62,15 +59,12 @@ pub type ClipboardContext = x11_clipboard::X11ClipboardContext;
pub type ClipboardContext = windows_clipboard::WindowsClipboardContext;
#[cfg(target_os = "macos")]
pub type ClipboardContext = osx_clipboard::OSXClipboardContext;
-#[cfg(target_os = "android")]
-pub type ClipboardContext = nop_clipboard::NopClipboardContext; // TODO: implement AndroidClipboardContext
#[cfg(target_os = "ios")]
pub type ClipboardContext = nop_clipboard::NopClipboardContext; // TODO: implement IOSClipboardContext
#[cfg(not(any(
unix,
windows,
target_os = "macos",
- target_os = "android",
target_os = "ios",
target_os = "emscripten"
)))]
diff --git b/Cargo.toml.orig a/Cargo.toml
index 77d8d97bf1..e28dac9817 100644
--- b/Cargo.toml.orig
+++ a/Cargo.toml
@@ -31,11 +31,11 @@ default = [
wayland = ["smithay-clipboard"]
x11 = ["x11-clipboard"]

-[target."cfg(all(unix, not(any(target_os=\"macos\", target_os=\"android\", target_os=\"ios\", target_os=\"emscripten\"))))".dependencies.smithay-clipboard]
+[target."cfg(all(unix, not(any(target_os=\"macos\", target_os=\"dummy\", target_os=\"ios\", target_os=\"emscripten\"))))".dependencies.smithay-clipboard]
version = "0.7.0"
optional = true

-[target."cfg(all(unix, not(any(target_os=\"macos\", target_os=\"android\", target_os=\"ios\", target_os=\"emscripten\"))))".dependencies.x11-clipboard]
+[target."cfg(all(unix, not(any(target_os=\"macos\", target_os=\"dummy\", target_os=\"ios\", target_os=\"emscripten\"))))".dependencies.x11-clipboard]
version = "0.9.1"
optional = true

11 changes: 0 additions & 11 deletions x11-packages/alacritty/expat-sys.diff

This file was deleted.

76 changes: 0 additions & 76 deletions x11-packages/alacritty/glutin-treat-android-as-linux.diff

This file was deleted.

Loading