Description: development helper
 These are meant to help Derivations development, but is not needed
 to use it in any way. Read helper/README to know more about it.
Author: Marc Dequènes (Duck) <Duck@DuckCorp.org>

---
The information above should follow the Patch Tagging Guidelines, please
checkout http://dep.debian.net/deps/dep3/ to learn about the format. Here
are templates for supplementary fields that you might want to add:

Origin: <vendor|upstream|other>, <url of original patch>
Bug: <url in upstream bugtracker>
Bug-Debian: http://bugs.debian.org/<bugnumber>
Bug-Ubuntu: https://launchpad.net/bugs/<bugnumber>
Forwarded: <no|not-needed|url proving that it has been forwarded>
Reviewed-By: <name and email of someone who approved the patch>
Last-Update: <YYYY-MM-DD>

--- /dev/null
+++ derivations-0.52.20100310/helper/RelSteps
@@ -0,0 +1,164 @@
+
+------------------------------------------------------------------------
+
+DEVELOPMENT AND RELEASE STEPS
+
+------------------------------------------------------------------------
+
+Although one need not develop Derivations in a Debian GNU/Linux
+environment, the author---who happens to be a Debian user and
+developer---does so.  This file documents some of the author's
+development practices in that context.  (The file does not carefully
+distinguish between actions the author takes as upstream developer and
+actions he takes as Debian developer, though the two roles are indeed
+logically distinct.)
+
+In all the file,
+
+  * $D1 represents the top development directory;
+    for example, ~/der/derivations-0.5.20070322.
+  * $DW represents the top development directory before it has been
+    assigned an actual revision date (see $TW below).
+  * $DL represents the top development directory of the last revision.
+  * $DP represents $D1/.., $DW/.. and $DL/.., the parent
+    of the top development directory, as ~/der.
+  * $T1 represents the revision date; for example 20070322.
+  * $TW represents the working revision date, inasmuch as the actual
+    revision date normally is not known until release time.  (For this
+    date, the author usually but not always chooses the next day not a
+    Sunday following the actual date of the last revision.)
+  * $DSC represents the Debian .dsc file, where the needed Debian source
+    package files in $DP are as
+
+        derivations_0.5.20070322.orig.tar.gz
+        derivations_0.5.20070322-1.diff.gz
+        derivations_0.5.20070322-1.dsc
+
+  * $DIFFGZ and $ORIGTARGZ represent the .diff.gz and .orig.tar.gz
+    as above.
+  * $DEB represents the Debian binary package,
+    as derivations_0.5.20070322-1_all.deb.
+
+The file naturally is not a complete set of instructions, being rather
+notes to jog the author's memory.  For example, the file does not
+explain what the command "view foo" is for, though of course it is for
+the author to review foo to ensure that all is in order, making
+corrections if necessary.  However, there is probably enough information
+here to be of use to a future developer.
+
+------------------------------------------------------------------------
+BEGINNING DEVELOPMENT OF A NEW REVISION
+------------------------------------------------------------------------
+
+The author opens development of a new revision of the book by
+approximately the following steps.
+
+1.  Optionally, or if $DL does not exist,
+
+    cd $DP
+    rm -R $DL || true
+    dpkg-source -x $DSC
+    cd $DL
+    bash helper/letexec
+    cd ..
+
+2.  Give the commands
+
+    cd $DL
+    fakeroot debian/rules clean
+    cd ..
+    cp -ai $DL $DW
+    cd $DW
+    helper/extend-changelog
+    helper/update-date $TW
+
+------------------------------------------------------------------------
+RELEASING
+------------------------------------------------------------------------
+
+The author closes development of a new revision of the book and prepares
+it for release by approximately the following steps.
+
+1.  Decide on an official revision date, then
+
+    cd $DP
+    mv -i $DW $D1
+    cd $D1
+    helper/update-date $T1
+    fakeroot debian/rules clean
+    helper/buffe-src
+
+2.  Repeatedly give the following commands, making corrections as
+indicated, until no further corrections remain to be made:
+
+    helper/ispell-all
+    make clean tex/check | less
+    fakeroot debian/rules clean
+    helper/buffe-src
+
+During the "make tex/check", index entries can overfill their margins
+by any amount less than 9.0pt.  Where necessary (hopefully not often),
+any page can be less than 2.0pt too tall.  (These limits may be too
+strait, but experience has not yet asked the author to judge looser
+limits; so, these are the limits to enforce for now.)
+
+3.  Finalize doc/changelog and debian/changelog with the following
+commands.  Change the distribution in debian/changelog from experimental
+to unstable if appropriate.
+
+    cd ..
+    diff -ruN $DL $D1 >diff
+    grep -B3 -A3 '19\(69\|70\)' diff
+    view diff
+    cd $D1
+    vim doc/changelog
+    vim debian/changelog
+    fakeroot debian/rules clean
+    helper/buffe-src
+    cd ..
+    diff -ruN $DL $D1 >diff
+    grep -B3 -A3 '19\(69\|70\)' diff
+    cd $D1
+
+4.  Optionally,
+
+    fakeroot debian/rules cleandeb-force
+
+5.  Because the author actually uses the Debianized source to develop,
+create a non-Debianized upstream source by
+
+    fakeroot debian/rules orig
+
+6.  Omitting the -uc and -us if it is wanted actually digitally to sign
+the sources, build source and binary package files by
+
+    dpkg-buildpackage -rfakeroot -uc -us
+    fakeroot debian/rules clean
+    cd ..
+
+7.  Optionally review the .diff.gz to ensure that it actually contains
+the Debianization as it ought.
+
+8.  Give the command
+
+    sudo dpkg -i $DEB
+
+9.  Check that it has seemed to install correctly.
+
+10. Optionally upload.
+
+------------------------------------------------------------------------
+
+For lack of a better place to note it, it is here noted that the author
+might check the following on completing a chapter:
+
+  * /\~\$                       (short math)
+  * /\(^\|[[:space:]]\)\$       (long math)
+  * /\$\('s\|th\)\([^a-z]\|$\)  (no tied *'s or *th)
+  * /}[,.?;:!]                  (\emph{text[,.?;:!]})
+  * /\\\\                       (no \\ at the end of an array or eqnarray)
+  * /\(^\|[[:space:]]\)(\\ref{  (no untied eqn references)
+  * /^[[:space:]]*\\emph        (no \emph inadvertently in place of \index)
+  * /\\index.*\![[:space:]]     (no space following `!' in \index)
+  * /bad break                  (bad breaks are in fact bad)
+
--- /dev/null
+++ derivations-0.52.20100310/helper/buffe-src
@@ -0,0 +1,16 @@
+#! /bin/bash -e
+
+# (See the notes in `./buff-expand'.)
+#
+# This script is successfully called from the main source directory as
+# `helper/buffe-src'.  It buffs and expands all the source files, except
+# that it only buffs the two Makefiles `Makefile' and `debian/rules'.
+
+BUFFE='helper/buff-expand -M'
+for F in `find .` ; do
+  if [ -f $F ] ; then
+    $BUFFE $F
+    echo   $F
+  fi
+done
+
--- /dev/null
+++ derivations-0.52.20100310/helper/make-readme
@@ -0,0 +1,271 @@
+#! /usr/bin/perl
+use warnings;
+use strict;
+use integer;
+use FindBin;
+use lib $FindBin::RealBin;
+use Def;
+
+# This script generates an appropriate README from the following listed
+# sections of the manpage.  It clobbers the existing README.
+#
+# (This highly specialized helper script is perhaps the result of
+# overenthusiasm.  It automates an otherwise slightly annoying
+# package-maintenance task, but in retrospect it is not clear that the
+# effort spent in writing the script justifies the gain.  Nevertheless,
+# I like the script.  Here it is.  ---THB---)
+#
+# (By the way, I thought about extending the script to autogenerate the
+# long description in debian/control.  However, overenthusiasm has
+# bounds.  The long description is twenty times as important as the
+# README.  It merits manual crafting.  But maybe we should generate the
+# manpage "SUMMARY" section from the long description?  No, not
+# today.  ---THB---)
+#
+# The Makefile and debian/rules probably should not invoke this script.
+# Probably only the developer should invoke it, manually, if and when he
+# wants to.
+#
+# As a developer, you do not need to use this script.  You can write
+# your own README if you want to.  The only reason the script exists is
+# that the author couldn't really think of anything at the moment to
+# write in the README which wasn't already in the manpage, but if you
+# can think of something else to write there, go right ahead.  However,
+# if you do use this script and if you modify it, note the "Make special
+# corrections" block below.
+#
+# One possible use of this script is to autogenerate a candidate README
+# which you then manually edit.
+
+# Relevant manpage sections.
+our @sh = (
+  'DESCRIPTION',
+  'READING THE BOOK',
+  'AUTHOR',
+);
+
+our $marker        = "\001";
+our $headlead_trad = 'The Debian Package';
+our $mark_lic      = qr/^Copyright\s+\(C\)/;
+our $time_dflt     = '00:00:00 +0000';
+our $cmd_date      = 'date -uRd';
+our $cmd_fmt       = "fmt -w${Def::width} -u";
+our $cmd_tempfile  = 'tempfile';
+
+my $manpage  = "${FindBin::RealBin}/../doc/${Def::out}.${Def::mansect}";
+my $deb_cprt = "${FindBin::RealBin}/../debian/copyright";
+my $readme   = "${FindBin::RealBin}/../${Def::name_readme}";
+my $bar      = '-' x ${Def::width} ."\n";
+my $mp_date;
+my $mp_author;
+my $mp_title;
+
+# Subroutine: splice lines ending in backslash-newline.
+sub splice_lines (;\@) {
+  local $_ = @_ ? shift : \$_;
+  for my $i ( reverse 0 .. $#$_ ) {
+    chomp $_->[$i];
+    next unless $_->[$i] =~ /\\$/;
+    chop  $_->[$i];
+    splice @$_, $i, 2, $_->[$i] . $_->[$i+1] . "\n" if $i < $#$_;
+  }
+  $_ .= "\n" for @$_;
+  return $_;
+}
+
+our @escape_save = ();
+# Subroutines: recognize, convert, save and restore escaped characters.
+sub escape (;\$) {
+  local $_ = @_ ? shift : \$_;
+  @escape_save = ();
+  $$_ =~ /$marker/ and die "$0: marker character is reserved\n";
+  my $ends_newline = $$_ =~ /\n\z/;
+  chomp $$_;
+  {
+    my $i;
+    while ( ( $i = index $$_, '\\' ) >= 0 ) {
+      substr( $$_, $i, 5 ) =~ /^\\\*\(/
+        and push( @escape_save, substr( $$_, $i, 5, $marker ) ), next;
+      substr( $$_, $i, 4 ) =~ /^\\\(/
+        and push( @escape_save, substr( $$_, $i, 4, $marker ) ), next;
+      push( @escape_save, substr( $$_, $i, 2, $marker ) );
+    }
+  }
+  $$_ .= "\n" if $ends_newline;
+  return $$_;
+}
+sub convescape () {
+  for ( @escape_save ) {
+    $_ =~ /^\\&$/       and $_ = ''   , next;
+    $_ =~ /^\\-$/       and $_ = '-'  , next;
+    $_ =~ /^\\\(em$/i   and $_ = '---', next;
+    $_ =~ /^\\\*\(lq$/i and $_ = '"'  , next;
+    $_ =~ /^\\\*\(rq$/i and $_ = '"'  , next;
+  }
+}
+sub unescape (;\$) {
+  local $_ = @_ ? shift : \$_;
+  while ( @escape_save ) {
+    my $c = shift @escape_save;
+    $$_ =~ s/$marker/$c/;
+  }
+  @escape_save = ();
+  return $$_;
+}
+sub convall (;\$) {
+  local $_ = @_ ? shift : \$_;
+  defined $$_ or return $$_;
+  escape   $$_;
+  convescape  ;
+  unescape $$_;
+  return   $$_;
+}
+
+# Subroutine: dequote a quoted string.
+sub dequote (;\$) {
+  local $_ = @_ ? shift : \$_;
+  chomp    $$_;
+  escape   $$_;
+  $$_ =~ s/^\s*"([^"]*?)"\s*$/$1/;
+  unescape $$_;
+  return   $$_;
+}
+
+# Subroutine: collapse an alternating emphasizor.
+sub collapse (;\$) {
+  local $_ = @_ ? shift : \$_;
+  chomp    $$_;
+  escape   $$_;
+  my @w = $$_ =~ /"[^"]*?"|[^"\s]+/g;
+  dequote for @w;
+  $$_ = join( '', @w );
+  unescape $$_;
+  return   $$_;
+}
+
+# Subroutine: format text to a maximum width.
+sub format_text (@) {
+  my $file = `$cmd_tempfile`; chomp $file;
+  open  FILE, '>', $file;
+    print FILE @_;
+  close FILE;
+  my @ret = `$cmd_fmt $file`;
+  unlink $file;
+  return @ret;
+}
+
+# Read the manpage in.
+my @man;
+open  MAN, '<', $manpage;
+  @man = <MAN>;
+close MAN;
+splice_lines @man;
+
+# Parse the manpage.
+my %sect;
+{
+  my $sh;
+  my $text = [];
+  for ( @man ) {
+    next unless /\S/;
+    my( $cmd, $arg ) = /^\.(\S+)(?:\s+(\S(?:.*?\S)??))??\s*$/;
+    if ( defined $cmd ) {
+      if    ( $cmd =~ /^(?:B|I)$/i ) {
+        dequote       $arg;
+        $_         = "$arg\n";
+        $cmd       = undef;
+      }
+      elsif ( $cmd =~ /^(?:BR|RB|IR|RI|BI|IB)$/i ) {
+        collapse      $arg;
+        $_         = "$arg\n";
+        $cmd       = undef;
+      }
+      elsif ( $cmd =~ /^TH$/i ) {
+        ( $mp_date, $mp_author, $mp_title ) = $arg =~
+          /^.*"([^()"]*?)"\s*"([^()"]*?)"\s*"([^()"]*?)"\s*$/
+          or die "$0: cannot parse .TH line";
+      }
+      elsif ( $cmd =~ /^SH$/i ) {
+        $sect{$sh} = $text if defined $sh;
+        $text      = [];
+        $sh        = $arg;
+        dequote $sh;
+      }
+      elsif ( $cmd =~ /^PP$/i ) {
+        $_         = undef;
+        $cmd       = undef;
+      }
+      # (Ignore lines beginning with other commands.)
+    }
+    push @$text, $_ unless defined $cmd;
+  }
+  $sect{$sh} = $text if defined $sh;
+  $text = undef;
+  $sh   = undef;
+}
+
+# If debian/copyright exists, pull licensing text from it.
+my @lic;
+if ( -e $deb_cprt ) {
+  my @lic0;
+  open  CPRT, '<', $deb_cprt;
+  {
+    my $in = '';
+    while ( <CPRT> ) {
+      $in = '1' if /$mark_lic/;
+      $in or next;
+      push @lic0, $_;
+    }
+  }
+  close CPRT;
+  @lic = format_text @lic0;
+  unshift @lic, $bar, "\n";
+  push    @lic,       "\n";
+}
+
+# Calculate the manpage date, then prepare the readme's header and
+# footer.
+my $date = `$cmd_date '$mp_date $time_dflt'`; chomp $date;
+my @head = (
+  $Def::traditional_readme
+  ? $headlead_trad     . " ${Def::out}\n"
+  : ${Def::full_title} .             "\n"
+);
+my @foot = ( "${Def::author} <${Def::email}>\n", "$date\n" );
+if ( $Def::traditional_readme ) {
+  push @head, '-' x (length($head[0])-1) . "\n";
+}
+else {
+  unshift @head, $bar;
+  unshift @head, "\n";
+  push    @head, $bar;
+  unshift @foot, $bar;
+  push    @foot, "\n";
+}
+push @head, "\n";
+
+# Make special corrections.
+if ( defined $sect{'AUTHOR'} ) {
+  for ( @{ $sect{'AUTHOR'} } ) {
+    next if s/^(The book) (and this manpage are\b)/$1 is/;
+    next if s/^(${Def::out})$/'$1'/;
+    next if s/^(in which) (they are) (distributed.)/$1 the book is $3/;
+  }
+}
+
+# Build the readme.
+my @body0;
+for my $sh ( @sh ) {
+  defined $sect{$sh} or next;
+  convall for @{ $sect{$sh} };
+  push @body0, map { defined() ? $_ : "\n" } @{ $sect{$sh} };
+  push @body0, "\n";
+}
+my @body   = format_text @body0;
+my @readme = ( @head, @body, @lic, @foot );
+
+# Write the readme out.
+open  README, '>', $readme;
+  print README @readme;
+close README;
+
--- /dev/null
+++ derivations-0.52.20100310/helper/update-debver
@@ -0,0 +1,61 @@
+#! /usr/bin/perl
+use warnings;
+use strict;
+use integer;
+use FindBin;
+use lib $FindBin::RealBin;
+use Def;
+
+# This script adds or updates the Debian package version number at the
+# head of debian/changelog.
+
+our $usage = <<END;
+usage: $0 [-h] [debian-version]
+    -h print this usage message
+If no debian-version is given, then the package version number
+is removed from the changelog.
+END
+
+our $changelog_deb = "${FindBin::RealBin}/../debian/changelog";
+
+# Read command-line arguments and options.
+my @arg;
+my %opt;
+for ( @ARGV ) {
+  if ( my($o) = /^-(\S+)/ ) {
+    $opt{$_} = 1 for split //, $o;
+  }
+  else { push @arg, $_ }
+}
+if ( $opt{h} || $opt{'?'} ) {
+  print $usage;
+  exit 0;
+}
+my( $debver, $vdstr );
+if    ( @arg == 0 ) {
+  die $usage;
+  $debver = '';
+  $vdstr  = '';
+}
+elsif ( @arg == 1 ) {
+  $debver = shift @arg;
+  $vdstr  = "-$debver";
+}
+else { die $usage }
+
+# Read the changelog in.
+my @cld;
+open CL, '<', $changelog_deb;
+  @cld = <CL>;
+close CL;
+
+# Update the changelog's first line.
+$cld[0] =~
+  s/^(${Def::out} \(${Def::basever}\.\d+)((?:-\d+)?)(\))/$1$vdstr$3/
+  or die "$0: can't parse the first line of debian/changelog\n";
+
+# Write the changelog out.
+open CL, '>', $changelog_deb;
+  print CL @cld;
+close CL;
+
--- /dev/null
+++ derivations-0.52.20100310/helper/FilesTex
@@ -0,0 +1,26 @@
+main
+sphere
+pref
+intro
+alggeo
+trig
+drvtv
+cexp
+noth
+integ
+taylor
+inttx
+cubic
+matrix
+gjrank
+mtxinv
+eigen
+vector
+vcalc
+fours
+fouri
+stub
+hex
+greek
+purec
+hist
--- /dev/null
+++ derivations-0.52.20100310/helper/Def.pm
@@ -0,0 +1,24 @@
+use warnings;
+use strict;
+package Def;
+
+# This file defines common parameters for some of the helper scripts.
+
+our $out                = 'derivations';
+our $full_title         = 'Derivations of Applied Mathematics';
+our $author             = 'Thaddeus H. Black';
+our $email              = 'thb@derivations.org';
+our $email_deb          = 'thb@debian.org';
+our $width              = 72;
+our $basever            = '0.52';
+our $main0              = 'main';
+our $bib0               = 'bib';
+our $dist               = 'experimental';
+our $urgency            = 'low';
+our $mansect            = '7';
+our $name_readme        = 'README';
+our $traditional_readme = 0;
+our $cl_entry_dflt      = '[Add changelog entries here.]';
+
+1;
+
--- /dev/null
+++ derivations-0.52.20100310/helper/update-date
@@ -0,0 +1,218 @@
+#! /usr/bin/perl
+use warnings;
+use strict;
+use integer;
+use FindBin;
+use lib $FindBin::RealBin;
+use Def;
+
+# Before running this script, you should add a changelog entry (even an
+# empty one) for the current version, if you've not yet done so.  The
+# script modifies whichever entry happens to be at the changelog's top.
+#
+# This helper script automatically updates the package's issue date in
+# several files (the files are named in the following block).  The
+# script accepts date and time in any format the date(1) command
+# understands, but it writes the date (and time) to each file in that
+# file's appropriate format.  Example usage:
+#
+#   $ update-date '24 Jan 2005 21:00 +0000'
+#
+# If no time of day is given, it defaults to 00:00:00 +0000.
+#
+# When also running the helper/update-ver script, you probably want to
+# run that script first, then this one.  Otherwise debian/changelog is
+# updated in a different manner than you probably thought to update it.
+#
+# Note that the script does not change the name of the top-level source
+# directory.  This is for sanity's sake.  You must change the name of
+# the directory yourself.
+#
+# Note also that the self entry in bib.bib, where the book refers to
+# itself, must appear first to run this script.  If something else
+# appears first, the script may happily try to update that date,
+# instead.
+
+our $debian        = "${FindBin::RealBin}/../debian"               ;
+our $maintex       = "${FindBin::RealBin}/../tex/${Def::main0}.tex";
+our $mainbib       = "${FindBin::RealBin}/../tex/${Def::bib0}.bib" ;
+our $manpage       =
+  "${FindBin::RealBin}/../doc/${Def::out}.${Def::mansect}"         ;
+our $readme        = "${FindBin::RealBin}/../${Def::name_readme}"  ;
+our $changelog     = "${FindBin::RealBin}/../doc/changelog"        ;
+our $changelog_deb = "${debian}/changelog"                         ;
+our $copyright     = "${debian}/copyright"                         ;
+
+my $warn_msg = "$0: cannot find date line in ";
+
+our $usage = <<END;
+usage: $0 [-dcsh] date-time
+    -d update only the Debian-specific files
+    -c update only the Debian-specific files and doc/changelog
+    -s update only changelog signature dates
+    -h print this usage message
+END
+
+# Read command-line arguments and options.
+my @arg;
+my %opt;
+for ( @ARGV ) {
+  if ( my($o) = /^-(\S+)/ ) {
+    $opt{$_} = 1 for split //, $o;
+  }
+  else { push @arg, $_ }
+}
+if ( $opt{h} || $opt{'?'} ) {
+  print $usage;
+  exit 0;
+}
+
+# Determine which parts of the source to update in.
+my $do_main = !$opt{d} && !$opt{c} && !$opt{s};
+my $do_cl   = !$opt{d} ||  $opt{c};
+my $do_deb  = -e $debian;
+
+# Prepare date strings.
+my $ind;
+@arg == 1 && (
+  $ind = $arg[0] =~ /:/
+  ? `date -ud'$arg[0]'` : `date -ud'$arg[0] 00:00:00 +0000'`,
+  !$?
+) or die "usage: $0 date\n";
+my $date = `date -ud'$ind' +'%e %B %Y'`; $date =~ s/^\s*//; chomp $date;
+my $year = `date -ud'$ind' +'%Y'`      ; $year =~ s/^\s*//; chomp $year;
+my $verd = `date -ud'$ind' +'%Y%m%d'`  ; $verd =~ s/^\s*//; chomp $verd;
+my $cld  = `date -ud'$ind' -R`         ; $cld  =~ s/^\s*//; chomp $cld ;
+
+# Read files in.
+my( @main, @bib, @man, @cl, @rme, @cr, @cld );
+if ( $do_main ) {
+  open MAIN, '<', $maintex      ;
+  open BIB , '<', $mainbib      ;
+  open MAN , '<', $manpage      ;
+  open RME , '<', $readme       ;
+  open CR  , '<', $copyright    ;
+  @main = <MAIN>;
+  @bib  = <BIB> ;
+  @man  = <MAN> ;
+  @rme  = <RME> ;
+  @cr   = <CR>  ;
+  close MAIN;
+  close BIB ;
+  close MAN ;
+  close RME ;
+  close CR  ;
+}
+if ( $do_cl   ) {
+  open CL  , '<', $changelog    ;
+  @cl   = <CL>  ;
+  close CL  ;
+}
+if ( $do_deb  ) {
+  open CLD , '<', $changelog_deb;
+  @cld  = <CLD> ;
+  close CLD ;
+}
+
+if ( $do_main ) {
+
+  # Update the dates in the main TeX source file.
+  $_ = 0; ++$_ until $_ > $#main ||
+    $main[$_] =~
+      s/^(\\newcommand\{\\verdate\}\{)([^\{\}]+)(\})\s*?$/$1$date$3/;
+    $_ <= $#main or warn "$warn_msg$maintex\n";
+  $_ = 0; ++$_ until $_ > $#main ||
+    $main[$_] =~ s/^(Copyright \\copyright\\ \d+--)(\d+)/$1$year/;
+    $_ <= $#main or warn "$warn_msg$maintex\n";
+
+  # Update the date in the bibliography's (leading) self-entry.
+  $_ = 0; ++$_ until $_ > $#bib ||
+    $bib[$_] =~ s/^(\s*year=\{)([^\{\}]+)(\},)\s*?$/$1$date$3/;
+    $_ <= $#bib or warn "$warn_msg$mainbib\n";
+
+  # Update the dates on the manpage.
+  $man[0] =~ s/(")([^"]*?)("\s*\\)$/$1$date$3/
+    or warn "$warn_msg$manpage\n";
+  $_ = $#man; --$_ until $_ < 0 ||
+    $man[$_] =~ s/^(Copyright \(C\) \d+\\-)(\d+)/$1$year/;
+    $_ >= 0 or warn "$warn_msg$manpage\n";
+
+  # Update the date at the foot of the readme and the copyright year
+  # therein.
+  $_ = $#rme; --$_ until $_ < $#rme-1 ||
+    # $rme[$_] =~ s/^(.*, )([^,\n]*,[^,\n]*)$/$1$cld/;
+    $rme[$_] =~ s/^.*\S.*$/$cld/;
+    $_ >= $#rme-1 or warn "$warn_msg$readme\n";
+  --$_; --$_ until $_ < 0 ||
+    $rme[$_] =~ s/^(Copyright \(C\) \d+-)(\d+)/$1$year/;
+    $_ >= 0 or warn "$warn_msg$readme\n";
+
+  # Update the year in the copyright file.
+  $_ = 0; ++$_ until $_ > $#cr ||
+    $cr[$_] =~ s/^(Copyright \(C\) \d+-)(\d+)/$1$year/;
+    $_ <= $#cr or warn "$warn_msg$copyright\n";
+
+}
+
+if ( $do_cl ) {
+
+  # Update the dates in the main changelog.
+  unless ( $opt{s} ) {
+    $cl[0] =~ s/(\([^()]*\.)(\d+)([^().]*?\))/$1$verd$3/
+      or warn "$warn_msg$changelog\n";
+  }
+  {
+    my $authe = "${Def::author} <${Def::email}>";
+    $_ = 0; ++$_ until $_ > $#cl ||
+      $cl[$_] =~ s/^( -- $authe  )(\S(?:.*?\S)??)\s*$/$1$cld\n/;
+      $_ <= $#cl or warn "$warn_msg$changelog\n";
+  }
+
+}
+
+if ( $do_deb ) {
+
+  # Update the dates in the debian/changelog.
+  unless ( $opt{s} ) {
+    # Update the version date atop debian/changelog.
+    $cld[0] =~ s/(\([^()]*\.)(\d+)([^().]*?\))/$1$verd$3/
+      or warn "$warn_msg$changelog_deb\n";
+  }
+  {
+    my $authe = "${Def::author} <${Def::email_deb}>";
+    $_ = 0; ++$_ until $_ > $#cld ||
+      $cld[$_] =~ s/^( -- $authe  )(\S(?:.*?\S)??)\s*$/$1$cld\n/;
+      $_ <= $#cld or warn "$warn_msg$changelog_deb\n";
+  }
+
+}
+
+# Write updated files out.
+if ( $do_main ) {
+  open MAIN, '>', $maintex      ;
+  open BIB , '>', $mainbib      ;
+  open MAN , '>', $manpage      ;
+  open RME , '>', $readme       ;
+  open CR  , '>', $copyright    ;
+  print MAIN @main;
+  print BIB  @bib ;
+  print MAN  @man ;
+  print RME  @rme ;
+  print CR   @cr  ;
+  close MAIN;
+  close BIB ;
+  close MAN ;
+  close RME ;
+  close CR  ;
+}
+if ( $do_cl   ) {
+  open CL  , '>', $changelog    ;
+  print CL   @cl  ;
+  close CL  ;
+}
+if ( $do_deb  ) {
+  open CLD , '>', $changelog_deb;
+  print CLD  @cld ;
+  close CLD ;
+}
+
--- /dev/null
+++ derivations-0.52.20100310/helper/buff-expand
@@ -0,0 +1,121 @@
+#! /usr/bin/perl
+
+# This Perl script buffs (removes trailing blanks from) and/or expands
+# (converts tabs to spaces in) the files named on the command line.  It
+# also ensures that each file (if not empty) ends in a proper "\n".
+
+use warnings;
+use strict;
+use integer;
+
+our $tab               =  8;
+our $pat_makefile_name = qr/Makefile(?:[-.].*)?|rules/;
+our $usage             = <<END;
+usage: buff-expand [options] files
+    -s  do not overwrite the files; output to stdout instead
+    -B  do not buff
+    -X  do not expand
+    -L  do not expand leading tabs
+    -M  do not expand leading tabs
+          if the file basename is "Makefile" or "rules"
+    --  do not process further options
+    -h  print this usage message
+END
+
+my $process_opts    = 1;
+my $stdout          = 0;
+my $buff            = 1;
+my $lead            = 1;
+my $lead_makefile   = 1;
+my $expand          = 1;
+my @file = map {
+  eval {
+    if ( $process_opts and my ( $opts ) = /^-(.*)/ ) {
+      my @opts = split '', $opts;
+      @opts or $process_opts = 0;
+      for ( @opts ) {
+        $process_opts or next;
+        $_ eq '-' and $process_opts = 0, next;
+        $_ eq 's' and $stdout       = 1, next;
+        $_ eq 'B' and $buff         = 0, next;
+        $_ eq 'X' and $lead = 0, $lead_makefile = 0, $expand = 0, next;
+        $_ eq 'L' and $lead = 0, $lead_makefile = 0,              next;
+        $_ eq 'M' and            $lead_makefile = 0,              next;
+        $_ eq 'h' || $_ eq '?' and print($usage), exit(0);
+        print( STDERR $usage ), exit(1);
+      }
+      return ();
+    }
+    else {
+      return ( $_ );
+    }
+  }
+} @ARGV;
+
+sub buff_expand ($\$@) {
+  my $is_makefile = shift;
+  my $has_acted   = shift;
+  my @ret = map {
+    chomp( my $a = $_ );
+    if (
+      (  $is_makefile && $lead_makefile ) ||
+      ( !$is_makefile && $lead          )
+    ) { s/^\t/ {$tab}/ }
+    if ( $expand ) {
+      my $b = '';
+      my $t = '';
+      if ( my @b = split /\t/, $a ) {
+        $b  = shift @b;
+        if ( # if there is a leading tab we should preserve, then...
+          !length($b) && !(
+            (  $is_makefile && $lead_makefile ) ||
+            ( !$is_makefile && $lead          )
+          )
+        ) {
+          $t  = "\t";
+          $b .= shift @b if @b;
+        }
+        $b .= ' ' x ( $tab - length( $b ) % $tab ) . $_ for @b;
+      }
+      $a = $t . $b;
+    }
+    if ( $buff ) {
+      $a =~ s/\s*$//;
+    }
+    "$a\n";
+  } @_;
+  if ( @ret != @_ ) { $$has_acted = 1 }
+  else {
+    for my $i ( 0 .. $#_ ) {
+      $ret[$i] eq $_[$i] or $$has_acted = 1, last;
+    }
+  }
+  return wantarray ? @ret : $ret[0];
+}
+
+if ( @file ) {
+  for my $file ( @file ) {
+    my $is_makefile = $file =~ /(?:^|\/)${pat_makefile_name}$/;
+    open  FILE, '<', $file
+      or warn( "$0: cannot read $file\n" ), next;
+    my @line          = <FILE>;
+    close FILE;
+    my $has_acted     = 0;
+    my @buff_expanded = buff_expand $is_makefile, $has_acted, @line;
+    if    ( $stdout    ) {
+      print @buff_expanded;
+    }
+    elsif ( $has_acted ) {
+      open  FILE, '>', $file
+        or warn( "$0: cannot write $file\n" ), next;
+      print FILE @buff_expanded;
+      close FILE;
+    }
+  }
+}
+else {
+  my @line      = <>;
+  my $has_acted = 0;
+  print buff_expand 0, $has_acted, @line;
+}
+
--- /dev/null
+++ derivations-0.52.20100310/helper/ispell-all
@@ -0,0 +1,13 @@
+#! /bin/bash -e
+
+# Run this to check all appropriate source files with ispell, using (and
+# adding to) the local development dictionary.
+
+D=$( dirname $0 )
+ispell -x -p $D/dict \
+  $D/../tex/*.{tex,bib} \
+  $D/../doc/* \
+  $D/../debian/{changelog,control,copyright} \
+  $D/../helper/RelSteps \
+  $( find $D/.. -name README )
+
--- /dev/null
+++ derivations-0.52.20100310/helper/vim-macros
@@ -0,0 +1,6 @@
+map  <F3> :w<CR>:!make derivations.ps<CR>
+imap <F2> ~(\ref{})<Left><Left>
+map  <F2> O<Esc>a  \begin{split}<CR>\end{split}<Esc>^
+se tw=72
+se ic
+se et
--- /dev/null
+++ derivations-0.52.20100310/helper/README
@@ -0,0 +1,35 @@
+
+The files in this directory are development helpers
+only, probably of interest to you only if you are
+developing the package.  You do not need these files to
+build, install or use the package, nor strictly do you
+need them even to modify the package.  In fact you could
+delete the entire directory without ill effect.  If
+modifying the package, however, you may optionally find
+some of the scripts here convenient.
+
+Several of the files are scripts.  You can "bash
+letexec" to make these executable.
+
+The file helper/dict is a local dictionary for ispell.
+You can use it with "ispell -x -p helper/dict
+tex/*.{tex,bib}", for example.
+
+The file helper/vim contains nothing but some macros the
+author likes to use when editing the book with "vim -S
+helper/vim-macros tex/foo.tex".  It is supposed that
+most people probably prefer making their own little
+editor macros (for their own favorite editors); so,
+unless you like using other people's editor macros for
+some reason, you can ignore the file.
+
+Because these files are just development helpers, they
+are only minimally documented.  The comments at or near
+the head of the file explain what each file is and what
+it is for.  Refer to the various files for further
+information.
+
+If this helper/ directory interests you, then so
+probably also will the script debian/mkorig and
+the 'orig' and 'orig-force' targets in debian/rules.
+
--- /dev/null
+++ derivations-0.52.20100310/helper/dict
@@ -0,0 +1,1069 @@
+Aa
+ab
+aB
+ABCDEF
+Abramowitz
+absurdum
+ac
+aC
+accrete
+accretes
+adecimal
+Adel
+adjointed
+adjoints
+ae
+af
+agn
+ahlen
+AHNT
+ai
+al
+alebox
+algebraist
+algebraists
+alggeo
+algorithmizes
+aliceinfo
+alphabetization
+alsj
+AMD
+amenably
+amsmath
+AMSmath
+amssymb
+analyses
+Andr
+Andreas
+andrews
+antider
+antiderivative
+antiderivative's
+antiderivatives
+AP
+approximator
+apxe
+apxex
+aQ
+arccosh
+arccosine
+arcsinh
+arctanh
+Arfken
+arg
+Argand
+arounds
+artillerist's
+astronautical
+Augustin
+Automake
+automatable
+az
+bA
+backportability's
+backporting
+bAI
+Bal
+Balachandran
+Balakumar
+Balanis
+Ballantine
+Banos
+baroquity
+basever
+Bb
+Bbb
+BC
+Beattie
+Bernhard
+bh
+BibTeX
+Bienia
+binary's
+binth
+binthe
+BJam
+Bjarne
+bl
+Blacksburg
+Bladel
+Blaise
+bly
+Boca
+boundedness
+BQ
+breview
+BSL
+bT
+bTI
+btool
+BU
+buffe
+buildpackage
+Burlington
+businesspeople
+businessperson
+BW
+BWH
+byu
+ca
+CAC
+cade
+cally
+Cardan
+Cardano
+Cardano's
+Cardanus
+cauchy
+cauchyf
+cauchyn
+cc
+ccc
+ccccc
+ccccccc
+ccccccccc
+ccccccccccccc
+cd
+Ce
+cern
+cexp
+ch
+changelog
+changelogs
+Cholesky
+Chs
+ci
+cidfmap
+cis
+cit
+citable
+citational
+Civita
+Civita's
+cleandeb
+cleanless
+cleardoublepage
+cls
+co
+cois
+Colchester
+columnwise
+com
+commutivity
+complementarily
+composable
+congener
+congeners
+conj
+const
+conventionalize
+convolutional
+coords
+COPYLEFT
+correlational
+cos
+cosh
+cosint
+countability
+counterchallenged
+Courant
+Courant's
+couth
+cp
+Cramer's
+CRC
+cred
+crrrrrrrrrc
+CT
+curl's
+CX
+CXLVII
+cyc
+cyl
+dcurl
+DCXCIII
+Dd
+ddiv
+ddsf
+ddvf
+de
+Debconf
+debhelper
+debian
+Debian's
+Debianization
+Debianized
+Debianizing
+debver
+def
+deferral
+defz
+del
+delp
+deltatr
+Demystified
+der
+derivational
+deSturler
+det
+dev
+dexp
+df
+dfsg
+dg
+dh
+di
+diag
+diagn
+diagonal's
+diagonalizability
+diagonalization
+diagonalize
+diagonalized
+dict
+diff
+DIFFGZ
+dimen
+dimensionalities
+dimensionlessness
+dird
+dirdrvtv
+discretization
+discretize
+discretized
+discretizing
+discursion
+dists
+div
+divergenceless
+divg
+divthm
+DL
+dln
+dlnz
+DLUI
+documentclass
+Doetsch
+dotm
+dotmag
+dotre
+dp
+dpkg
+dr
+drvtv
+dS
+ds
+dsc
+dt
+du
+dup
+dv
+dvi
+DVLARCH
+dw
+dx
+dy
+dz
+dZ
+editional
+Edouard
+edu
+ee
+Ei
+eigdet
+eigen
+eigensolution
+eigensolutions
+eigenvalued
+eigenvector's
+electromagnetics
+elementaries
+elementarized
+elementary's
+elfs
+emph
+en
+encyclopedically
+enkindle
+ent
+ents
+enumt
+Ep
+Eq
+eqn
+eqnarray
+eqns
+equidistance
+er
+ere's
+erman
+esp
+etch's
+ete
+euler
+EWW
+exch
+exp
+expint
+exps
+extremum
+factorable
+factorials
+failproof
+fakeroot
+ff
+fh
+fi
+fillcolor
+fillstyle
+Fjeld
+foo
+footnotation
+Foresman
+formable
+forwardmost
+foundational
+fouri
+fourier
+Franciscus
+Friedberg
+Friedrich
+frullani
+Frullani's
+FSF's
+ftp
+genitival
+geo
+Geophys
+getCString
+getKey
+Gg
+gh
+ghostscript
+gibbs
+Gilbey
+gimbal
+gimbals
+Girolamo
+Giuliano
+GJ
+GJpart
+gjrank
+GJt
+GJtC
+gk
+Glenview
+Gorbag
+Gottfried
+Goursat
+gov
+gpl
+gra
+Graeco
+grat
+greek
+grep
+groff
+gt
+gtrsim
+Guillaume
+gv
+gz
+gzip
+Hafner
+Hamming's
+Hankel
+harvard
+hatchangle
+hatchwidth
+Hefferon
+Henk
+Hermann
+hert
+Hessenberg
+Hestenes
+Hh
+Hilburn
+hist
+Hm
+Hopman
+Houghton
+howpublished
+hq
+htm
+html
+http
+hubristic
+hy
+hypergeometric
+hyperlink
+i'j
+ia
+iA
+IAe
+iau
+iB
+ib
+ic
+iff
+ij
+ijk
+ijn
+ik
+iK
+ikj
+im
+IMC
+imn
+imum
+inbook
+Indep
+indicial
+infinitifold
+ing
+Insel
+int
+integ
+integrability
+integrand's
+integrands
+integrodifferential
+Interscience
+intinvz
+inttx
+invdet
+invertibility
+invxform
+ip
+Iref
+irreducibility
+irrotational
+iso
+Issai
+ited
+iu
+iuF
+iuf
+ively
+iwh
+iy
+iz
+j'k
+jargonal
+jb
+jh
+ji
+jik
+jj
+jj'k
+JJH
+jjk
+jk
+jki
+jmax
+jn
+Jochens
+Jolley
+joshua
+jp
+jr
+jT
+jU
+ju
+ka
+karlscalculus
+Kernighan
+Kernighan's
+kf
+kh
+Khamsi
+kI
+kij
+Kitaigorodskii
+kj
+kji
+kk
+kkt
+kkz
+kn
+Knopp
+Knopp's
+Knoppix
+Kohler's
+kp
+KRHB
+kron
+Krylov
+KSI
+kt
+kx
+kz
+l'H
+l'Hopital's
+L'Hopital's
+l'Hospital's
+L'Hospital's
+labelsep
+laborlawtalk
+Lapack
+laplacian
+laurent
+LCHandout
+leastsq
+Lebedev
+Leibnitz
+Leibnitz's
+lenny
+Leonhard
+lesssim
+letexec
+Lf
+lhopital
+libpoppler
+Libpoppler's
+Lightfoot
+lightgray
+lim
+linearalgebra
+linecolor
+linestyle
+linewidth
+lintian
+literal's
+LJDRP
+Ll
+lllcl
+lmodern
+ln
+localscalebox
+Lodovico
+logdef
+lor
+Lothar
+lppl
+lpr
+LUI
+LUP
+mA
+Maclaurin
+MacTutor
+Magnus
+mAI
+maintenv
+majorization
+majorize
+majorizes
+majorizing
+makeindex
+manpage
+manu
+marginalizing
+mathbb
+mathbios
+mathworld
+mC
+mcs
+mD
+mDI
+mdots
+Melc
+meromorphic
+metasyntactic
+meth
+mf
+mfd
+mG
+mH
+mI
+Microelectronic
+Mifflin
+min
+Mineola
+minimalistically
+minorization
+misc
+mislinking
+Mittra
+mj
+mk
+mK
+mkdiff
+mKI
+mkorig
+mL
+mLI
+mn
+mni
+Moivre
+Moivre's
+monophthongal
+Mosig
+Mosig's
+Moskowitz
+mP
+mPDLUI
+mPI
+mT
+MTC
+mtxalg
+mtxinv
+mU
+mUI
+mul
+multidigit
+multiline
+multisource
+multitarget
+mv
+mx
+myrad
+myscale
+mz
+nA
+na
+nAI
+narg
+nasa
+Navier
+Nayfeh
+nB
+nC
+neg
+nG
+nglish
+ni
+Niccol
+nint
+nj
+nk
+nn
+nonanalytic
+nonassociative
+nonassociativity
+noncommutivity
+nonconjugate
+Nonconvergent
+nondegenerate
+nondiagonalizability
+nondiagonalizable
+nonentire
+nonexchanges
+Nongeometrical
+nonintegral
+noninterchanges
+noninvertibility
+noninvertible
+nonisotropic
+nonobvious
+nonoptimal
+nonoverdetermined
+nonplanar
+nonrectangular
+nonredundant
+nonrepeating
+nonsquare
+nontrivially
+nonunderdetermined
+nonunique
+nonvector
+nonzeros
+northwestward
+nos
+Nostrand
+noth
+nounal
+nP
+nPDLUKS
+nPDLUU
+nQ
+NR
+nSI
+nT
+nTI
+Nussbaum
+nwh
+Oaxtepec
+od
+Offline
+oH
+oI
+oo
+opital
+opital's
+ops
+org
+orienteering
+orig
+ORIGTARGZ
+orthogonalize
+orthogonalizes
+orthogonalizing
+orthographically
+orthonormality
+orthonormalization
+orthonormalize
+orthonormalized
+orthonormalizes
+orthonormalizing
+orthonormally
+outlier
+overappreciated
+overdetermine
+overdetermined
+oW
+P'D'L'U'I
+p'i
+p'q
+paraboloids
+parochiality
+Parseval
+Parseval's
+pdf
+pdfetex
+PDFLaTeX
+PDFTricks
+PDLU
+PDLUI
+PDLUKS
+PDLUKSI
+Pedersen
+Penrose
+peri
+permutor
+permutor's
+permutors
+perp
+perpendicular's
+perpendicularity
+perspectived
+Pfufnik
+PGF
+pgn
+phasor
+phen
+Piscataway
+pj
+pl
+planetm
+PlanetMath
+planetmath
+plotpoints
+pm
+pointwise
+polyderiv
+polyderivz
+PostScript
+postulational
+Poynting
+Pp
+pq
+pre
+Precalculus
+predeclared
+pref
+preloads
+preshifted
+primeprf
+proddiv
+professional's
+ps
+pseudoinverse
+pseudoinversion
+psinv
+psselect
+pst
+pstricks
+PSTricks
+psutils
+pt
+PTR
+purec
+px
+pythag
+Q'H
+Q'R
+qp
+Qq
+QR
+QRinv
+qs
+qu
+quadeq
+quartic
+quartic's
+quartics
+quasielementaries
+quasielementary
+QUDS
+quintic
+Qw
+rA
+rad
+rAI
+Raj
+randomish
+Raphson
+Raton
+rB
+rC
+rcccl
+rcccll
+rCI
+rcl
+rclcl
+rclcrcl
+rclcrclcrcl
+rcr
+rcrccccl
+rcrcl
+rcrcrcl
+README
+reassociate
+Reassociating
+RECT
+redacted
+redaction
+Redlin
+reductio
+reinitialization
+RelSteps
+reorienting
+reorients
+rerotation
+rescale
+Rescripted
+resolvent
+reversibly
+Rewove
+rfakeroot
+rG
+rgen
+rI
+rj
+rK
+rKH
+rKI
+rKS
+rKSI
+rm
+rr
+rR
+rrr
+rrrr
+rS
+rSA
+rT
+rTI
+rU
+Rugen
+ruN
+S'X
+Sa
+Sadiku
+Saleem
+sarge
+Sarnow
+scalarization
+scalarize
+scalebox
+Schaum's
+schematical
+schur
+SCons
+sed
+Sedra
+Sep
+Shenk
+Shirer
+sid
+sid's
+Sii
+sinc
+sinh
+sinq
+sion
+smcvt
+Smedegaard
+snoitavired
+solenoidal
+Sommerfeld
+sosmath
+specif
+sph
+SPHER
+sq
+src
+SRW
+Ss
+stairstep
+stairsteps
+Stegun
+Stepney
+Stiefel
+stit
+stochastics
+stokesthm
+storable
+stormclouds
+Stratton
+Stroustrup
+struct
+Sturler
+subdiagonals
+subdir
+subdisciplines
+subgrid
+subgrid's
+subgridded
+subimposes
+submatrices
+submatrix
+subrogate
+subseries
+subsubset
+sudo
+summa
+summational
+susan
+SVD
+SVDinv
+SVDr
+sx
+symbology
+Tait
+tal's
+taries
+Tartaglia
+Tartaglia's
+tary
+taylor
+Tdefadd
+Tdefsc
+Tdefxchg
+te
+ters
+teTeX
+tetex
+tex
+TeXLive
+texlive
+thb
+Theo
+Theodor
+thopman
+TikZ
+tk
+tl
+tla
+tlb
+tlc
+tld
+toc
+train's
+Trans
+transform's
+triangleq
+triangulars
+trigonometrics
+trigs
+trop
+truncator
+truncators
+Tt
+Tullio
+TW
+txt
+ua
+ub
+uc
+UDS
+uf
+UI
+uk
+ul
+un
+uncalculatable
+unconfused
+unconservative
+uncontrived
+underappreciated
+underdetermined
+undergird
+unedifying
+unfundamental
+unintegrated
+unitarily
+unitless
+Univ
+unmix
+unpermuted
+unpersuaded
+unpolished
+unreadably
+unremarkably
+unrooted
+unsuggestive
+unsureness
+untainted
+unverifiable
+unvisualizable
+unwarrantedly
+uoguelph
+URL
+usepackage
+usr
+UT
+Uu
+uv
+Vallejo
+vanBladel
+vari
+vcalc
+VD
+vdVorst
+verdate
+Vieta
+Vieta's
+von
+Vorst
+vspace
+Vt
+Vv
+wave's
+Weisstein
+Weisstein's
+Werror
+Weyl
+wg
+wh
+wheth
+Wikimedia
+wikip
+wikipedia
+Wikipedians
+Wilbraham
+Ww
+www
+x'y'z
+x'z'y
+XA
+xform
+xg
+xplora
+xs
+xt
+xunit
+XY
+y'x'z
+y'z'x
+Yan
+york
+ys
+yt
+yunit
+Yy
+z'x'y
+z'y'x
+Zandt's
+zcat
+Zz
--- /dev/null
+++ derivations-0.52.20100310/helper/extend-changelog
@@ -0,0 +1,86 @@
+#! /usr/bin/perl
+use warnings;
+use strict;
+use integer;
+use FindBin;
+use lib $FindBin::RealBin;
+use Def;
+
+# This script adds empty new entries at the changelogs' tops.
+
+our $usage = <<END;
+usage: $0 [-dmh]
+    -d add only to the Debian changelog
+    -m add only to the main changelog
+    -h print this usage message
+END
+our $verdate       = '19700101';
+our $date          = 'Thu, 01 Jan 1970 00:00:00 +0000';
+
+our $debian        = "${FindBin::RealBin}/../debian";
+our $changelog     = "${FindBin::RealBin}/../doc/changelog";
+our $changelog_deb = "${debian}/changelog";
+
+# Read command-line arguments and options.
+my @arg;
+my %opt;
+for ( @ARGV ) {
+  if ( my($o) = /^-(\S+)/ ) {
+    $opt{$_} = 1 for split //, $o;
+  }
+  else { push @arg, $_ }
+}
+if ( $opt{h} || $opt{'?'} ) {
+  print $usage;
+  exit 0;
+}
+
+# Determine which changelogs to add to.
+my $do_cl  =                 $opt{m} || !$opt{d}  ;
+my $do_cld = -e $debian && ( $opt{d} || !$opt{m} );
+
+# Read the changelogs in.
+my( @cl, @cld );
+if ( $do_cl  ) {
+  open CL, '<', $changelog;
+    @cl  = <CL>;
+  close CL;
+}
+if ( $do_cld ) {
+  open CL, '<', $changelog_deb;
+    @cld = <CL>;
+  close CL;
+}
+
+# Add changelog entries.
+my $ver     = "${Def::basever}.$verdate";
+my $ver_deb = "${ver}-1";
+unshift @cl , <<END;
+${Def::out} ($ver)
+
+  * ${Def::cl_entry_dflt}
+
+ -- ${Def::author} <${Def::email}>  $date
+
+END
+unshift @cld, <<END;
+${Def::out} ($ver_deb) ${Def::dist}; urgency=${Def::urgency}
+
+  * ${Def::cl_entry_dflt}
+
+ -- ${Def::author} <${Def::email_deb}>  $date
+
+END
+
+# Write the changelogs out.
+if ( $do_cl  ) {
+  open CL, '>', $changelog;
+    print CL @cl;
+  close CL;
+}
+if ( $do_cld ) {
+  open CL, '>', $changelog_deb;
+    print CL @cld;
+  close CL;
+}
+
--- /dev/null
+++ derivations-0.52.20100310/helper/letexec
@@ -0,0 +1,14 @@
+#! /bin/bash -e
+
+# The .diff.gz patch format does not preserve executable flags on files.
+# This is fine, but run the present script as
+#
+#     bash helper/letexec
+#
+# after unpacking the source to let the appropriate helpers be
+# executable.
+
+for A in $( find $( dirname $0 ) -mindepth 1 -maxdepth 1 -type f ) ; do
+  sed -ne '/^#!/q0;q1' $A && chmod a+x $A
+done
+
--- /dev/null
+++ derivations-0.52.20100310/helper/deprecated/open-new-source
@@ -0,0 +1,22 @@
+
+# This bash shell pseudoscript opens a new development source tree.
+
+if   [[ $MAINTENV != derivations ]] ; then
+  echo 1>&2 "Please run helper/maintenv first."
+  false
+elif [[ ! $PWD -ef $E/$P-$V.$D1  ]] ; then
+  echo 1>&2 "Please run from the top source directory $E/$D1."
+  false
+elif [[ -e $P-$V.$D2             ]] ; then
+  echo 1>&2 "Sorry, but $P-$V.$D2 already exists."
+  false
+else
+  # Open a full new upstream tree.
+  cd ..
+  cp -a $P-$V.{$D1,$D2}
+  cd $P-$V.$D2
+  bash - helper/letexec
+  helper/extend-changelog
+  helper/update-date -c $D2
+fi
+
--- /dev/null
+++ derivations-0.52.20100310/helper/deprecated/maintenv
@@ -0,0 +1,65 @@
+
+# This bash shell pseudoscript sets some useful environment
+# variables for derivations package maintenance.  You run it
+# by ". helper/maintenv".
+#
+# Before running this pseudoscript you must set the following:
+#
+#     D1  the old version date (for example, 19700101)
+#     D2  the prospective new version date
+#
+# (It would be neater to make this and the associated pseudoscripts real
+# scripts, but it would also be less useful from the author's point of
+# view.  Remember that this is just a development helper.  The reason to
+# use pseudoscripts is to keep the various shell variables and functions
+# in the shell's global namespace where the maintainer can manipulate
+# them directly.  If you don't want your shell's namespace cluttered,
+# you can spawn a subshell before invoking the pseudoscript.)
+
+if   [[ $D1 == '' || $D2 == '' ]] ; then
+  echo 1>&2 "Please set D1 and D2 before running this pseudoscript."
+  false
+elif echo -n $VD | grep -q '[^0-9]' ; then
+  echo 1>&2 "The \$VD must be a nonnegative integer."
+  false
+elif [[ $D1 == $D2 && ( $VD == '' || $(( $VD > 1 )) == 0 ) ]] ; then
+  echo 1>&2 "Please set either \$VD > 1 or \$D2 != \$D1."
+  false
+else
+
+  DVLARCH=i386  # the maintainer's own machine architecture
+  E=~/der       # the maintainer's development superdirectory
+  P=derivations # the package name
+  V=0.5         # the base version number
+
+  # Derive additional variables.
+  if [[ $VD == '' ]] ; then VD=1 ; fi
+
+  # Define a shell function to build a diff.
+  function mkdiff {
+    if [[ -x helper/buffe-src ]] ; then
+      if [[ $(( $VD > 1 )) == 0 ]] ; then
+        DIFF=$E/$P-$V.$D2.diff
+        (
+          cd ..
+          diff -ruN $P-$V.{$D1,$D2} >$DIFF
+        )
+      else
+        DIFF=$E/$P-$V.$D1-$VD.diff
+        (
+          cd ..
+          diff -ruN $P-$V.$D1{-$(( $VD - 1 )),} >$DIFF
+        )
+      fi
+    else
+      echo 1>&2 "You must run this shell function from the top source"
+      echo 1>&2 "directory, and helper/buffe-src must be executable."
+      false
+    fi
+  }
+
+  # Set a flag to mark that the pseudoscript has been run.
+  MAINTENV=$P
+
+fi
+
--- /dev/null
+++ derivations-0.52.20100310/helper/deprecated/README
@@ -0,0 +1,7 @@
+
+The author thought that these files were a good idea
+when he made them, but they have not proven as useful as
+he had thought they would.  The maintenv script might
+still be useful.  The other files probably are less
+useful, but for now they are kept here.
+
--- /dev/null
+++ derivations-0.52.20100310/helper/deprecated/close-source
@@ -0,0 +1,68 @@
+
+# This bash shell pseudoscript closes the development source tree for
+# subsequent building.  Note that you can close the source as many times
+# as you like; you needn't (and shouldn't) reopen it each time.
+
+if   [[ $MAINTENV != derivations       ]] ; then
+  echo 1>&2 "Please run helper/maintenv first."
+  false
+elif [[ ! $PWD -ef $E/$P-$V.$D2        ]] ; then
+  echo 1>&2 "Please run from the top source directory $E/$D2."
+  false
+else
+
+  if [[ $D3 == '' ]] ; then D3=$D2 ; fi
+  if [[ $VD == '' ]] ; then VD=1   ; fi
+  if echo -n $VD | grep -q '[^0-9]' ; then
+    echo 1>&2 "The \$VD must be a nonnegative integer."
+    false
+  else
+
+    if [[ $(( $VD > 1 )) == 0 ]] ; then
+
+      if [[ $D3 != $D2 && -e $E/$D3 ]] ; then
+        echo 1>&2 "Sorry, but $E/$D3 already exists."
+        false
+      else
+        if [[ $D3 != $D2 ]] ; then
+          cd ..
+          mv $P-$V.{$D2,$D3}
+          rm -f $DIFF
+          cd $P-$V.$D3
+        fi
+        helper/update-date $D3
+        D2=$D3
+        helper/buffe-src >/dev/null
+        debian/rules orig-force
+        mkdiff
+      fi
+
+    else
+
+      if [[ -e $E/$P-$V.$D1-$(( $VD - 1 )) && $D2 != $D1 ]] ; then
+        echo 1>&2 "Sorry, but \$D2 != \$D1,"
+        echo 1>&2 "yet $E/$P-$V.$D1-$(( $VD - 1 )) already exists."
+        false
+      else
+        rm -Rf $E/$P-$V.$D1-$(( $VD - 1 ))
+        if [[ $D2 != $D1 ]] ; then
+          cd ..
+          mv $P-$V.$D1{,-$(( $VD - 1 ))}
+          mv $P-$V.{$D2,$D1}
+          cd $P-$V.$D1
+        fi
+        helper/update-debver   $VD
+        helper/update-date     $D1
+        helper/update-date -ds $D2
+        D2=$D1
+        D3=$D1
+        helper/buffe-src >/dev/null
+        mkdiff
+      fi
+
+    fi
+
+  fi
+
+fi
+
