diff --git a/docs/contributors/building/build-packages-locally.rst b/docs/contributors/building/build-packages-locally.rst index f41379672..b1e298907 100644 --- a/docs/contributors/building/build-packages-locally.rst +++ b/docs/contributors/building/build-packages-locally.rst @@ -115,9 +115,23 @@ To build both **source** and **binary** packages for a specific release, use the Launchpad rejects uploads that contain both binaries and sources. -Useful ``sbuild`` options +Useful build options ~~~~~~~~~~~~~~~~~~~~~~~~~ +Skipping the source clean step: + By default, ``sbuild`` runs ``debian/rules clean`` before building, which + requires some build dependencies to be installed on the host system. If you + maintain your source tree in git and have already cleaned it (e.g. with + ``git clean -ffdx``), use ``--no-clean-source`` to skip this step: + + .. code-block:: none + + --no-clean-source + + This is particularly useful when building source packages with + ``dpkg-buildpackage --no-pre-clean`` (``-nc``), as it avoids requiring build + dependencies on the host solely for the clean step. + Parallel building: To speed up the build, set the ``parallel`` option through the ``DEB_BUILD_OPTIONS`` environment variable. For example: @@ -209,11 +223,30 @@ When building with ``sbuild``, specify the target architecture with the ``--arch Building for architecture variants ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ -Some architectures have variants (e.g. ``amd64`` has ``amd64v3``). To build for an architecture variant, specify the variant as an argument to ``--host=``: +Some architectures have variants (e.g. ``amd64`` has ``amd64v3``). Architecture +variants are treated as separate architectures by ``dpkg`` and ``sbuild``, so +building for a variant requires a chroot configured for that variant. + +.. note:: + + Building for an architecture variant requires the ``schroot`` backend. The + ``unshare`` backend does not currently support architecture variants. See + the `Debian sbuild wiki + `_ for + details on switching backends. + +First, create a schroot for the architecture variant using ``mk-sbuild`` from +the ``ubuntu-dev-tools`` package: + +.. code-block:: none + + $ mk-sbuild --arch= + +Then, build with ``sbuild`` using the ``--arch=`` option: .. code-block:: none - $ sbuild --host= --dist= + $ sbuild --arch= --dist= where ```` is the architecture variant (e.g. ``amd64v3``).