Certainly most of the Linux users would like to have their systems fully optimized for their rigs but do not have the stamina or enough knowledge to play with the Gentoo installation paradigm. But here comes the rescue — an apt-build goody available under every distro armed with the big gun – APT package manager.

Author: Gallus Annonimus

Time to make the beast work for us. First we have to install it. Issue the command:

apt-get install apt-build

Now it’s time to configure it. In doing so, we’ll be asked for an optimization level — whether we want to create an apt-build repo for APT, and a question about processor architecture. Of course all options can be reconfigured in this way:

dpkg-reconfigure apt-build

The above command offers two additional options for the gcc compiler and make builder. Their descriptions can be found in system manuals: man gcc and man make.

Optimizing system

Let’s go to the next step and start optimizing our system. Our program makes use of deb-src entries contained in the etc/apt/sources.list file. Thanks to the source addresses compilation and installation processes are fully automatic (similar to emerge found in Gentoo). Apt-build downloads sources of the main application and its dependencies, compiles them, creates a deb package, and finally installs the package.

We are offered a broad spectrum of options. I list only a few basic ones:

* apt-build update — updates repo list,
* apt-build upgrade — updates operating system,
* apt-build install program — installs an application,
* apt-build world — something for hard-core users, it recompiles whole system!

Other useful options:

* –noupdate — useful for underpowered machines and when we do not want to update repos (apt-build refreshes repos with every invocation),
* –yes — we do not have time to approve every stupid question during program installation,
* –force-yes — we approve unauthorized packages (ATTENTION: apt-build does not install unauthorized packages — what’s worse is it won’t ask us for this; the option’s highly recommended),
* –reinstall — reinstalls a package,
* –rebuild — builds a package from the beginning.

Make your Debian anew!

Anyone ready to jump to the deep waters of system recompilation, after reading above remarks, has to acquaint himself with a few things without which the compilation process will not yield.

At first the apt-build command should spit out the message:

—–Rebuilding the world!—–

—–Building package list—–

Please read README.Debian first.

Of course, the system failed to rebuild due to the fact it didn’t have a full list of system packages. We’ll try to amend this omission with the following command (it can be issued in one row without the backslash too):

dpkg –get-selections | awk ‘{if ($2 == “install”) print $1}’> \


I suggest to add two options — –yes and –force-yes — to make the rebuilding process fully automatic. Recompilation should start without a problem now. But you will never achieve 100% certainty that the compilation will go smoothly, that it will not stop at some point even after you’ve made every theoretical precaution.

But what about USE flags?

A lot of you wonder whether we could have accessed USE flags, as we were able to recompile our system like Gentoo distros. For those uninitiated into compilation secrets: USE flags are special options for portage (Gentoo package control system). They free us from typing a lot of compilation options. For example, if we use GNOME and we do not need KDE parts we can preset the compiler to process applications for the first graphical environment only. Sorry, but apt-build cannot manage USE flags.

In spite of being at an early stage of development, the program is promising. In my opinion it will be able to compete with Gentoo’s portage in the future. But as for today, the apt-build system it too young and underdeveloped to compete with the stable, mature, and easy to use portage. Anyway, don’t worry. Debian wasn’t created to be compiled by users, contrary to Gentoo. Users should make use of Debian’s gigantic default repositories of ready-to-use binaries. But who from us, the users, never wanted to optimize his system in the past and wouldn’t like to optimize it in the future?