nirc-rs/packaging/build-deb.sh

31 lines
1.1 KiB
Bash
Executable File

#!/bin/bash
# Build a .deb package for nirc-rs
set -euo pipefail
ROOT="$(cd "$(dirname "$0")/.." && pwd)"
DEBIAN="$ROOT/debian"
VERSION="0.5.0"
ARCH="$(dpkg --print-architecture 2>/dev/null || echo amd64)"
PKG="nirc_${VERSION}_${ARCH}.deb"
echo "Building nirc $VERSION for $ARCH..."
# Build the binary
cargo build --release --locked 2>&1
echo "Build complete."
# Populate staging tree
cp target/release/nirc "$DEBIAN/usr/local/bin/nirc"
cp man/man1/nirc.1 "$DEBIAN/usr/share/man/man1/nirc.1"
gzip -9 "$DEBIAN/usr/share/man/man1/nirc.1"
cp completions/nirc.bash "$DEBIAN/usr/share/bash-completion/completions/nirc"
cp completions/nirc.zsh "$DEBIAN/usr/share/zsh/vendor-completions/_nirc"
cp completions/nirc.fish "$DEBIAN/usr/share/fish/vendor_completions.d/nirc.fish"
cp README.md "$DEBIAN/usr/share/doc/nirc/README.md"
cp ROADMAP.md "$DEBIAN/usr/share/doc/nirc/ROADMAP.md"
cp LICENSE "$DEBIAN/usr/share/doc/nirc/copyright" 2>/dev/null || true
gzip -9 "$DEBIAN/usr/share/doc/nirc/README.md"
gzip -9 "$DEBIAN/usr/share/doc/nirc/ROADMAP.md"
# Build the .deb
dpkg-deb --build "$DEBIAN" "$ROOT/$PKG"
echo "Package: $ROOT/$PKG"