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
This commit is contained in:
Maksim Bondarenkov
2025-02-09 07:32:42 +03:00
committed by GitHub
parent cc10df51b8
commit 041d93e8cc
2 changed files with 5 additions and 28 deletions

View File

@@ -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
}

View File

@@ -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
]