For the first time in my Linux (Debian) career it seems necessary for me to compile a piece of software myself.

The process of compiling is well described on the project-website. However, there is one thing I don't understand, that keeps me from getting started:

I want to keep my package management (APT) tidy. To compile the project, I need to download a lot of packages (most of them *-dev versions), that I probably wouldn't need, once I finished the compilation.

I don't want to keep those *-dev packages afterwards.

Therefore I wonder if there is a practical way to temporarily install those packages for the compilation-process and afterwards delete them all at once (without having to remember each and every package-name).

  • 1
    Make sure that you can't find a Debian package that will do what you want. Consider making the Debian packaging yourself. It is often easier than it looks, and tools like dh (man dh) help to automate the process. – Faheem Mitha Sep 15 '15 at 21:27

If the package happens to be in a debian repo somewhere, you can use build-dep to install the build dependencies and mark those as 'automatically' installed. You can then use autoremove to cleanup those build deps.

apt-get build-dep -o APT::Get::Build-Dep-Automatic=true WhatImBuilding
apt-get autoremove

If whatever you're building doesn't already have a deb package with build deps somewhere, then this technique doesn't work. There is however a debian feature suggestion to add this type of support: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=745769

I suppose you could define a fake package for whatever you're building in a local repo which you manage, and define the build-deps there, allowing the above method to work. That's a bit contrived, though. You can also hand-edit the /var/lib/apt/extended_states file to mark whatever packages you're installing as 'automatic', thus making them eligible for autoremove, but that is probably dangerous.

  • 1
    I see that wishlist bug is mine. But I've mostly managed to forget about the wishlist bug, the referenced U&L answer, and the related discussion on chat. Clearly, my memory continues to get better. Anyway, feel free to ping the Debian bug report. The more people who say they are interested, the more likely it is to be implemented before the next millenium. There aren't a lot of resources for apt development, and they have a lot of priorities. – Faheem Mitha Sep 15 '15 at 21:06
  • To be clear, "ping" means write to 745769@bugs.debian.org and say you would be interested in this feature. You could also reference this question. – Faheem Mitha Sep 15 '15 at 21:35

Your Answer

