4.2 Multiple distribution tree example, start to finish

Lets suppose you have a source tree from which you create multiple
distributions, say three. If you really have a such source tree you
must have by now noticed the difficulty of maintaining such a source tree
and problems with controlling the distributions. Maybe you have sufficed
with Autoconf and Automake, or perhaps you have created your own scripts
that carry out the kludges. No more, for Autodist is here.

First, you integrate Autodist into your tree by creating the distributions
directory 'distdir':

autodist -i

Then, you create the 'configure.ad' file from your existing 'configure.ac'
or 'configure.in' file. If you don't have configure script written yet,
please refer to the Autoconf manual. In the 'configure.ad' you add as
first macro in the file:

AD_INIT

You then continue with creating the distribution files for your three
distributions. Let's name them 'foozbar', 'libfoozbar' and 'nomad'.
We will also create a common template that all distributions inherit.

You put the distribution files in the 'distdir' directory. In addition
you will be doing development in the source tree using the 'default'
distribution, you will add the new distributions to the 'distdir/default':

inherit foozbar
inherit libfoozbar
inherit nomad

To prepare the source tree for configuration and compilation you would
simply give:

autodist

This will prepare your source tree for configuration and compilation. Since
the 'default' distribution inherits all distributions your development
source tree will have all of them included. If you do not want to do this
then don't inherit them in the 'default', but run the autodist specifically
for the distributions, for example:

autodist foozbar

Since all the distributions inherit the 'common' distribution they get
all the distdefs that the 'common' defines. In this example various distdefs
have been defined. You would use them in your code and in your makefiles
to control various things. For example, let's say the 'common' distdefs
control what directories distributions have. An example 'Makefile.ad'
file:

Since the 'nomad' distribution undefined the '_DIST_CRYPTO' distdef it
would not have the 'cryptolib' in its distribution. Clearly Nomad
don't need it. In addition of using the distdefs just in the makefiles
you may want to use them in the source code as well:

After an intensive development period you're ready to create new releases.
Let's say you're going to release all distributions:

First you release Foozbar 0.5.1:

autodist foozbar 0.5.1
makedist --bzip2

The end result is two files: 'foozbar-0.5.1.tar.gz' and
'foozbar-0.5.1.tar.bz2'.

Then you continue with libfoozbar and Nomad:

autodist libfoozbar 1.0.5
makedist

Nomad has also an RPM .spec file that you have written and a pre-dist-hook
that will replace the RPM release version with sed tool with the one you
give as extra parameter to autodist:

autodist nomad 2.0 0.fc7
makedist

The end results are: 'libfoozbar-1.0.5.tar.gz' and 'nomad-2.0.tar.gz', and
the RPM will have a release version '0.fc7' when you compile the RPM. Any
extra parameter that you pass to autodist will be delivered to your hook
scripts.