sudo apt-get install dpkg-dev mkdir -p tutorial cd tutorial wget http://www.southern-storm.com.au/download/treecc-0.3.6.tar.gz \ http://ajmitch.dyndns.win.co.nz/debuild/ubuntu/school/scratch/treecc_0.3.6-0ubuntu1.d{sc,iff.gz} mv treecc-0.3.6.tar.gz treecc_0.3.6.orig.tar.gz dpkg-source -x treecc_0.3.6-0ubuntu1.dsc cd treecc-0.3.6/ head -1 debian/changelog # Format of the line is: ('urgency' is unused in Ubuntu) # packagename (upstreamversion-debianversion) distribution; urgency # # Numbering: For Ubuntu, we number new packages, or new upstream # versions with a Debian revision of '-0ubuntuX', to avoid clashes # with Debian in the future. # Debian 'package 1.2.3-4' + Ubuntu patch => 'package 1.2.3-4ubuntu1' cat debian/control # See Debian Policy manual for fields. 'dh_make' can do this. # http://www.us.debian.org/doc/debian-policy/ch-controlfields.html#s-sourcecontrolfiles grep -E '^(Package|Architecture)' debian/control # Source: name of (this) source package # Package: name of _binary_ package(s) produced (eg. the same) # Architecture: normally 'any', or 'i386 powerpc amd64' or 'all' for Python scripts or datafiles # Depends: '${shlibs:Depends}' gets automatically filled in with libraries used wc -l debian/rules # 170 lines by hand, 61 lines with 'debhelper', 12 lines with 'cdbs' # http://ajmitch.dyndns.win.co.nz/debuild/ubuntu/school/{scratch,dh_make,cdbs}/treecc-0.3.6/debian/rules head -1 debian/rules # Must start with '#!/usr/bin/make -f' shebang so that it is executable grep -E '^(b(uild|inary(-arch|-indep)?)|clean):' debian/rules # dpkg-buildpackage calls and uses these targets: # clean, binary, binary-arch, binary-indep, and build grep DEB_BUILD_OPTIONS debian/rules # Used for doing things like turning off stripping binaries grep DESTDIR debian/rules # Where to put files to when arranging the contents of the tarball eg: # ~/tutorial/treecc-0.3.6/debian/treecc/usr/bin/treecc grep '^.*stamp:' debian/rules # Make was originally designed for building plain source, not binary. # These 'timestamp' files are to stop loops. grep '^clean:' debian/rules # Put everything in a pristine condition, including removing patches. grep '^binary-indep:' debian/rules # Comes into play on 'Architecture: all' (data, cross-platform scripts...) grep '^binary-arch:' debian/rules # This is where most things happen ls -l debian/treecc/DEBIAN # debhelper normally hides this directory, where the control scripts go ls -l debian/postinst # dpkg-shlibdeps produces 'debian/substvars' ... # dpkg-gencontrol takes 'debian/control' and 'debian/substvars' => $DESTDIR/DEBIAN/control grep Copyright debian/copyright | head -1 # Ideally: Copyright (c) xxxx-yyyy Acme Incorporated. dpkg-buildpackage -rfakeroot ls -l ../treecc_0.3.6-0ubuntu1{.d{sc,iff.gz},_i386.{changes,deb}} # debuild runs dpkg-buildpackage, then lintian/linda and is part of 'devscripts' # which can be configured in '~/.devscripts'. debuild -S # This will sign everything, ready for upload. # cdbs (common debian build system) is even simpler for a standard package # it's a set of make-rules that you can include in debian/rules