Lightweight native Discord client for Windows, Linux and macOS, written in Rust. No Electron, no browser engine.
Rust desktop-appdiscorddiscord-clienteguielectron-alternativelightweightlinuxmacosnative-apprustwindows
#!/bin/sh
# Makes dist/RustCord-<version>-macos-universal.dmg (RustCord.app for Apple
# Silicon and Intel Macs, next to a link to Applications) and its .sha256.
# Run on a Mac from the repository root, after
# cargo build --release -p rustcord --target aarch64-apple-darwin
# cargo build --release -p rustcord --target x86_64-apple-darwin
# or give the two programs: package.sh <arm64 rustcord> <x86_64 rustcord>.
set -eu
version=$(sed -n 's/^version = "\(.*\)"/\1/p' Cargo.toml | head -n 1)
arm=${1:-target/aarch64-apple-darwin/release/rustcord}
intel=${2:-target/x86_64-apple-darwin/release/rustcord}
name="RustCord-$version-macos-universal"
stage="dist/macos"
app="$stage/RustCord.app"
rm -rf "$stage"
mkdir -p "$app/Contents/MacOS" "$app/Contents/Resources"
lipo -create -output "$app/Contents/MacOS/rustcord" "$arm" "$intel"
chmod 755 "$app/Contents/MacOS/rustcord"
sed "s/@VERSION@/$version/g" packaging/macos/Info.plist > "$app/Contents/Info.plist"
cp LICENSE THIRD_PARTY_NOTICES.md "$app/Contents/Resources/"
# The icon in the sizes the Finder and the Dock ask for, up to the 256 px
# picture there is.
iconset="$stage/RustCord.iconset"
mkdir -p "$iconset"
for size in 16 32 128 256; do
sips -z "$size" "$size" apps/rustcord/assets/icon-256.png --out "$iconset/icon_${size}x${size}.png" >/dev/null
done
for size in 16 32 128; do
sips -z "$((size * 2))" "$((size * 2))" apps/rustcord/assets/icon-256.png --out "$iconset/icon_${size}x${size}@2x.png" >/dev/null
done
iconutil -c icns "$iconset" -o "$app/Contents/Resources/RustCord.icns"
rm -rf "$iconset"
# Signed ad hoc (Apple Silicon runs nothing unsigned), not with a Developer
# ID: the first start needs "Open Anyway", see the README.
codesign --force --sign - "$app"
ln -s /Applications "$stage/Applications"
rm -f "dist/$name.dmg"
# hdiutil now and then finds the disk image busy on GitHub's Macs: try again.
for attempt in 1 2 3; do
hdiutil create -volname RustCord -srcfolder "$stage" -fs HFS+ -format UDZO "dist/$name.dmg" >/dev/null && break
echo "hdiutil failed (attempt $attempt), trying again"
sleep 10
done
[ -f "dist/$name.dmg" ]
(cd dist && shasum -a 256 "$name.dmg" > "$name.dmg.sha256")
rm -rf "$stage"
echo "dist/$name.dmg"