diff --git a/Makefile b/Makefile index 7026533..46d7173 100644 --- a/Makefile +++ b/Makefile @@ -10,7 +10,7 @@ fmt: cargo fmt install: - sh packaging/install.sh + sh install.sh --from-current package-release: sh scripts/package-release.sh diff --git a/packaging/install.sh b/packaging/install.sh deleted file mode 100755 index 49723e1..0000000 --- a/packaging/install.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/usr/bin/env sh -set -eu - -repo_root="$(CDPATH= cd -- "$(dirname -- "$0")/.." && pwd)" -cd "$repo_root" -exec sh ./install.sh --from-current "$@" diff --git a/scripts/package-release.sh b/scripts/package-release.sh index 48a8074..9de4e6e 100755 --- a/scripts/package-release.sh +++ b/scripts/package-release.sh @@ -36,6 +36,7 @@ else versioned_artifact="dosh-$version-$os-$arch.tar.gz" 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 @@ -57,6 +58,30 @@ if [ -f "$stage/bin/dosh-client.exe" ]; then elif [ -f "$stage/bin/dosh-client" ]; then cp "$stage/bin/dosh-client" "$stage/bin/dosh" fi + +strip_bin() { + file="$1" + [ -f "$file" ] || return 0 + case "$file" in + *.exe) + if command -v x86_64-w64-mingw32-strip >/dev/null 2>&1; then + x86_64-w64-mingw32-strip "$file" 2>/dev/null || true + elif command -v strip >/dev/null 2>&1; then + strip "$file" 2>/dev/null || true + fi + ;; + *) + if command -v strip >/dev/null 2>&1; then + strip "$file" 2>/dev/null || true + fi + ;; + esac +} + +for bin in "$stage"/bin/*; do + strip_bin "$bin" +done + printf '%s\n' "$version" >"$stage/VERSION" if [ "$os" = "windows" ]; then @@ -71,8 +96,6 @@ if [ "$os" = "windows" ]; then else tar -C "$out_dir/stage" -czf "$out_dir/$artifact" dosh fi -cp "$out_dir/$artifact" "$out_dir/$versioned_artifact" - write_sha256() { file="$1" if command -v sha256sum >/dev/null 2>&1; then @@ -85,12 +108,21 @@ write_sha256() { } write_sha256 "$out_dir/$artifact" -write_sha256 "$out_dir/$versioned_artifact" +if [ "$write_versioned" = "1" ]; then + cp "$out_dir/$artifact" "$out_dir/$versioned_artifact" + write_sha256 "$out_dir/$versioned_artifact" +fi + +printf 'Wrote:\n' cat <