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?


2 Answers 2


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.


For a general explanation of how to build from source see my answer here:

To address your specific question here about ./configure please read on:

To gain a list of the appropriate flags and options available for the program you are compiling, enter

./configure --help

Part of a sample file for Pinta generated from the above command:

`configure' configures pinta 1.3 to adapt to many kinds of systems.
Usage: ./configure [OPTION]... [VAR=VALUE]...
To assign environment variables (e.g., CC, CFLAGS...), specify them as VAR=VALUE.

Some influential environment variables:

PKG_CONFIG path to pkg-config utility
PKG_CONFIG_PATH directories to add to pkg-config's search path
PKG_CONFIG_LIBDIR path overriding pkg-config's built-in search path
CC C compiler command
CFLAGS C compiler flags
LDFLAGS linker flags, e.g. -L< lib dir > if you have libraries in a nonstandard directory
LIBS libraries to pass to the linker, e.g. -l
CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I< include dir > if you have headers in a nonstandard directory
CPP C preprocessor

You can override the default options by specifying locations of packages or libraries if they are in non-standard locations or have different names than configure expects as this article showed. For more on flags as used in the configure script itself, see this discussion here.

Or if the program is not to be installed in the default location (the /usr/local hierarchy) you can specify, for example

./configure --prefix=/my/custom/location 

There are many more options that can be used, and the list of commands passed to ./configure can become very long, but it is all very specific to the program you are compiling; very often no special options are needed.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .