= How to build the Debian package of `psensor` from GIT
:docinfo2:
:icons: font

This document is explaining step by step how to build the Debian
package of psensor directly from the GIT repository.

== Build the Debian package

Install `git-buildpackage`:

----
sudo apt-get install git-buildpackage
----

Install all build dependencies (you can get it from
the variable `Build-depends` of the file `debian/control`):

----
sudo apt-get install ...
----

Checkout the source of `psensor` and its packaging:

----
git clone https://gitlab.com/jeanfi/psensor-pkg-debian.git
----

Build the Debian package:

----
cd psensor-pkg-debian.git
git-buildpackage
----

== Build to another Debian distribution

`pbuilder` can be used to build `psensor` to another Debian
distribution than the one used by the build machine.

Installation of `pbuilder`:

----
apt-get install pbuilder qemu-user-static
----

Create the distribution image:

----
git-pbuilder create --config raspbian.pbuilderrc
----

The variable `DISTRIBUTION` in the configuration file is specifying
the distribution target of the build. It might be useful for
example to check the compilation on the 'testing' flavor of `Debian`.

See a configuration example for `Raspbian`:
link:raspbian.pbuilderrc[raspbian].

To update the image:

----
git-pbuilder update
----

Checkout the source of `psensor` and its packaging:

----
git clone https://gitlab.com/jeanfi/psensor-pkg-debian.git
----

And finally, build the `Debian` package:

----
git-buildpackage --git-pbuilder
----

== References

* https://wiki.debian.org/git-pbuilder
* https://www.debian.org/doc/manuals/maint-guide/build.en.html