initial commit: make basic debian .deb package compile structure
This commit is contained in:
+18
@@ -0,0 +1,18 @@
|
||||
# Build output
|
||||
build/
|
||||
staging/
|
||||
dist/
|
||||
|
||||
# Generated Debian artifacts
|
||||
*.deb
|
||||
*.dsc
|
||||
*.changes
|
||||
*.buildinfo
|
||||
|
||||
# Visual Studio
|
||||
.vs/
|
||||
|
||||
# CMake
|
||||
CMakeCache.txt
|
||||
CMakeFiles/
|
||||
cmake_install.cmake
|
||||
@@ -0,0 +1,14 @@
|
||||
cmake_minimum_required(VERSION 3.16)
|
||||
|
||||
project(hatsune-miku-shoshitsu
|
||||
VERSION 0.1.0
|
||||
LANGUAGES CXX)
|
||||
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
|
||||
add_executable(hatsune-miku-shoshitsu main.cpp)
|
||||
|
||||
# Installed to /usr/bin — the Debian packaging relies on this rule.
|
||||
install(TARGETS hatsune-miku-shoshitsu
|
||||
RUNTIME DESTINATION bin)
|
||||
@@ -0,0 +1,69 @@
|
||||
# Hatsune Miku's Shoshitsu in Terminal
|
||||
|
||||
A C++ program that runs in the terminal, packaged for Debian-based Linux
|
||||
distributions (Debian, Ubuntu, Linux Mint, Pop!_OS, ...).
|
||||
|
||||
## Project layout
|
||||
|
||||
```
|
||||
main.cpp the program (placeholder — replace with your code)
|
||||
CMakeLists.txt CMake build (used by both Windows and Linux builds)
|
||||
debian/ Debian source-package structure
|
||||
control package metadata (name, version, deps, description)
|
||||
changelog version history for the package
|
||||
copyright license/copyright info
|
||||
rules debhelper build rules (runs CMake, installs files)
|
||||
compat debhelper compatibility level (13)
|
||||
source/format 3.0 (quilt)
|
||||
install which built files go into the package
|
||||
build-deb.sh full .deb build via debhelper (recommended)
|
||||
pack-deb.sh minimal .deb build via dpkg-deb (no debhelper)
|
||||
```
|
||||
|
||||
## Building the .deb
|
||||
|
||||
The package must be built **on Debian-family Linux** (or in WSL2 / a Docker
|
||||
container). Build it with debhelper (recommended):
|
||||
|
||||
```sh
|
||||
sudo apt install build-essential cmake debhelper
|
||||
./build-deb.sh
|
||||
```
|
||||
|
||||
or, if you don't want debhelper, with the minimal script:
|
||||
|
||||
```sh
|
||||
sudo apt install build-essential cmake
|
||||
./pack-deb.sh
|
||||
```
|
||||
|
||||
Both drop a `.deb` file into `./dist/`.
|
||||
|
||||
## Installing the package
|
||||
|
||||
```sh
|
||||
sudo apt install ./dist/hatsune-miku-shoshitsu_*.deb
|
||||
# or
|
||||
sudo dpkg -i ./dist/hatsune-miku-shoshitsu_*.deb
|
||||
```
|
||||
|
||||
The binary is installed to `/usr/bin/hatsune-miku-shoshitsu`, so run it with:
|
||||
|
||||
```sh
|
||||
hatsune-miku-shoshitsu
|
||||
```
|
||||
|
||||
To uninstall:
|
||||
|
||||
```sh
|
||||
sudo apt remove hatsune-miku-shoshitsu
|
||||
```
|
||||
|
||||
## Customizing before release
|
||||
|
||||
- `debian/control` — set a real `Maintainer` and a real `Description`.
|
||||
- `debian/changelog` — bump the version and add your own entry.
|
||||
- `debian/copyright` — pick the license this project is actually under.
|
||||
- `main.cpp` — replace the placeholder with the real program.
|
||||
- `CMakeLists.txt` — if you add more `.cpp` files, list them in
|
||||
`add_executable(...)`.
|
||||
@@ -0,0 +1,42 @@
|
||||
#!/usr/bin/env bash
|
||||
#
|
||||
# Build the project and pack it into a .deb using the standard Debian
|
||||
# toolchain (debhelper). Run this on a Debian-family system, e.g. Debian,
|
||||
# Ubuntu, or in WSL2 / a Docker container:
|
||||
#
|
||||
# sudo apt install build-essential cmake debhelper
|
||||
# ./build-deb.sh
|
||||
#
|
||||
# The resulting package lands in ./dist/ and can be installed with:
|
||||
# sudo apt install ./dist/hatsune-miku-shoshitsu_*.deb
|
||||
#
|
||||
set -euo pipefail
|
||||
cd "$(dirname "$0")"
|
||||
|
||||
# --- sanity checks ---------------------------------------------------------
|
||||
for tool in dpkg-buildpackage dpkg-deb cmake; do
|
||||
command -v "$tool" >/dev/null 2>&1 || {
|
||||
echo "error: '$tool' not found." >&2
|
||||
echo " Install the build tools first:" >&2
|
||||
echo " sudo apt install build-essential cmake debhelper" >&2
|
||||
exit 1
|
||||
}
|
||||
done
|
||||
|
||||
# --- build the binary .deb -------------------------------------------------
|
||||
# -us don't sign the source
|
||||
# -uc don't sign the .changes file
|
||||
# -b build a binary package only (no upstream source tarball needed)
|
||||
# -d don't verify Build-Depends (we check the tools ourselves)
|
||||
#
|
||||
# dpkg-buildpackage writes the .deb into the PARENT directory.
|
||||
dpkg-buildpackage -us -uc -b -d
|
||||
|
||||
# --- collect the artifacts into ./dist --------------------------------------
|
||||
mkdir -p dist
|
||||
mv -f ../hatsune-miku-shoshitsu_*.deb dist/ 2>/dev/null || true
|
||||
mv -f ../hatsune-miku-shoshitsu_*.changes dist/ 2>/dev/null || true
|
||||
|
||||
echo
|
||||
echo "Done. Debian package built:"
|
||||
ls -lh dist/*.deb
|
||||
Vendored
+5
@@ -0,0 +1,5 @@
|
||||
hatsune-miku-shoshitsu (0.1.0-1) unstable; urgency=medium
|
||||
|
||||
* Initial packaging for Debian-based distributions.
|
||||
|
||||
-- Your Name <you@example.com> Sun, 30 Aug 2026 10:00:00 +0000
|
||||
Vendored
+1
@@ -0,0 +1 @@
|
||||
13
|
||||
Vendored
+16
@@ -0,0 +1,16 @@
|
||||
Source: hatsune-miku-shoshitsu
|
||||
Section: utils
|
||||
Priority: optional
|
||||
Maintainer: Your Name <you@example.com>
|
||||
Build-Depends: debhelper (>= 13), cmake (>= 3.16), g++ (>= 8)
|
||||
Standards-Version: 4.6.2
|
||||
Homepage: https://example.com/hatsune-miku-shoshitsu
|
||||
|
||||
Package: hatsune-miku-shoshitsu
|
||||
Architecture: any
|
||||
Depends: ${shlibs:Depends}, ${misc:Depends}
|
||||
Description: Hatsune Miku's Shoshitsu in Terminal
|
||||
A terminal-based program about Hatsune Miku's Shoshitsu (loss).
|
||||
.
|
||||
This is a placeholder description. Replace it with a real one before
|
||||
releasing the package.
|
||||
Vendored
+28
@@ -0,0 +1,28 @@
|
||||
Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
|
||||
Upstream-Name: hatsune-miku-shoshitsu
|
||||
Upstream-Contact: Your Name <you@example.com>
|
||||
Source: https://example.com/hatsune-miku-shoshitsu
|
||||
|
||||
Files: *
|
||||
Copyright: 2026 Your Name <you@example.com>
|
||||
License: MIT
|
||||
Permission is hereby granted, free of charge, to any person obtaining a
|
||||
copy of this software and associated documentation files (the "Software"),
|
||||
to deal in the Software without restriction, including without limitation
|
||||
the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
and/or sell copies of the Software, and to permit persons to whom the
|
||||
Software is furnished to do so, subject to the following conditions:
|
||||
.
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
.
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
|
||||
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
||||
DEALINGS IN THE SOFTWARE.
|
||||
|
||||
# Adjust the license above (or remove it) to match the license you actually
|
||||
# want to distribute this project under.
|
||||
Vendored
+1
@@ -0,0 +1 @@
|
||||
usr/bin/hatsune-miku-shoshitsu
|
||||
Vendored
+7
@@ -0,0 +1,7 @@
|
||||
#!/usr/bin/make -f
|
||||
|
||||
%:
|
||||
dh $@
|
||||
|
||||
override_dh_auto_configure:
|
||||
dh_auto_configure -- -DCMAKE_BUILD_TYPE=Release
|
||||
Vendored
+1
@@ -0,0 +1 @@
|
||||
3.0 (quilt)
|
||||
@@ -0,0 +1,13 @@
|
||||
// Hatsune Miku's Shoshitsu in Terminal
|
||||
//
|
||||
// Placeholder program so the project compiles and can be packaged as a .deb.
|
||||
// Replace the body with the real application.
|
||||
|
||||
#include <iostream>
|
||||
|
||||
int main()
|
||||
{
|
||||
std::cout << "Hatsune Miku's Shoshitsu in Terminal\n";
|
||||
std::cout << "This is a placeholder. Build the real thing here!\n";
|
||||
return 0;
|
||||
}
|
||||
+56
@@ -0,0 +1,56 @@
|
||||
#!/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"
|
||||
Reference in New Issue
Block a user