6.29 Build Architecture Optimised Packages

The apt-build, apt-build package, a front-end to apt-get, provides a general solution to build Debian packages tuned (or optimised) for your architecture.

  $ wajig install apt-build

You will be asked for some options, and these go into /etc/apt/apt-build.conf:

  build-dir = /var/cache/apt-build/build
  repository-dir = /var/cache/apt-build/repository
  Olevel = -O2
  march = -march=pentium4
  mcpu = -mcpu=pentium4
  options = " "

The built packages will be placed into /var/cache/apt-build/repository, an can be accessed with the standard Debian package tools by adding the following line to the top of /etc/apt/sources.list (which can be done during the installation of apt-build, apt-build:

  deb file:/var/cache/apt-build/repository apt-build main

You will need deb-src entries in your /etc/apt/sources.list file to be able to obtain the source packages (see Section 6.28).

Being a front-end to apt-get, your first apt-build command might be to update the list of known available packages (particularly if you have just added a deb-src entry to /etc/apt/sources.list), although the following is equivalent:

  $ wajig update

You can then start building packages:

  $ sudo apt-build install most

You can manage a collection of packages to be recompiled and installed instead of obtaining the default compiled versions. Create the file /etc/apt/apt-build.list to contain a list of such packages and then:

  $ sudo apt-build world

One way to get a full list of installed packages is:

  # dpkg --get-selections | awk '{if ($2 == "install") print $1}' \
    > /etc/apt/apt-build.list

Be sure to edit the list to remove, for example, gcc! Then a:

  $ sudo apt-build world

will recompile and optimise all packages.



Your donation will support ongoing availability and give you access to the PDF version of this book. Desktop Survival Guides include Data Science, GNU/Linux, and MLHub. Books available on Amazon include Data Mining with Rattle and Essentials of Data Science. Popular open source software includes rattle, wajig, and mlhub. Hosted by Togaware, a pioneer of free and open source software since 1984. Copyright © 1995-2022 Graham.Williams@togaware.com Creative Commons Attribution-ShareAlike 4.0