rscada / libmbus

Meter-bus library and utility programs
http://www.rscada.se/libmbus
BSD 3-Clause "New" or "Revised" License
217 stars 137 forks source link

Debuild only #214

Open narc-Ontakac2 opened 2 months ago

narc-Ontakac2 commented 2 months ago

This modernizes the Debian package build a bit. It also gives it the ability to run standalone, which obsoletes build-deb.sh. So cloning the repository and running

debuild

should give you a deb package.

In addition this gives you the ability to cross build for all Debian based platforms including Raspbian using pbuilder.

wget http://raspbian.raspberrypi.org/raspbian/pool/main/r/raspbian-archive-keyring/raspbian-archive-keyring_20120528.2_all.deb
sudo apt-get install ./raspbian-archive-keyring_20120528.2_all.deb    
sudo apt-get install pbuilder mmdebstrap qemu-user-static

sudo pbuilder create --architecture armhf \
                 --distribution bookworm \
                 --mirror http://mirror.netcologne.de/raspbian/raspbian/ \
                 --basetgz /var/cache/pbuilder/raspbian-bookworm.tgz \
                 --debootstrap mmdebstrap \
                 --debootstrapopts \
                     --keyring=/usr/share/keyrings/raspbian-archive-keyring.gpg

should set up the build environment.

sudo pbuilder build \
                 --architecture  armhf \
                 --basetgz /var/cache/pbuilder/raspbian-bookworm.tgz libmbus_0.9.0.dsc

then builds the Raspbian deb. Note that the dsc file is created by debuild in the directory that contains the build directory.

The above sets up a Qemu virtual machine to do the build. This is inefficient and a bit slow. It is however much easier to do than setting up a cross compile.