feat(build): add Docker-based Debian package build system

Introduce a Docker-based build system for Debian packages to streamline
the build process and ensure consistency across environments. This
change mitigates potential build failures due to environment
discrepancies and simplifies the setup for new developers.

- Extend .gitignore to exclude debhelper and build artifacts
- Add build.sh script to automate Docker-based package building
- Update debian/control to include libyaml-dev as a build dependency
- Create debian/files to track generated Debian packages
- Add Dockerfile to define the build environment with necessary
  dependencies

Signed-off-by: Glenn Y. Rolland <glenux@glenux.net>
This commit is contained in:
Glenn Y. Rolland 2025-04-11 14:24:04 +02:00
parent f9e5c532a0
commit 3d2017aea9
5 changed files with 48 additions and 1 deletions

4
.gitignore vendored
View file

@ -7,3 +7,7 @@
.vagrant
bin
lib
debian/.debhelper/
debian/debhelper-build-stamp
debian/mfm
debian/mfm.substvars

19
build.sh Normal file
View file

@ -0,0 +1,19 @@
#!/bin/sh
# References:
# - https://www.debian.org/doc/manuals/maint-guide/build.en.html for base principles
# - https://www.patreon.com/posts/building-debian-23177439 for debuild output dir
#
set -ue
mkdir -p _build || true
docker build -t debbuilder --file docker/Dockerfile .
docker run -it -v "$(pwd):/app" -v "$(pwd)/_build:/_build" debbuilder \
sh -c "ARTIFACTS_DIR=/app/_build debuild --preserve-envvar=ARTIFACTS_DIR -us -uc --buildinfo-option=-u/app/_build --changes-option=-u/app/_build" \
|| docker run -it -v "$(pwd):/app" debbuilder
# dpkg-buildpackage -us -uc
# debuild
# git-buildpackage
echo SUCCESS

2
debian/control vendored
View file

@ -2,7 +2,7 @@ Source: mfm
Section: utils
Priority: optional
Maintainer: Glenn Y. Rolland <glenux@glenux.net>
Build-Depends: debhelper-compat (= 13), crystal, shards, make
Build-Depends: debhelper-compat (= 13), crystal, shards, make, libyaml-dev
Standards-Version: 4.6.0
Homepage: https://code.apps.glenux.net/glenux/mfm
Vcs-Git: https://code.apps.glenux.net/glenux/mfm.git

2
debian/files vendored Normal file
View file

@ -0,0 +1,2 @@
mfm-dbgsym_0.2.0_amd64.deb debug optional automatic=yes
mfm_0.2.0_amd64.deb utils optional

22
docker/Dockerfile Normal file
View file

@ -0,0 +1,22 @@
FROM debian:trixie
RUN set -ex \
&& sed -i \
-e 's/Types: deb/Types: deb deb-src/g' \
/etc/apt/sources.list.d/debian.sources \
&& apt-get update \
&& apt-get install -y --no-install-recommends \
build-essential \
cdbs \
devscripts \
equivs \
fakeroot \
crystal \
shards \
git-buildpackage \
libyaml-dev \
libxml2-dev \
&& apt-get clean \
&& rm -rf /tmp/* /var/tmp/*
WORKDIR /app