For those on Debian stable, here is the procedure I used to compile netatalk
2.2.1-1 from the unstable repository using Debian 6.0.3 stable libraries.

====== Build a Debian package from source code ======

  * References:
    * "7.14 How do I build binary packages from a source package?",
http://www.debian.org/doc/manuals/debian-faq/ch-pkg_basics.en.html
    * "Howto to rebuild Debian packages",
http://raphaelhertzog.com/2010/12/15/howto-to-rebuild-debian-packages/

In this example, the package netatalk is built from source, based on the
source package in the "unstable" repository. It is built from source to
backport it to run on a system based on library versions from the "stable"
repository.

Tested with Netatalk 2.2.1-1 from the "unstable" repository and compiled on
a Debian 6.0.3 system based on the "stable" repository, both as of
2011-12-01.

===== Enable use of testing or unstable repositories if desired =====

  * References:
    * "Apt-Pinning for Beginners",
http://jaqque.sbih.org/kplug/apt-pinning.html

  * If the desired package is in the testing or unstable repositories, these
need to be enabled

vi /etc/apt/sources.list

--
...

# enable the "unstable" repository (to be used just to get the most recent
version of Netatalk)
deb http://ftp.us.debian.org/debian unstable main non-free contrib
deb-src http://ftp.us.debian.org/debian unstable main non-free contrib
--

  * configure Apt to never use software from "testing" or "unstable" if the
package also exists in "stable" unless we explicitly tell it to do so

vi /etc/apt/preferences

--
Package: *
Pin: release a=stable
Pin-Priority: 700

Package: *
Pin: release a=testing
Pin-Priority: 650

Package: *
Pin: release a=unstable
Pin-Priority: 600
--

  * update the Apt package databases

aptitude update

===== Install the devscripts package =====

  * The preferred way to do this is by using various wrapper tools. We'll
show how it's done using the devscripts tools. Install this package if you
haven't done so already.

aptitude install devscripts

===== Download the source of the desired package =====

  * Now, first get the source package (package "netatalk" from the
"unstable" repository for this example)

cd ~
mkdir software
cd software
mkdir netatalk
cd netatalk

apt-get source netatalk/unstable
cd netatalk-2.2.1/

===== Install needed build dependencies of the desired package =====

  * Then install needed build-dependencies (if any):

apt-get build-dep netatalk/unstable

  * Double-check using dpkg-checkbuilddeps -- no output should be returned,
indicating there are no unmet dependencies

cd ~/software/netatalk/netatalk-2.2.1
dpkg-checkbuilddeps

===== Create a custom version string for the desired package =====

  * Then create a dedicated version of your own build with a version suffix
of "local" and with a brief comment

dch -l local 'local-squeeze-backport-20111201'

===== Build the desired package =====

  * And finally build your package

debuild -us -uc

===== Install the desired package =====

  * If everything worked out fine, you should now be able to install your
package by running

dpkg -i ../*.deb




-- 
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org

Reply via email to