What is the Ubuntu way of downloading the source for a package and then building it while passing specific flags to the configure portion of the process? I hope I'm explaining what I mean properly.

Installing from source follows almost always the following procedure:

./configure --FLAG-1 --FLAG-2
make && make install

How can I get control over specifying flags1 and 2 in the configure process?


You can download the source for most packages in the Ubuntu Repos. To compile a package from source, you would do something like this:

sudo apt-get build-dep doodad

This will install any dependencies. Now download the source code:

apt-get source doodad
cd doodad*

Edit debian/rules to customize the build process:

$EDITOR debian/rules

Finally, build it as a .deb (for easy uninstalling/dependency resolution):

dpkg-buildpackage -rfakeroot -uc -b

(the arguments will tell the command to fake root, to not sign the package, and to not include the source)

Now you can install the package you just built with this command:

cd ..
sudo dpkg -i doodad-<version>-ubuntu-<crap>.deb

(make sure to install the non -dev version)

Then you can clean up with:

rm -rf doodad*

This was tested on Ubuntu 12.04, with the irssi package. Your results may vary.