I'm rather familiar with portage and USE flags in Gentoo. After a quick google search, I didn't see any way to setup Portage in Ubuntu. Is there a way? Is there an equivalent to USE flags in Ubuntu?
2 Answers
It is theoretically possible to setup portage on Ubuntu or any other linux. However for that to be useful, portage would have to be able to interact with apt somehow (at the very least be able to find packages installed by apt), which it's not. There's also no extension to portage that allows something like that, so this is not a good idea.
And no, apt does not have anything like USE flags, as it uses binary packages so it's too late to specify any compile flags. However sometimes there are multiple packages of the same software with different features enabled. For example there's nethack-console, nethack-x11 and nethack-qt, which in portage are all covered by one package with different USE flags.
You can install almost any ubuntu software from source if you like. You first have to enable the source repositories:
System -> Administration -> Software Sources
More details here: https://help.ubuntu.com/community/Repositories/Ubuntu
Then you can install and build from source like so (fetches dependencies automatically):
apt-get build-dep some-package-name
apt-get source -b some-package-name
This will download, unpack, and build the given package into a .deb that can be installed. While there is no direct equivalent of the portage 'USE' flag, you can get access to any of the build flags for the package and rebuild it after your initial download.
If you want to later remove the package, you can do:
apt-get remove some-package-name