]> git.donarmstrong.com Git - debhelper.git/commitdiff
r265: * It turns out it's possible to set up make variables that are specific to
authorjoey <joey>
Fri, 3 Sep 1999 21:12:04 +0000 (21:12 +0000)
committerjoey <joey>
Fri, 3 Sep 1999 21:12:04 +0000 (21:12 +0000)
     a single target of a Makefile. This works tremendously well with
     DH_OPTIONS: no need to put "-i" or "-pfoo" after every debhelper command
     anymore.
   * debhelper.1: mentioned above technique.
   * examples/rules.multi: use the above method to get rid of -i's and -a's.
   * examples/rules.multi2: new file, example of a multi-binary package that
     works for arch-indep and arch-dependant packages, and also allows
     building of single binary packages independntly, via binary-<package>
     targets. It accomplishes all this using only one list of debhelper
     commands.
   * examples/*: removed source and diff targets. They've been obsolete for 2
     years -- or is it 3? No need for a nice error message on failure anymore.

debhelper.1
debian/changelog
dh_compress
dh_compress.1
examples/rules
examples/rules.indep
examples/rules.multi
examples/rules.multi2 [new file with mode: 0755]

index f32966662a0a990bf5aae54e374b1c50f5f9a853..e7e03c996486df695985b418508953cb3886f48e 100644 (file)
@@ -3,7 +3,7 @@
 debhelper \- overview of the debhelper commands
 .SH SYNOPSIS
 .B dh_*
-.I "[-v] [-a] [-i] [--no-act] [-ppackage] [-Npackage] [-Ptmpdir]"
+.I "[-v] [-a] [-i] [-s] [--no-act] [-ppackage] [-Npackage] [-Ptmpdir]"
 .SH "DESCRIPTION"
 Debhelper is a collection of programs that can be used in debian/rules files
 to automate common tasks related to building debian binary packages. All the
@@ -12,6 +12,7 @@ document those options and to document debhelper as a whole. For additional
 options, and documentation for each individual command, see the commands' own
 man pages.
 .SH "SHARED DEBHLPER OPTIONS"
+The following command line options are supported by all debhelper programs.
 .TP
 .B \-v, \--verbose
 Verbose mode: show all commands that modify the package build directory.
@@ -29,12 +30,35 @@ Act on all architecture independent packages.
 .B \-ppackage, \--package=package
 Act on the package named "package".
 .TP
+.B \-s, \--same-arch
+This is a smarter version of the -a flag, that is used in some rare
+circumstances. It understands that if the control file lists "Architecture: i386"
+for the package, the package should not be acted on on other architectures. So
+this flag makes the command act on all "Architecture: any" packages, as well
+as on any packages that have the current architecture explicitly specified.
+Constrast to the -a flag, which makes the command work on all packages that
+are not architecture independant.
+.TP
 .B \-Npackage, \--no-package=package
 Do not act on the specified package even if an -a, -i, or -p option lists
 the package as one that should be acted on.
 .TP
 .B \-Ptmpdir, \--tmpdir=tmpdir
 Use "tmpdir" for package build directory. 
+.SH "COMMON DEBHELPER OPTIONS"
+The following command line options are supported by some debhelper programs.
+See the man page of each program for a complete explination of what the
+option does.
+.TP
+.B \-n
+Do not modify postinst/postrm/etc scripts.
+.TP
+.B \-Xitem, \--exclude=item
+Exclude an item from processing.
+.TP
+.B \-A, \-all
+Makes files or other items that are specified on the command line take effect
+in ALL packages acted on, not just the first.
 .SH NOTES
 .TP
 .B Multiple binary package support
@@ -52,8 +76,10 @@ are acted on by debhelper programs, all debhelper programs accept the
 .B -a
 ,
 .B -i
-, and 
+,
 .B -p
+, and
+.B -s
 parameters. These parameters are cumulative. If none are given,
 debhelper programs default to acting on all packages listed in the control
 file.
@@ -68,7 +94,8 @@ for an example of how to use this.
 By default, all debhelper programs assume that the temporary directory used
 for assembling the tree of files in a package is debian/tmp for the first
 package listed in debian/control, and debian/<packagename> for each
-additional package.
+additional package. If DH_COMPAT=2, debian/<packagename> is always used,
+even for the first package.
 .P
 Sometimes, you might want to use some other temporary directory. This is
 supported by the
@@ -83,16 +110,36 @@ binary package the debhelper program will act on.
 .B Other notes
 In general, if any debhelper program needs a directory to exist under
 debian/, it will create it. I haven't bothered to document this in all the
-man pages, but for example, dh_installdeb knows to make debian/tmp/DEBIAN/
+man pages, but for example, dh_installdeb knows to make debian/<foo>/DEBIAN/
 before trying to put files there, dh_installmenu knows you need a
-debian/tmp/usr/lib/menu/ before installing the menu files, etc.
+debian/<foo>/usr/lib/menu/ before installing the menu files, etc.
+.SH "DEBHELPER COMMANDS"
+Here is the complete list of available debhelper commands.
+#LIST#
 .SH ENVIRONMENT
 .TP
 .I DH_VERBOSE
 Enables verbose mode.
 .TP
+.I DH_COMPAT
+Specifies what compatability level debhelper should run at. The default is 1,
+which makes debhelper behave in a manner compatable with the 1.x series of
+debhelper. If set to 2, debhelper's behavior will change to use the new
+features of the 2.x series. Use this with caution, as the 2.x series makes
+major changes that will break most packages. For documentation on these
+changes, read /usr/doc/debhelper/v2
+.TP
 .I DH_NO_ACT
 Enables no-act mode.
+.TP
+.I DH_OPTIONS
+Anything in this variable will be prepended to the command line
+arguments of all debhelper commands. This in useful in some situations,
+for example, if you need to pass -p to all debhelper commands that will be
+run. If you use DH_OPTIONS, be sure to use "dh_testversion 1.1.17" - older
+debhelpers will ignore it and do things you don't want them to. One very
+good way to set DH_OPTIONS is by using "Target-specific Variable Values" in
+your debian/rules file. See the make documentation for details on doing this.
 .SH "SEE ALSO"
 .TP
 .BR /usr/doc/debhelper/README
@@ -100,5 +147,8 @@ An introduction to debhelper.
 .TP
 .BR /usr/doc/debhelper/examples/
 A set of example debian/rules files that use debhelper.
+.TP
+.BR http://kitenet.net/programs/debhelper/
+Debhelper web site.
 .SH AUTHOR
 Joey Hess <joeyh@master.debian.org>
index 8e15c7e5a80c948df8e8e9b80c12d96a764c1204..089539d3bbebb7c2655b68f7fc14a667f3600030 100644 (file)
@@ -1,3 +1,21 @@
+debhelper (2.0.30) unstable; urgency=low
+
+  * It turns out it's possible to set up make variables that are specific to
+    a single target of a Makefile. This works tremendously well with
+    DH_OPTIONS: no need to put "-i" or "-pfoo" after every debhelper command
+    anymore.
+  * debhelper.1: mentioned above technique.
+  * examples/rules.multi: use the above method to get rid of -i's and -a's.
+  * examples/rules.multi2: new file, example of a multi-binary package that
+    works for arch-indep and arch-dependant packages, and also allows
+    building of single binary packages independntly, via binary-<package>
+    targets. It accomplishes all this using only one list of debhelper
+    commands.
+  * examples/*: removed source and diff targets. They've been obsolete for 2
+    years -- or is it 3? No need for a nice error message on failure anymore.
+
+ -- Joey Hess <joeyh@master.debian.org>  Fri,  3 Sep 1999 11:28:24 -0700
+
 debhelper (2.0.29) unstable; urgency=low
 
   * dh_shlibdeps: Fixed quoting problem that made it fail on weird file names.
index e1f8ed643525f9102e87a652b60515ea71337713..847bcb6d73f49d31089b2e49a221114c758d5e5a 100755 (executable)
-#!/bin/sh -e
+#!/usr/bin/perl -w
 #
 # Compresses files and makes sure that symlinks pointing to the 
 # compressed files get fixed.
 
-PATH=debian:$PATH:/usr/lib/debhelper
-source dh_lib
-
-# The config file is a sh script that outputs the files to be compressed
-# (typically using find).
-if [ -f debian/compress ]; then
-       files=`sh debian/compress 2>/dev/null`
-else
-       # By default fall back on what the policy manual says to compress.
-       files=`
-               find debian/tmp/usr/info debian/tmp/usr/man \
-                       debian/tmp/usr/X11*/man -type f 2>/dev/null ;
-               find debian/tmp/usr/doc -type f -size +4k \
-                       ! -name "*.htm*" ! -name "*.gif" \
-                       ! -name "debian/tmp/usr/doc/*/copyright" 2>/dev/null
-       `
-fi
-
-if [ "$files" ]; then
-       # This is just a cosmetic fix.
-       files=`echo $files | tr "\n" " "`       
-
-       doit "gzip -9 $files" || true
-fi
-
-# Fix up symlinks that were pointing to the uncompressed files.
-for file in `find debian/tmp -type l`; do
-       DIRECTORY=`expr $file : "\(.*\)/[^/]*"`
-       NAME=`expr $file : ".*/\([^/]*\)"`
-       LINKVAL=`ls -l $DIRECTORY/$NAME | awk '{ print $11;}'`
-       if [ ! -e $DIRECTORY/$LINKVAL -a -f $DIRECTORY/$LINKVAL.gz ]; then
-               doit "rm $DIRECTORY/$NAME"
-               doit "ln -s $LINKVAL.gz $DIRECTORY/$NAME.gz"
-       fi
-done
+use Cwd;
+BEGIN { push @INC, "debian", "/usr/share/debhelper" }
+use Dh_Lib;
+init();
+
+foreach $PACKAGE (@{$dh{DOPACKAGES}}) {
+       $TMP=tmpdir($PACKAGE);
+       $compress=pkgfile($PACKAGE,"compress");
+
+       # Run the file name gathering commands from within the directory
+       # structure that will be effected.
+       $olddir=getcwd();
+       verbose_print("cd $TMP");
+       chdir($TMP) || error("Can't cd to $TMP: $!");
+
+       # Figure out what files to compress.
+       @files=();
+       # First of all, deal with any files specified right on the command line.
+       if (($PACKAGE eq $dh{FIRSTPACKAGE} || $dh{PARAMS_ALL}) && @ARGV) {
+               push @files,#ARGV;
+       }
+       if ($compress) {
+               # The config file is a sh script that outputs the files to be compressed
+               # (typically using find).
+               push @files, split(/\n/,`sh $olddir/$compress 2>/dev/null`);
+       }
+       else {
+               # By default, fall back to what the policy manual says to compress.
+               # Note that all the excludes of odd things like _z are because
+               # gzip refuses to compress such files, assumming they are zip files.
+               # I looked at the gzip source to get the complete list of such
+               # extentions: ".gz", ".z", ".taz", ".tgz", "-gz", "-z", "_z"
+               
+               push @files, split(/\n/,`
+                       find usr/info usr/share/info usr/man usr/share/man usr/X11*/man -type f ! -name "*.gz" 2>/dev/null || true;
+                       find usr/doc usr/share/doc -type f \\( -size +4k -or -name "changelog*" \\) \\
+                               \\( -name changelog.html -or ! -name "*.htm*" \\) \\
+                               ! -name "*.gif" ! -iname "*.gz" \\
+                               ! -iname "*.taz" ! -iname "*.tgz" ! -iname "*.z" \\
+                               ! -iname "*-gz" ! -iname "*-z" ! -iname "*_z" \\
+                               ! -name "copyright" 2>/dev/null || true
+               `);
+       }
+
+       # Exclude files from compression.
+       if (@files && defined($dh{EXCLUDE}) && $dh{EXCLUDE}) {
+               @new=();
+               foreach (@files) {
+                       $ok=1;
+                       foreach $x (@{$dh{EXCLUDE}}) {
+                               if (/\Q$x\E/) {
+                                       $ok='';
+                                       last;
+                               }
+                       }
+                       push @new,$_ if $ok;
+               }
+               @files=@new;
+       }
+       
+       # Look for files with hard links. If we are going to compress both,
+       # we can preserve the hard link across the compression and save
+       # space in the end.
+       my @f=();
+       my %hardlinks;
+       foreach (@files) {
+               ($dev, $inode, undef, $nlink)=stat($_);
+               if ($nlink > 1) {
+                       if (! $seen{"$inode.$dev"}) {
+                               $seen{"$inode.$dev"}=$_;
+                               push @f, $_;
+                       }
+                       else {
+                               # This is a hardlink.
+                               $hardlinks{$_}=$seen{"$inode.$dev"};
+                       }
+               }
+               else {
+                       push @f, $_;
+               }
+       }
+
+       if (@f) {
+               xargs(\@f,"gzip","-9f");
+       }
+       
+       # Now change over any files we can that used to be hard links so
+       # they are again.
+       foreach (keys %hardlinks) {
+               # Remove old file.
+               doit("rm","-f","$_");
+               # Make new hardlink.
+               doit("ln","$hardlinks{$_}.gz","$_.gz");
+       }
+
+       verbose_print("cd $olddir");
+       chdir($olddir);
+
+       # Fix up symlinks that were pointing to the uncompressed files.
+       open (FIND,"find $TMP -type l |");
+       while (<FIND>) {
+               chomp;
+               ($directory)=m:(.*)/:;
+               $linkval=readlink($_);
+               if (! -e "$directory/$linkval" && -e "$directory/$linkval.gz") {
+                       doit("rm","-f",$_);
+                       doit("ln","-sf","$linkval.gz","$_.gz");
+               }
+       }
+}
index 06087b8edcf7a903b1300022ea3480d51ffeb8e9..92f5b516352eb4b149845646c0bbac0595928c37 100644 (file)
@@ -1,9 +1,9 @@
-.TH DH_COMPRESS 1
+.TH DH_COMPRESS 1 "" "Debhelper Commands" "Debhelper Commands"
 .SH NAME
 dh_compress \- compress files and fix symlinks in package build directories
 .SH SYNOPSIS
 .B dh_compress
-.I "[-v] [-a] [-i] [-ppackage]"
+.I "[debhelper options] [-Xitem] [-A] [file ...]"
 .SH "DESCRIPTION"
 dh_compress is a debhelper program that is responsible for compressing
 the files in package build directories, and makes sure that any symlinks
@@ -13,56 +13,61 @@ to the new files.
 By default, dh_compress compresses files that debian policy mandates should
 be compressed, namely all files in usr/info, usr/man, usr/X11R6/man, and
 all files in usr/doc that are larger than 4k in size, except
-the copyright file, .html files and .gif files.
+the copyright file, .html files and .gif files, and all changelog files. It
+skips any files that appear to be already compressed (based on their
+extentions).
 .P
-If a debian/compress file exits, however, it will be ran as a shell script,
-and all filenames that the shell script outputs will be compressed instead
-of the default files. Note that the shell script will be run from inside the
-package build directory.
+If a debian/package.compress file exists (debian/compress may be used for the
+first binary package in debian/control), however, it will be ran as a shell
+script, and all filenames that the shell script outputs will be compressed
+instead of the default files. Note that the shell script will be run from
+inside the package build directory.
 .SH EXAMPLE
 Here is a sample debian/compress file that causes dh_compress to compress
 the same files as it would by default. This is a good starting point for
 customization of what files are compressed:
 .PP
- find usr/info usr/man usr/X11*/man -type f
- find usr/doc -type f -size +4k \\
-       ! -name "*.htm*" ! -name "*.gif" \\
+ find usr/info usr/share/info usr/man usr/share/man usr/X11*/man -type f ! -name "*.gz"
+ find usr/doc usr/share/doc -type f \\ 
+       \\( -size +4k -or -name "changelog*" \\) \\
+       \\( -name changelog.html -or ! -name "*.htm*" \\) \\
+       ! -name "*.gif" ! -iname "*.gz" \\
+       ! -iname "*.taz" ! -iname "*.tgz" ! -iname "*.z" \\
        ! -name "copyright"
 .SH OPTIONS
 .TP
-.B \-v
-Verbose mode; show all commands that modify the package build directory.
+.B debhelper options
+See
+.BR debhelper (1)
+for a list of options common to all debhelper commands.
 .TP
-.B \-a
-Compress files for all architecture dependent packages.
+.B \-Xitem, \--exclude=item
+Exclude files that contain "item" anywhere in their filename from being
+compressed. For example, -X.jpeg will exclude jpeg's from compression.
+You may use this option multiple times to build up a list of things to
+exclude. You can accomplish the same thing by using a debian/compress file,
+but this is easier.
 .TP
-.B \-i
-Compress files for all architecture independent packages.
+.B \-A, \--all
+Compress all files specified by command line parameters in ALL packages
+acted on.
 .TP
-.B \-ppackage
-Compress files for the package named "package".
+.B file ...
+Add these files to the list of files to compress.
 .SH NOTES
-The
-.B \-a
-.B \-i
-and
-.B \-p
-arguments are cumulative. If none are specified, then all packages listed in
-the control file will have their files compressed.
-.P
 The debian/compress file applies to the first binary package listed in your
 control file. For the other packages, you can make files named
 debian/package.compress, where "package" is the name of the package they 
-apply to.
+apply to. (This works for the first binary package too.)
 .SH ENVIRONMENT
-.TP
-.I DH_VERBOSE
-Enables verbose mode
+See
+.BR debhelper (1)
+for a list of environment variables that affect all debhelper commands.
 .SH "SEE ALSO"
-.BR /usr/doc/debhelper/README
+.BR debhelper (1)
 .SH BUGS
 Filenames with spaces in them may not properly be compressed.
 .SH "CONFORMS TO"
-Debian policy, version 2.3.0.0
+Debian policy, version 3.0.0.0
 .SH AUTHOR
 Joey Hess <joeyh@master.debian.org>
index e6ebf0b0015b3b1cdae50331f63d9ba21e0cc4a0..926c38c6aa6f591e38f39f514949380e021c0fe8 100755 (executable)
@@ -1,41 +1,78 @@
 #!/usr/bin/make -f
-# Sample debian/rules that uses debhelper. GNU copyright 1997 by Joey Hess.
+# Sample debian/rules that uses debhelper.
+# GNU copyright 1997 to 1999 by Joey Hess.
+
+# Uncomment this to turn on verbose mode.
+#export DH_VERBOSE=1
+
+# This is the debhelper compatability version to use.
+export DH_COMPAT=1
 
 build: build-stamp
 build-stamp:
        dh_testdir
-       # Add here commands to compile the pacckage.
+
+       # Add here commands to compile the package.
        #$(MAKE)
+
        touch build-stamp
 
 clean:
        dh_testdir
        dh_testroot
-       dh_cleantmp
+       rm -f build-stamp install-stamp
+
        # Add here commands to clean up after the build process.
+       #-$(MAKE) clean
        #-$(MAKE) distclean
-       rm -f build-stamp
+
+       dh_clean
+
+install: install-stamp
+install-stamp: build-stamp
+       dh_testdir
+       dh_testroot
+       dh_clean -k
+       dh_installdirs
+
+       # Add here commands to install the package into debian/tmp.
+       #$(MAKE) prefix=`pwd`/debian/tmp/usr install
+
+       touch install-stamp
 
 # Build architecture-independent files here.
-binary-indep: build
-       # We have nothing to do by default.
+binary-indep: build install
+# We have nothing to do by default.
 
 # Build architecture-dependent files here.
-binary-arch: build
+binary-arch: build install
+#      dh_testversion
        dh_testdir
        dh_testroot
-       dh_cleantmp
-       # Add here commands to install the files into debian/tmp
-       #$(MAKE) PREFIX=debian/tmp install
        dh_installdocs
        dh_installexamples
        dh_installmenu
+#      dh_installemacsen
+#      dh_installpam
+#      dh_installinit
+       dh_installcron
        dh_installmanpages
+       dh_installinfo
+#      dh_undocumented
        dh_installchangelogs
+       dh_link
+       dh_strip
        dh_compress
-       dh_installdebfiles
        dh_fixperms
+       # You may want to make some executables suid here.
+       dh_suidregister
+#      dh_makeshlibs
+       dh_installdeb
+#      dh_perl
+       dh_shlibdeps
+       dh_gencontrol
+       dh_md5sums
        dh_builddeb
 
 binary: binary-indep binary-arch
-.PHONY: build clean binary-indep binary-arch binary
+.PHONY: build clean binary-indep binary-arch binary install
index a257a1971a33d44b1414d746208279a24727fcf1..55802f317c0d2334315d2835ca2944e705738885 100755 (executable)
@@ -1,56 +1,77 @@
 #!/usr/bin/make -f
-# Sample debian/rules that uses debhelper. GNU copyright 1997 by Joey Hess.
-# This version is for packages that are architecure independant.
+# Sample debian/rules that uses debhelper. 
+# GNU copyright 1997 to 1999 by Joey Hess.
+#
+# This version is for packages that are architecture independent.
 
 # Uncomment this to turn on verbose mode.
 #export DH_VERBOSE=1
 
+# This is the debhelper compatability version to use.
+export DH_COMPAT=1
+
 build: build-stamp
 build-stamp:
        dh_testdir
-       # Add here commands to compile the pacckage.
+
+       # Add here commands to compile the package.
        #$(MAKE)
+
        touch build-stamp
 
 clean:
        dh_testdir
        dh_testroot
-       rm -f build-stamp
+       rm -f build-stamp install-stamp
+
        # Add here commands to clean up after the build process.
+       #-$(MAKE) clean
        #-$(MAKE) distclean
+
        dh_clean
 
-# Build architecture-independent files here.
-binary-indep: build
+install: install-stamp
+install-stamp: build-stamp
        dh_testdir
        dh_testroot
-       dh_clean
+       dh_clean -k
        dh_installdirs
-        # Add here commands to install the files into debian/tmp
-        #$(MAKE) PREFIX=debian/tmp install
+
+       # Add here commands to install the package into debian/tmp.
+       #$(MAKE) prefix=`pwd`/debian/tmp/usr install
+
+       touch install-stamp
+
+# Build architecture-independent files here.
+binary-indep: build install
+#      dh_testversion
+       dh_testdir
+       dh_testroot
        dh_installdocs
        dh_installexamples
        dh_installmenu
+#      dh_installemacsen
+#      dh_installpam
 #      dh_installinit
        dh_installcron
 #      dh_installmanpages
+       dh_installinfo
 #      dh_undocumented
        dh_installchangelogs
+       dh_link
        dh_compress
        dh_fixperms
+       # You may want to make some executables suid here.
        dh_suidregister
        dh_installdeb
+#      dh_perl
        dh_gencontrol
-       dh_du
        dh_md5sums
        dh_builddeb
 
 # Build architecture-dependent files here.
-binary-arch: build
+binary-arch: build install
 # We have nothing to do by default.
 
-source diff:
-       @echo >&2 'source and diff are obsolete - use dpkg-source -b'; false
-
 binary: binary-indep binary-arch
-.PHONY: build clean binary-indep binary-arch binary
+.PHONY: build clean binary-indep binary-arch binary install
index 118737cb5462d8dae87a42a0f1cd410fe313c0c8..6c6c406c027bd99485af71f86f3cd55d49c67f0e 100755 (executable)
 #!/usr/bin/make -f
-# Sample debian/rules that uses debhelper. GNU copyright 1997 by Joey Hess.
+# Sample debian/rules that uses debhelper. 
+# GNU copyright 1997 by Joey Hess.
+#
 # This version is for a hypothetical package that builds an
-# architecture-dependant package, as well as an architecture-independant
+# architecture-dependant package, as well as an architecture-independent
 # package.
 
 # Uncomment this to turn on verbose mode. 
 #export DH_VERBOSE=1
 
+# This is the debhelper compatability version to use.
+export DH_COMPAT=1
+
+# This has to be exported to make some magic below work.
+export DH_OPTIONS
+
 build: build-stamp
 build-stamp:
        dh_testdir
-       # Add here commands to compile the pacckage.
+
+       # Add here commands to compile the package.
        #$(MAKE)
+
        touch build-stamp
 
 clean:
        dh_testdir
        dh_testroot
-       rm -f build-stamp
-       dh_clean
+       rm -f build-stamp install-stamp
+
        # Add here commands to clean up after the build process.
+       #-$(MAKE) clean
        #-$(MAKE) distclean
 
+       dh_clean
+
+install: install-stamp
+install-stamp: DH_OPTIONS=
+install-stamp: build-stamp
+       dh_testdir
+       dh_testroot
+       dh_clean -k
+       dh_installdirs
+
+       # Add here commands to install the package into debian/tmp.
+       #$(MAKE) prefix=`pwd`/debian/tmp/usr install
+
+       dh_movefiles
+       touch install-stamp
+
 # Build architecture-independent files here.
-binary-indep: build
-       dh_testdir -i
-       dh_testroot -i
-       dh_clean -i
-        # Add here commands to install the files into debian/tmp
-        #$(MAKE) PREFIX=debian/tmp install
-       dh_installdocs -i
-       dh_installexamples -i
-       dh_installmenu -i
-#      dh_installmanpages -i
-       dh_installchangelogs -i
-       dh_compress -i
-       dh_installdebfiles -i
-       dh_fixperms -i
-       dh_builddeb -i
+# Pass -i to all debhelper commands in this target to reduce clutter.
+binary-indep: DH_OPTIONS="-i"
+binary-indep: build install
+       # Need this version of debhelper for DH_OPTIONS to work.
+       dh_testversion 1.1.17
+       dh_testdir
+       dh_testroot
+       dh_installdocs
+       dh_installexamples
+       dh_installmenu
+#      dh_installemacsen
+#      dh_installpam
+#      dh_installinit
+       dh_installcron
+#      dh_installmanpages
+       dh_installinfo
+#      dh_undocumented
+       dh_installchangelogs
+       dh_link
+       dh_compress
+       dh_fixperms
+       # You may want to make some executables suid here.
+       dh_suidregister
+       dh_installdeb
+#      dh_perl
+       dh_gencontrol
+       dh_md5sums
+       dh_builddeb
 
 # Build architecture-dependent files here.
-binary-arch: build
-       dh_testdir -a
-       dh_testroot -a
-       dh_clean -a
-       # Add here commands to install the files into debian/tmp
-       #$(MAKE) PREFIX=debian/tmp install
-       dh_installdocs -a
-       dh_installexamples -a
-       dh_installmenu -a
-       dh_installmanpages -a
-       dh_installchangelogs -a
-       dh_compress -a
-       dh_installdebfiles -a
-       dh_fixperms -a
-       dh_builddeb -a
+# Pass -a to all debhelper commands in this target to reduce clutter.
+binary-indep: DH_OPTIONS="-a"
+binary-arch: build install
+       # Need this version of debhelper for DH_OPTIONS to work.
+       dh_testversion 1.1.17
+       dh_testdir
+       dh_testroot
+       dh_installdocs
+       dh_installexamples
+       dh_installmenu
+#      dh_installemacsen
+#      dh_installpam
+#      dh_installinit
+       dh_installcron
+#      dh_installmanpages
+       dh_installinfo
+#      dh_undocumented
+       dh_installchangelogs
+       dh_strip
+       dh_link
+       dh_compress
+       dh_fixperms
+       # You may want to make some executables suid here.
+       dh_suidregister
+       dh_installdeb
+#      dh_makeshlibs
+#      dh_perl
+       dh_shlibdeps
+       dh_gencontrol
+       dh_md5sums
+       dh_builddeb
 
 binary: binary-indep binary-arch
-.PHONY: build clean binary-indep binary-arch binary
+.PHONY: build clean binary-indep binary-arch binary install
diff --git a/examples/rules.multi2 b/examples/rules.multi2
new file mode 100755 (executable)
index 0000000..30c9b41
--- /dev/null
@@ -0,0 +1,96 @@
+#!/usr/bin/make -f
+# Sample debian/rules that uses debhelper.
+# GNU copyright 1997 to 1999 by Joey Hess.
+#
+# This version is for a multibinary package. It also allows you to build any
+# of the binary packages independantly, via binary-<package> targets.
+
+# Uncomment this to turn on verbose mode. 
+#export DH_VERBOSE=1
+
+# This is the debhelper compatability version to use.
+export DH_COMPAT=1
+
+# This has to be exported to make some magic below work.
+export DH_OPTIONS
+
+build: build-stamp
+build-stamp:
+       dh_testdir
+
+       # Add here commands to compile the package.
+       #$(MAKE)
+
+       touch build-stamp
+
+clean:
+       dh_testdir
+       dh_testroot
+       rm -f build-stamp install-stamp
+
+       # Add here commands to clean up after the build process.
+       #-$(MAKE) clean
+       #-$(MAKE) distclean
+
+       dh_clean
+
+install: DH_OPTIONS=
+install:
+       dh_testdir
+       dh_testroot
+       dh_clean -k
+       dh_installdirs
+
+       # Add here commands to install the package into debian/tmp.
+       #$(MAKE) prefix=`pwd`/debian/tmp/usr install
+
+       dh_movefiles
+       touch install-stamp
+
+# This single target is used to build all the packages, all at once, or
+# one at a time. So keep in mind: any options passed to commands here will
+# affect _all_ packages. Anything you want to only affect one package
+# should be put in another target, such as the install target.
+binary-common:
+       # Need this version of debhelper for DH_OPTIONS to work.
+       dh_testversion 1.1.17
+       dh_testdir
+       dh_testroot
+       dh_installdocs
+       dh_installexamples
+       dh_installmenu
+#      dh_installemacsen
+#      dh_installpam
+#      dh_installinit
+       dh_installcron
+#      dh_installmanpages
+       dh_installinfo
+#      dh_undocumented
+       dh_installchangelogs
+       dh_link
+       dh_compress
+       dh_fixperms
+       dh_suidregister
+#      dh_makeshlibs
+       dh_installdeb
+#      dh_perl
+       dh_shlibdeps
+       dh_gencontrol
+       dh_md5sums
+       dh_builddeb
+
+# Build architecture independant packages using the common target.
+# (Comment this out if you have none to build.)
+binary-indep: DH_OPTIONS=-i
+binary-arch: build install binary-common
+
+# Build architecture dependant packages using the common target.
+binary-arch: DH_OPTIONS=-a
+binary-arch: build install binary-common
+
+# Any other binary targets build just one binary package at a time.
+binary-%: build install
+       make -f debian/rules binary-common DH_OPTIONS=-p$*
+
+binary: binary-indep binary-arch
+.PHONY: build clean binary-indep binary-arch binary install