From 041d93e8cc0c07522300fa01804b93c71ffbd25c Mon Sep 17 00:00:00 2001 From: Maksim Bondarenkov <119937608+ognevny@users.noreply.github.com> Date: Sun, 9 Feb 2025 07:32:42 +0300 Subject: [PATCH] zed: set RUSTFLAGS via env variable turns out `-fuse-ld=lld` required for non-clang environments is not applied correctly. use RUSTFLAGS instead of patch --- mingw-w64-zed/PKGBUILD | 14 +++++--------- mingw-w64-zed/zed-set-rustflags.patch | 19 ------------------- 2 files changed, 5 insertions(+), 28 deletions(-) delete mode 100644 mingw-w64-zed/zed-set-rustflags.patch diff --git a/mingw-w64-zed/PKGBUILD b/mingw-w64-zed/PKGBUILD index 6a315b0d9d..0d578d723c 100644 --- a/mingw-w64-zed/PKGBUILD +++ b/mingw-w64-zed/PKGBUILD @@ -4,7 +4,7 @@ _realname=zed pkgbase=mingw-w64-${_realname} pkgname="${MINGW_PACKAGE_PREFIX}-${_realname}" pkgver=0.172.10 -pkgrel=1 +pkgrel=2 pkgdesc="A high-performance, multiplayer code editor (mingw-w64)" arch=('any') mingw_arch=('mingw64' 'ucrt64' 'clang64') @@ -40,12 +40,10 @@ fi source=("git+${msys2_repository_url}.git#tag=v${pkgver}" "zstd-sys.tar.gz::https://crates.io/api/v1/crates/zstd-sys/2.0.13+zstd.1.5.6/download" "zed-dont-vendor-cargo-about.patch" - "zed-set-rustflags.patch" "zstd-sys-remove-statik.patch") sha256sums=('7241cd752275dffad8975fb4fad7c50d7407dbaad4bcae8e3bad13cda9d371bc' '38ff0f21cfee8f97d94cef41359e0c89aa6113028ab0291aa8ca0038995a95aa' 'b126b7a9e3cc8d3d68c49dbfc184d54691b10172dbfd3272d4c2f43424cfca5b' - '86bad9a2bb0356bdd820a6ac73ec3f736f784b4d487af9a8f6bdc0c3e5b309d1' '48f4900ceb02d3aaf9a1020f33d56629156e96759f456c0e7ca18bfcf910767b') prepare() { @@ -55,10 +53,6 @@ prepare() { # use system cargo about to generate license file patch -Np1 -i "../zed-dont-vendor-cargo-about.patch" - # apply `-Cforce-frame-pointers=yes` in .cargo/config.toml instead of env var to apply other - # compilation flags; remove +crt-static which is added for webrtc; use lld linker to fix keyboard - # shortcuts https://github.com/msys2/MINGW-packages/issues/22071 - patch -Np1 -i "../zed-set-rustflags.patch" # link system deps dynamically patch -d "../zstd-sys-2.0.13+zstd.1.5.6" -i "../zstd-sys-remove-statik.patch" # use patched *-sys crates @@ -93,8 +87,10 @@ build() { export ZED_UPDATE_EXPLANATION='Updates are handled by pacman' export CARGO_PROFILE_RELEASE_DEBUG=0 export RELEASE_VERSION="${pkgver} (Rev${pkgrel}, Built by MSYS2 project)" - # apply RUSTFLAGS from .cargo/config.toml instead of env var - unset RUSTFLAGS + # should be synced with .cargo/config.toml. use lld linker to fix keyboard shortcuts + # https://github.com/msys2/MINGW-packages/issues/22071 + export RUSTFLAGS="$RUSTFLAGS -C link-arg=-fuse-ld=lld -C symbol-mangling-version=v0 + --cfg tokio_unstable --cfg windows_slim_errors" cargo build --release --frozen -p zed } diff --git a/mingw-w64-zed/zed-set-rustflags.patch b/mingw-w64-zed/zed-set-rustflags.patch deleted file mode 100644 index 5a7d95c9c0..0000000000 --- a/mingw-w64-zed/zed-set-rustflags.patch +++ /dev/null @@ -1,19 +0,0 @@ -diff --git a/.cargo/config.toml b/.cargo/config.toml -index 07cbc23195..fcc5fd7b3d 100644 ---- a/.cargo/config.toml -+++ b/.cargo/config.toml -@@ -1,6 +1,6 @@ - [build] - # v0 mangling scheme provides more detailed backtraces around closures --rustflags = ["-C", "symbol-mangling-version=v0", "--cfg", "tokio_unstable"] -+rustflags = ["-C", "symbol-mangling-version=v0", "--cfg", "tokio_unstable", "-Cforce-frame-pointers=yes", "-Clink-arg=-fuse-ld=lld"] - - [alias] - xtask = "run --package xtask --" -@@ -23,6 +23,4 @@ rustflags = ["-C", "link-args=-Objc -all_load"] - rustflags = [ - "--cfg", - "windows_slim_errors", # This cfg will reduce the size of `windows::core::Error` from 16 bytes to 4 bytes -- "-C", -- "target-feature=+crt-static", # This fixes the linking issue when compiling livekit on Windows - ]