Tuesday, August 25, 2009

Recompile Debian Packages with Different configure Options

ONE THING I WANT TO MAKE CLEAR RIGHT NOW. THIS GUIDE USES GNOME-APPLETS AS AN EXAMPLE. THE PURPOSE IS NOT TO TEACH YOU HOW TO GET MINI COMMANDER. THAT IS AN ADDED BENEFIT. RATHER THIS GUIDE IS TO TEACH YOU HOW TO RECOMPILE DEBIAN PACKAGES FROM DEB SOURCE PACKAGES WITH ANY CONFIGURE OPTIONS AND ANY ARCHITECTURE YOU LIKE!


Note: This will require downloading at least 140 mb of files for development. If you wish to learn how to do this which any package, try doing it with psi instead, a small, powerful, awesome program. This is for moderate user to advanced user. Here's what it is going to look like once you've done all the commands with the required devel packages. Then scroll down for a detailed explanation.


chris@ubuntu:~$ mkdir -p ~/Build
chris@ubuntu:~$ cd ~/Build
chris@ubuntu:~/Build$ sudo apt-get install devscripts build-essential fakeroot Reading package lists... Done Building dependency tree Reading state information... Done devscripts is already the newest version. build-essential is already the newest version. fakeroot is already the newest version. The following packages were automatically installed and are no longer required: libjinglep2p0.3-0 gstreamer0.10-plugins-farsight libjinglexmllite0.3-0 libjinglebase0.3-0 libjinglexmpp0.3-0 Use 'apt-get autoremove' to remove them. 0 upgraded, 0 newly installed, 0 to remove and 4 not upgraded.
chris@ubuntu:~/Build$ sudo apt-get build-dep gnome-applets Reading package lists... Done Building dependency tree Reading state information... Done 0 upgraded, 0 newly installed, 0 to remove and 4 not upgraded.chris@ubuntu:~/Build$ apt-get source gnome-applets Reading package lists... Done Building dependency tree Reading state information... Done NOTICE: 'gnome-applets' packaging is maintained in the 'Bzr' version control system at: https://code.launchpad.net/~ubuntu-desktop/gnome-applets/ubuntu Please use: bzr get https://code.launchpad.net/~ubuntu-desktop/gnome-applets/ubuntu to retrieve the latest (possible unreleased) updates to the package. Skipping already downloaded file 'gnome-applets_2.26.1-0ubuntu1.dsc' Skipping already downloaded file 'gnome-applets_2.26.1.orig.tar.gz' Skipping already downloaded file 'gnome-applets_2.26.1-0ubuntu1.diff.gz' Need to get 0B of source archives. Skipping unpack of already unpacked source in gnome-applets-2.26.1
chris@ubuntu:~/Build$ cd gnome-applets-2.26.1
chris@ubuntu:~/Build/gnome-applets-2.26.1$ GNU nano 2.0.9 File: debian/changelog.dch gnome-applets (2.26.1-0ubuntu1.1) jaunty-proposed; urgency=low * Non-maintainer upload. * -- Didier Roche  Mon, 24 Aug 2009 22:50:52 -0500 gnome-applets (2.26.1-0ubuntu1) jaunty-proposed; urgency=low * New upstream release (LP: #340410, #77263, #361202) + Drivemount Applet: - Don't crash if the icons can't be found or gconf is down (340410, Callum McKenzie). + Keyboard Accessibility Indicator: - Load icons correctly (576707, Callum McKenzie). + Weather Applet: - Fix a crash if the locations could not be read (554856, Callum McKenzie$ + Translation Updates ^G Get Help ^O WriteOut ^R Read File ^Y Prev Page ^K Cut Text ^C Cur Pos ^X Exit ^J Justify ^W Where Is ^V Next Page ^U UnCut Text^T To Spell Searching for duplicated docs in dependency gnome-applets... /bin/zdiff: line 68: /home/chris/Build/gnome-applets-2.26.1/debian/gnome-applets/usr/share/doc/gnome-applets/./changelog.Debian.gz: No such file or directory /bin/zdiff: line 68: /home/chris/Build/gnome-applets-2.26.1/debian/gnome-applets/usr/share/doc/gnome-applets/./AUTHORS: No such file or directory /bin/zdiff: line 68: /home/chris/Build/gnome-applets-2.26.1/debian/gnome-applets/usr/share/doc/gnome-applets/./README: No such file or directory /bin/zdiff: line 68: /home/chris/Build/gnome-applets-2.26.1/debian/gnome-applets/usr/share/doc/gnome-applets/./NEWS.gz: No such file or directory # symlink identical Gnome help files within packages if [ -z "$CDBS_NO_GNOME_HELP_SYMLINKING" ] && [ -d debian/gnome-applets-dbg/usr/share/gnome/help ]; then \ cd debian/gnome-applets-dbg && LC_ALL=C fdupes -r1nq usr/share/gnome/help | while read s; do \ set -- $(echo $s | tr ' ' '\n' | sort); \ f=$1; shift; \ for d; do \ echo "symlinking duplicate Gnome help file $d to $f"; \ rm $d; ln -s /$f $d; \ done; \ done; \ fi dh_link -p gnome-applets-dbg dh_md5sums -pgnome-applets-dbg dh_builddeb -pgnome-applets-dbg -- -Zbzip2 warning, `debian/gnome-applets-dbg/DEBIAN/control' contains user-defined field `Original-Maintainer' dpkg-deb: building package `gnome-applets-dbg' in `../gnome-applets-dbg_2.26.1-0ubuntu1.1_amd64.deb'. dpkg-deb: ignoring 1 warnings about the control file(s)
chris@ubuntu:~/Build/gnome-applets-2.26.1$
chris@ubuntu:~/Build$ ls *deb gnome-applets_2.26.0-0ubuntu4_amd64.deb gnome-applets_2.26.1-0ubuntu1.1_amd64.deb gnome-applets_2.26.1-0ubuntu2_amd64.deb gnome-applets-data_2.26.0-0ubuntu4_all.deb gnome-applets-data_2.26.1-0ubuntu1.1_all.deb gnome-applets-data_2.26.1-0ubuntu2_all.deb gnome-applets-dbg_2.26.0-0ubuntu4_amd64.deb gnome-applets-dbg_2.26.1-0ubuntu1.1_amd64.deb gnome-applets-dbg_2.26.1-0ubuntu2_amd64.deb pidgin-musictracker_0.4.18-1_amd64.deb psi_0.12-2ubuntu1_amd64.deb
chris@ubuntu:~/Build$ sudo dpkg -i gnome-applets_2.26.1-0ubuntu1.1_amd64.deb gnome-applets-data_2.26.1-0ubuntu1.1_all.deb
[sudo] password for chris:
dpkg - warning: downgrading gnome-applets from 2.26.1-0ubuntu2 to 2.26.1-0ubuntu1.1.
(Reading database ... 221597 files and directories currently installed.) Preparing to replace gnome-applets 2.26.1-0ubuntu2 (using gnome-applets_2.26.1-0ubuntu1.1_amd64.deb) ... Unpacking replacement gnome-applets ... Preparing to replace gnome-applets-data 2.26.1-0ubuntu2 (using gnome-applets-data_2.26.1-0ubuntu1.1_all.deb) ... Unpacking replacement gnome-applets-data ... Setting up gnome-applets-data (2.26.1-0ubuntu1.1) ... Setting up gnome-applets (2.26.1-0ubuntu1.1) ... Processing triggers for man-db ... Processing triggers for python-support ...chris@ubuntu:~/Build$ sudo dpkg -i gnome-applets_2.26.1-0ubuntu1.1_amd64.deb gnome-applets-data_2.26.1-0ubuntu1.1_all.deb (Reading database ... 221503 files and directories currently installed.) Preparing to replace gnome-applets 2.26.1-0ubuntu1.1 (using gnome-applets_2.26.1-0ubuntu1.1_amd64.deb) ... Unpacking replacement gnome-applets ... Preparing to replace gnome-applets-data 2.26.1-0ubuntu1.1 (using gnome-applets-data_2.26.1-0ubuntu1.1_all.deb) ... Unpacking replacement gnome-applets-data ... Setting up gnome-applets-data (2.26.1-0ubuntu1.1) ... Setting up gnome-applets (2.26.1-0ubuntu1.1) ... Processing triggers for man-db ... Processing triggers for python-support ...chris@ubuntu:~/Build$



Summary Of Commands


# create a folder for building where all your source and debs will be
mkdir ~/Build
# move to that directory using the command
cd ~/Build
# install needed packages for building (some are what the package maintainers use)
sudo apt-get install devscripts build-essential fakeroot
# get all requirements for building gnome-panel
sudo apt-get build-dep gnome-applets
# get the deb-src for rebuilding the debian package (these are deb-src
# in your software sources; be sure to enable them)
apt-get source gnome-applets
# move to the newly created directory the last command gave you
cd gnome-applets-2.26.1
# nano is a simple console program easy to use. this command bumps the version slightly,
# so the package manager will not try to replace what installed because it prefers pacakges
# of the same version from the repos
# this will open the nano text editor.
# optional: next to blank star, tell what differences will be in this package you are making
# such as "Added support for minicommander applet"
# or hit save and close and proceed to the next step
EDITOR=nano dch -nmu low

# a few changes need to be made to enable and disable features of the
# program to your liking

nano debian/rules

# the following lines are not commands. they are what you need to change
# in the text editor nano
# you can also remove support for ipv6 as it's very unlikely you need and use it
# now edit this line in the file:

DEB_CONFIGURE_EXTRA_FLAGS += --disable-gtk-doc --disable-scrollkeeper --enable-ipv6 --enable-mixer-applet

# Optional This allows you to see what those configure flags do. You may want to remove some, keep others, add more than just --enable-mini-commander and have a better understanding of how this works

./configure --help | less

# to quit less and go back to your command prompt, hit q for quit

DEB_CONFIGURE_EXTRA_FLAGS += --disable-gtk-doc --disable-scrollkeeper --enable-ipv6 --enable-mixer-applet --enable-mini-commander



# Now save, close, and back to the command line:
# Note: This is optional. If you would like to see all available options you can compile with, then run ./configure --help, and you can further modify the above

# now back to the commands
# -b builds a binary package (deb)
# -j4 is useful for multicore processors, but won't hurt if you don't have one
# -D checks for build conflicts and aborts if there is a
# conflict (i and everyone i know have never ran into this problem)
dpkg-buildpackage -b -j4 -D

# move back a directory
cd ..

# use the following command to see what debs you have created
ls *deb

# from the previous command, install gnome-panel and gnome-panel-data, but not the
# package with the name dbg in it; that is a package for debugging which you do not need
# the following .deb packages are the ones I got. If yours are different, substitute with the
# correct packages you saw from the previous command excluding the one with dbg in it's name
sudo dpkg -i gnome-applets_2.26.1-0ubuntu1.1_i386.deb gnome-applets-data_2.26.1-0ubuntu1.1_all.deb

# the gnome-panel will reload itself and come back, and now you will have the
# option of adding minicommander gnome-applet
killall gnome-panel







Andrew from the Ubuntu Technical Mailing List was the first to follow this guide, and probably second ever to have minicommander in Ubuntu, and obviously he had great success. You can see. Thanks Andrew.

RecursiveQuickSort (me, the author): ill do it
RecursiveQuickSort: or just keep providing good info you can learn from
Andrew (The l337 web developer with mad skillz): info is worth it's weight in gold
RecursiveQuickSort: did you learn from this?
Andrew: yes indeed
RecursiveQuickSort: good
Recursivequicksort: I hope im bringing good content
Andrew: I've actually needed the ./configure --help thing a few times, and didnt know about it
Andrew: and adding the compile flags to the debian-rules file is something i never heard of before
RecursiveQuickSort: this is package maintainer stuff
RecursiveQuickSort: devscripts
RecursiveQuickSort: you just used a bunch of them
RecursiveQuickSort: a few directly
RecursiveQuickSort: many called by the dpkg-build command

4 comments:

  1. Just want to say your article is striking. The clarity in your post is simply striking and i can take for granted you are an expert on this subject. I simply stumbled upon your weblog and Truly insightful information thanks a ton. I’m sure we’d all like to read a lot more helpful intel much like this in the future I really trust you actually can certainly persist your current prolific authoring style.

    ReplyDelete