Skip to content

armgit / zed

Public Imported from GitHub
0

Code at the speed of thought – Zed is a high-performance, multiplayer code editor from the creators of Atom and Tree-sitter.

linux scripts: Respect `$CARGO_TARGET_DIR` (#13830)

Chinmay Dalal1260b52c8217
diff --git a/script/bundle-linux b/script/bundle-linux
index cc4ce9fa1bd..f06d2497b3c 100755
--- a/script/bundle-linux
+++ b/script/bundle-linux
@@ -26,6 +26,7 @@ done
export ZED_BUNDLE=true
channel=$(<crates/zed/RELEASE_CHANNEL)
+target_dir="${CARGO_TARGET_DIR:-target}"
version="$(script/get-crate-version zed)"
# Set RELEASE_VERSION so it's compiled into GPUI and it knows about the version.
@@ -43,8 +44,8 @@ cargo build --release --target "${target_triple}" --package zed --package cli
# Strip the binary of all debug symbols
# Later, we probably want to do something like this: https://github.com/GabrielMajeri/separate-symbols
-strip --strip-debug "target/${target_triple}/release/zed"
-strip --strip-debug "target/${target_triple}/release/cli"
+strip --strip-debug "${target_dir}/${target_triple}/release/zed"
+strip --strip-debug "${target_dir}/${target_triple}/release/cli"
suffix=""
if [ "$channel" != "stable" ]; then
@@ -58,12 +59,12 @@ zed_dir="${temp_dir}/zed$suffix.app"
# Binary
mkdir -p "${zed_dir}/bin" "${zed_dir}/libexec"
-cp "target/${target_triple}/release/zed" "${zed_dir}/libexec/zed-editor"
-cp "target/${target_triple}/release/cli" "${zed_dir}/bin/zed"
+cp "${target_dir}/${target_triple}/release/zed" "${zed_dir}/libexec/zed-editor"
+cp "${target_dir}/${target_triple}/release/cli" "${zed_dir}/bin/zed"
# Libs
find_libs() {
- ldd target/${target_triple}/release/zed |\
+ ldd ${target_dir}/${target_triple}/release/zed |\
cut -d' ' -f3 |\
grep -v '\<\(libstdc++.so\|libc.so\|libgcc_s.so\|libm.so\|libpthread.so\|libdl.so\)'
}
@@ -109,5 +110,5 @@ fi
rm -rf "${archive}"
remove_match="zed(-[a-zA-Z0-9]+)?-linux-$(uname -m)\.tar\.gz"
-ls target/release | grep -E ${remove_match} | xargs -d "\n" -I {} rm -f target/release/{} || true
-tar -czvf target/release/$archive -C ${temp_dir} "zed$suffix.app"
+ls "${target_dir}/release" | grep -E ${remove_match} | xargs -d "\n" -I {} rm -f "${target_dir}/release/{}" || true
+tar -czvf "${target_dir}/release/$archive" -C ${temp_dir} "zed$suffix.app"
diff --git a/script/install-linux b/script/install-linux
index 3e9c0ae4bed..72fd8eba2cc 100755
--- a/script/install-linux
+++ b/script/install-linux
@@ -22,5 +22,5 @@ if [[ "$ZED_CHANNEL" == "dev" ]]; then
else
archive="zed-${target}.tar.gz"
fi
-export ZED_BUNDLE_PATH="target/release/${archive}"
+export ZED_BUNDLE_PATH="${CARGO_TARGET_DIR:-target}/release/${archive}"
script/install.sh