Introduction
============

The kyua-atf-compat package uses the GNU Automake, GNU Autoconf and GNU
Libtool utilities as its build system.  These are used only when
compiling the application from the source code package.  If you want to
install these tools from a binary package, you do not need to read this
document.

For the impatient:

    $ ./configure
    $ make
    $ make check
    Gain root privileges
    # make install
    Drop root privileges
    $ make installcheck

Or alternatively, install as a regular user into your home directory:

    $ ./configure --prefix ~/local
    $ make
    $ make check
    $ make install
    $ make installcheck


Dependencies
============

To build and use kyua-atf-compat successfully you need:

* A POSIX shell interpreter.
* pkg-config.
* Kyua 0.7 or greater.

To build the bundled tests, you optionally need:

* The Automated Testing Framework (ATF), version 0.15 or greater.  This
  is required if you want to create a distribution file.

If you are building kyua-atf-compat from the code on the repository, you
will also need the following tools:

* GNU Autoconf.
* GNU Automake.


Regenerating the build system
=============================

This is not necessary if you are building from a formal release
distribution file.

On the other hand, if you are building Kyua from code extracted from the
repository, you must first regenerate the files used by the build
system.  You will also need to do this if you modify configure.ac,
Makefile.am or any of the other build system files.  To do this, simply
run:

    $ autoreconf -i -s

If ATF is installed in a different prefix than Autoconf, you will also
need to tell autoreconf where the ATF M4 macros are located.  Otherwise,
the configure script will be incomplete and will show confusing syntax
errors mentioning, for example, ATF_CHECK_SH.  To fix this, you have
to run autoreconf in the following manner, replacing '<atf-prefix>' with
the appropriate path:

    $ autoreconf -i -s -I <atf-prefix>/share/aclocal


General build procedure
=======================

To build and install the source package, you must follow these steps:

1. Configure the sources to adapt to your operating system.  This is
   done using the 'configure' script located on the sources' top
   directory, and it is usually invoked without arguments unless you
   want to change the installation prefix.  More details on this
   procedure are given on a later section.

2. Build the sources to generate the binaries and scripts.  Simply run
   'make' on the sources' top directory after configuring them.  No
   problems should arise.

3. Check that the built programs work by running 'make check'.  You do
   not need to be root to do this, but if you are not, some checks will
   be skipped.

4. Install the program by running 'make install'.  You may need to
   become root to issue this step.

5. Issue any manual installation steps that may be required.  These are
   described later in their own section.

6. Check that the installed programs work by running 'make
   installcheck'.  You do not need to be root to do this, but if you are
   not, some checks will be skipped.


Configuration flags
===================

The most common, standard flags given to 'configure' are:

* --prefix=directory
  Possible values: Any path
  Default: /usr/local

  Specifies where the program (binaries and all associated files) will
  be installed.

* --sysconfdir=directory
  Possible values: Any path
  Default: /usr/local/etc

  Specifies where the installed programs will look for configuration
  files.  '/atf' will be appended to the given path unless
  ATF_CONFSUBDIR is redefined as explained later on.

* --help
  Shows information about all available flags and exits immediately,
  without running any configuration tasks.

The following environment variables are specific to Kyua's 'configure'
script:

* ATF_CONFSUBDIR
  Possible values: empty, a relative path.
  Default: atf.

  Specifies the subdirectory of the configuration directory (given by
  the --sysconfdir argument) under which the ATF compatibility tools
  will search for ATF's configuration files.

* KYUA
  Possible values: a path.
  Default: autodetected.

  Specifies the path to the 'kyua' binary.  The built tools will point
  to this location to find the tool to execute.

* SH
  Possible values: a path.
  Default: autodetected.

  Specifies the path to the POSIX shell interpreter to use.

The following flags are specific to Kyua's 'configure' script:

* --with-atf
  Possible values: yes, no, auto.
  Default: auto.

  Enables usage of ATF to build (and later install) the tests.

  Setting this to 'yes' causes the configure script to look for ATF
  unconditionally and abort if not found.  Setting this to 'auto' lets
  configure perform the best decision based on availability of ATF.
  Setting this to 'no' explicitly disables ATF usage.

  When support for tests is enabled, the build process will generate the
  test programs and will later install them into the tests tree.
  Running 'make check' or 'make installcheck' from within the source
  directory will cause these tests to be run with Kyua.


Run the tests!
==============

Lastly, after a successful installation, you should periodically run the
tests from the final location to ensure things remain stable.  Do so as
follows:

    $ cd /usr/local/tests/kyua-atf-compat && kyua test

And if you see any tests fail, do not hesitate to report them in:

    http://code.google.com/p/kyua/issues/list

Thank you!

