Support cross Windows release packaging
ci / test (push) Has been cancelled
ci / fuzz-smoke (push) Has been cancelled
ci / windows-client (push) Has been cancelled
ci / package-release (linux-x86_64, ubuntu-latest) (push) Has been cancelled
ci / package-release (macos-aarch64, macos-14) (push) Has been cancelled
ci / package-release (macos-x86_64, macos-13) (push) Has been cancelled
ci / package-release (windows-x86_64, windows-latest) (push) Has been cancelled
ci / remote-bench (push) Has been cancelled

This commit is contained in:
DuProcess
2026-06-22 17:19:16 -04:00
parent f9a378a9cd
commit 60d73df5be
2 changed files with 38 additions and 10 deletions
+31 -9
View File
@@ -26,8 +26,16 @@ normalize_arch() {
esac
}
os="$(normalize_os)"
arch="$(normalize_arch)"
host_os="$(normalize_os)"
os="${DOSH_PACKAGE_OS:-$host_os}"
arch="${DOSH_PACKAGE_ARCH:-$(normalize_arch)}"
target="${DOSH_PACKAGE_TARGET:-}"
if [ -z "$target" ] && [ "$os" = "windows" ] && [ "$host_os" != "windows" ]; then
case "$arch" in
x86_64) target="x86_64-pc-windows-gnu" ;;
*) echo "set DOSH_PACKAGE_TARGET for windows/$arch" >&2; exit 1 ;;
esac
fi
if [ "$os" = "windows" ]; then
artifact="dosh-$os-$arch.zip"
versioned_artifact="dosh-$version-$os-$arch.zip"
@@ -38,19 +46,33 @@ fi
stage="$out_dir/stage/dosh"
write_versioned="${DOSH_PACKAGE_VERSIONED:-0}"
if [ "$os" = "windows" ]; then
cargo build --release --bin dosh-client --bin dosh-bench
if [ -n "$target" ]; then
release_dir="target/$target/release"
else
cargo build --release
release_dir="target/release"
fi
if [ "$os" = "windows" ]; then
if [ -n "$target" ]; then
cargo build --release --target "$target" --bin dosh-client --bin dosh-bench
else
cargo build --release --bin dosh-client --bin dosh-bench
fi
else
if [ -n "$target" ]; then
cargo build --release --target "$target"
else
cargo build --release
fi
fi
rm -rf "$stage"
mkdir -p "$stage/bin" "$out_dir"
for bin in dosh-client dosh-server dosh-auth dosh-bench; do
if [ -f "target/release/$bin" ]; then
install -m 0755 "target/release/$bin" "$stage/bin/$bin"
elif [ -f "target/release/$bin.exe" ]; then
install -m 0755 "target/release/$bin.exe" "$stage/bin/$bin.exe"
if [ -f "$release_dir/$bin" ]; then
install -m 0755 "$release_dir/$bin" "$stage/bin/$bin"
elif [ -f "$release_dir/$bin.exe" ]; then
install -m 0755 "$release_dir/$bin.exe" "$stage/bin/$bin.exe"
fi
done
if [ -f "$stage/bin/dosh-client.exe" ]; then