57 lines
1.6 KiB
Bash
57 lines
1.6 KiB
Bash
#!/usr/bin/env bash
|
|
#
|
|
# Minimal fallback: assemble a .deb directly with dpkg-deb, WITHOUT debhelper.
|
|
# Handy for quick builds on a bare Debian/Ubuntu system:
|
|
#
|
|
# sudo apt install build-essential cmake
|
|
# ./pack-deb.sh
|
|
#
|
|
# Produces ./dist/hatsune-miku-shoshitsu_0.1.0-1_amd64.deb
|
|
#
|
|
set -euo pipefail
|
|
cd "$(dirname "$0")"
|
|
|
|
PKG="hatsune-miku-shoshitsu"
|
|
VERSION="0.1.0"
|
|
ARCH="amd64" # adjust to your target architecture (e.g. arm64)
|
|
|
|
for tool in cmake dpkg-deb; do
|
|
command -v "$tool" >/dev/null 2>&1 || {
|
|
echo "error: '$tool' not found. Install build tools first." >&2
|
|
exit 1
|
|
}
|
|
done
|
|
|
|
rm -rf build staging dist
|
|
mkdir -p dist
|
|
|
|
# 1) configure + build
|
|
cmake -S . -B build -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=/usr
|
|
cmake --build build -j
|
|
|
|
# 2) install into a staging tree (simulates /usr on the target system)
|
|
DESTDIR="$(pwd)/staging" cmake --install build
|
|
|
|
# 3) write the binary-package control file
|
|
mkdir -p "staging/DEBIAN"
|
|
cat > "staging/DEBIAN/control" <<EOF
|
|
Package: $PKG
|
|
Version: ${VERSION}-1
|
|
Section: utils
|
|
Priority: optional
|
|
Architecture: $ARCH
|
|
Maintainer: Your Name <you@example.com>
|
|
Depends: libc6
|
|
Description: Hatsune Miku's Shoshitsu in Terminal
|
|
A terminal-based program about Hatsune Miku's Shoshitsu (loss).
|
|
Replace this placeholder description before releasing.
|
|
EOF
|
|
|
|
# 4) pack it (--root-owner-group makes every file owned by root:root,
|
|
# as Debian packages require; available since dpkg 1.19 / Debian 10)
|
|
dpkg-deb --build --root-owner-group "staging" "dist/${PKG}_${VERSION}-1_${ARCH}.deb"
|
|
|
|
echo
|
|
echo "Done. Debian package built:"
|
|
ls -lh "dist/${PKG}_${VERSION}-1_${ARCH}.deb"
|