rust: packaging (Linux desktop entry, macOS bundle), cargo release script with update manifests, CI
This commit is contained in:
Executable
+14
@@ -0,0 +1,14 @@
|
||||
#!/bin/sh
|
||||
# Install Nexus Terminal for the current user so it appears in the app launcher.
|
||||
# Usage: rust/packaging/linux/install.sh [path/to/nexus-terminal] (default: target/release/nexus-terminal)
|
||||
set -eu
|
||||
HERE=$(cd "$(dirname "$0")" && pwd)
|
||||
BIN=${1:-"$HERE/../../target/release/nexus-terminal"}
|
||||
PREFIX=${XDG_DATA_HOME:-$HOME/.local/share}
|
||||
install -Dm755 "$BIN" "$HOME/.local/bin/nexus-terminal"
|
||||
install -Dm644 "$HERE/nexus-terminal.desktop" "$PREFIX/applications/nexus-terminal.desktop"
|
||||
install -Dm644 "$HERE/../../app/assets/icon/icon-256.png" "$PREFIX/icons/hicolor/256x256/apps/nexus-terminal.png"
|
||||
install -Dm644 "$HERE/../../app/assets/icon/icon-512.png" "$PREFIX/icons/hicolor/512x512/apps/nexus-terminal.png"
|
||||
update-desktop-database "$PREFIX/applications" 2>/dev/null || true
|
||||
gtk-update-icon-cache -f -t "$PREFIX/icons/hicolor" 2>/dev/null || true
|
||||
echo "installed: ~/.local/bin/nexus-terminal (make sure ~/.local/bin is on PATH)"
|
||||
@@ -0,0 +1,11 @@
|
||||
[Desktop Entry]
|
||||
Type=Application
|
||||
Name=Nexus Terminal
|
||||
GenericName=Terminal and Remote Connections
|
||||
Comment=SSH, Telnet, RAW TCP, Serial, VNC, IRC and GitHub sessions in one window
|
||||
Exec=nexus-terminal
|
||||
Icon=nexus-terminal
|
||||
Terminal=false
|
||||
Categories=System;TerminalEmulator;Network;RemoteAccess;
|
||||
Keywords=ssh;telnet;serial;sftp;vnc;irc;terminal;
|
||||
StartupWMClass=nexus-terminal
|
||||
@@ -0,0 +1,36 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>CFBundleName</key>
|
||||
<string>Nexus Terminal</string>
|
||||
<key>CFBundleDisplayName</key>
|
||||
<string>Nexus Terminal</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>com.andydixon.nexusterminal</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
<string>NexusTerminal</string>
|
||||
<key>CFBundleIconFile</key>
|
||||
<string>NexusTerminal</string>
|
||||
<key>CFBundlePackageType</key>
|
||||
<string>APPL</string>
|
||||
<key>CFBundleShortVersionString</key>
|
||||
<string>__VERSION__</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>__VERSION__</string>
|
||||
<key>CFBundleInfoDictionaryVersion</key>
|
||||
<string>6.0</string>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>en</string>
|
||||
<key>LSApplicationCategoryType</key>
|
||||
<string>public.app-category.developer-tools</string>
|
||||
<key>LSMinimumSystemVersion</key>
|
||||
<string>11.0</string>
|
||||
<key>NSHighResolutionCapable</key>
|
||||
<true/>
|
||||
<key>NSSupportsAutomaticGraphicsSwitching</key>
|
||||
<true/>
|
||||
<key>NSHumanReadableCopyright</key>
|
||||
<string>© Andy Dixon</string>
|
||||
</dict>
|
||||
</plist>
|
||||
Executable
+62
@@ -0,0 +1,62 @@
|
||||
#!/bin/sh
|
||||
# Build NexusTerminal.app, a macOS application bundle. Run on a Mac with Xcode command-line tools:
|
||||
#
|
||||
# rust/packaging/macos/build-app.sh # universal (Apple Silicon + Intel) if both
|
||||
# # targets are installed, else this Mac's arch
|
||||
# rust/packaging/macos/build-app.sh --dmg # also wrap it in a .dmg
|
||||
#
|
||||
# Output: rust/target/macos/NexusTerminal.app (and NexusTerminal-<version>.dmg).
|
||||
# Set NEXUS_BIN=/path/to/binary to bundle an existing build instead of compiling.
|
||||
set -eu
|
||||
HERE=$(cd "$(dirname "$0")" && pwd)
|
||||
ROOT=$(cd "$HERE/../.." && pwd)
|
||||
cd "$ROOT"
|
||||
VERSION=${NEXUS_VERSION:-$(sed -n 's/^version = "\(.*\)"/\1/p' Cargo.toml | head -1)}
|
||||
OUT="$ROOT/target/macos"
|
||||
APP="$OUT/NexusTerminal.app"
|
||||
|
||||
if [ -n "${NEXUS_BIN:-}" ]; then
|
||||
BIN="$NEXUS_BIN"
|
||||
else
|
||||
targets=""
|
||||
for t in aarch64-apple-darwin x86_64-apple-darwin; do
|
||||
if rustup target list --installed 2>/dev/null | grep -qx "$t"; then targets="$targets $t"; fi
|
||||
done
|
||||
[ -n "$targets" ] || targets=" $(rustc -vV | sed -n 's/^host: //p')"
|
||||
bins=""
|
||||
for t in $targets; do
|
||||
echo "building $t"
|
||||
cargo build --release -p nexus --target "$t"
|
||||
bins="$bins target/$t/release/nexus-terminal"
|
||||
done
|
||||
mkdir -p "$OUT"
|
||||
set -- $bins
|
||||
if [ $# -gt 1 ]; then
|
||||
lipo -create "$@" -output "$OUT/nexus-terminal-universal"
|
||||
BIN="$OUT/nexus-terminal-universal"
|
||||
else
|
||||
BIN="$1"
|
||||
fi
|
||||
fi
|
||||
|
||||
rm -rf "$APP"
|
||||
mkdir -p "$APP/Contents/MacOS" "$APP/Contents/Resources"
|
||||
cp "$BIN" "$APP/Contents/MacOS/NexusTerminal"
|
||||
chmod +x "$APP/Contents/MacOS/NexusTerminal"
|
||||
cp "$HERE/NexusTerminal.icns" "$APP/Contents/Resources/NexusTerminal.icns"
|
||||
sed "s/__VERSION__/$VERSION/g" "$HERE/Info.plist" > "$APP/Contents/Info.plist"
|
||||
printf 'APPL????' > "$APP/Contents/PkgInfo"
|
||||
|
||||
if command -v plutil >/dev/null; then plutil -lint "$APP/Contents/Info.plist"; fi
|
||||
# Ad-hoc sign so Apple Silicon runs it. For distribution, sign with a Developer ID and notarize:
|
||||
# codesign --force --options runtime --sign "Developer ID Application: …" NexusTerminal.app
|
||||
# xcrun notarytool submit … --wait && xcrun stapler staple NexusTerminal.app
|
||||
if command -v codesign >/dev/null; then codesign --force --deep --sign - "$APP"; fi
|
||||
|
||||
if [ "${1:-}" = "--dmg" ] && command -v hdiutil >/dev/null; then
|
||||
DMG="$OUT/NexusTerminal-$VERSION.dmg"
|
||||
rm -f "$DMG"
|
||||
hdiutil create -volname "Nexus Terminal" -srcfolder "$APP" -ov -format UDZO "$DMG"
|
||||
echo "built $DMG"
|
||||
fi
|
||||
echo "built $APP"
|
||||
Reference in New Issue
Block a user