This howto explains how to build software that is packaged in ubuntu.
Reasons for rebuilding a package that is already in ubuntu:
- apply a patch
- use a version that doesn't have a .deb
- use different build options, in the uncommon case optional features were disabled.
It is the basic commands needed for the simple cases. Not everything is simple, so it may or may not work for any one package. Once you are fluent with this you may want to contribute your packages, or even package software that never was in ubuntu. For more information about this, see the Masters of the universe site, and the MOTU school there.
Install the build dependencies
The purpose of this step is to install any dependencies necessary to the build process.
sudo apt-get build-dep <package> sudo apt-get install build-essential fakeroot devscripts
Download the source
You can sometimes use debcheckout <package> to get a fresh VCS checkout of the source package, but layout and conventions differ.
mkdir src; cd src apt-get source <package> cd <newly created dir>
At this point, I generally do the "Build Time!" process now to make sure everything is in order.
Sometimes the reason you're building from source is because you need to patch the stock release. Now is when you do that.
patch -p1 < SomePackagePatch.patch
For the bold, using the vanilla source isn't hard. If you are lucky, there is a debian dir that has everything you need to just do Build Time! otherwise, I have been able to copy the debian/ dir to the source tree and build from there. (how dangerous is this?)
Be sure to update debian/control so that your new package gets a proper version number. This will prevent it from being upgraded to the original ubuntu version. This command will do it semi-automatically:
Change version number in the first line to something like 0.8.3-svn-158, or like <previous-version>.customised.1; then add some comment.
debuild -us -uc -i -I
Install the new deb
The build process will create one or more .deb(s) in the parent directory. Don't change directory yet, and install the packages you just built.
Once you're satisfied that <package> is working properly, you can now clean up the files used for building, as this frees up quite a bit of disk. Of course, deleting make's working files will mean that if you need to rebuild, make will have to start right from the beginning.
add the gutsy source repository where jppy is contained, then see if "sudo apt-get -b source jppy" gets you a clean compile. if it does, you could still tell the backports team about it.
used this for: wine pidgin gocr spe
mplayer maintains the debian/ dir as part of it's source, so no need for apt-get source mplayer and shuffling files around, just
svn co svn://svn.mplayerhq.hu/mplayer/trunk mplayer-trunk cd mplayer-trunk debuild -us -uc -i -I
Script that tries to do the whole process, you need to tweak the few things at the top. I left in what works for various packages I have used this on.
# updeb.sh # updates a deb. well, makes a deb from current source. # based on https://help.ubuntu.com/community/UpdatingADeb set -xe # ---------------------------------- PACKAGE=spe SRCDIR=_spe GETSRCCMD="svn checkout svn://svn.berlios.de/python/$PACKAGE/trunk/_spe" # ---------------------------------- # PACKAGE=gocr SRCDIR=src GETSRCCMD="cvs -d:pserver:email@example.com:/cvsroot/jocr login && cvs -z3 -d:pserver:firstname.lastname@example.org:/cvsroot/jocr co -P jocr/src" # ---------------------------------- PACKAGE=python-kinterbasdb SRCDIR=src GETSRCCMD=" cvs -d:pserver:email@example.com:/cvsroot/kinterbasdb login && cvs -z3 -d:pserver:firstname.lastname@example.org:/cvsroot/kinterbasdb co -P Kinterbasdb-3.0 ./" # ----------------- PACKAGE=qemu SRCDIR=#_spe GETSRCCMD="cvs -z3 -d:pserver:email@example.com:/sources/qemu co qemu" # need to move debian/ and cd into the cvs source: # mv qemu-*/debian qemu/ # cd qemu # ---------------------------------- # DEBEMAILfirstname.lastname@example.org # DEBFULLNAME="Carl Karsten" mkdir $PACKAGE cd $PACKAGE # needed to get source, compile and build debs sudo apt-get --assume-yes install build-essential fakeroot subversion cvs dpkg-dev devscripts # get the $PACKAGE deps and source from apt repository # (and debian/ dir needed to build the .deb) sudo apt-get --assume-yes build-dep $PACKAGE apt-get source $PACKAGE # cd into the apt-got dir. # this will need to be changed as the version changes. # this is a hack. not sure how else to figure out what to cd into cd $PACKAGE* exit # hide the apt-got source # mv $SRCDIR $SRCDIR.apt-got # get working copy $GETSRCCMD # bump the version number # if this is not done, the new deb will be the same version as the current, so won't install. ($0 is the name of this script) debchange --nmu $0 # build the .deb debuild -us -uc -i -I # install the deb. # using this command, on your own :) echo sudo gdebi $PACKAGE*.deb