Go to TogaWare.com Home Page. GNU/Linux Desktop Survival Guide
by Graham Williams
Duck Duck Go

Build Architecture Optimised Packages


The 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:

  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.7.1).

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.

Copyright © 1995-2018 Togaware Pty Ltd
Support further development through the purchase of the PDF version of the book.
Brought to you by Togaware and the author of the open source software Rattle and wajig.
Also the author of Data Mining with Rattle and Essentials of Data Science.