autotools.cygclass

Cygport Reference Manual

### TABLE OF CONTENTS

- autotools.cygclass

- gnuconfigize
- cygautoreconf

- WANT_AUTOCONF
- WANT_AUTOMAKE
- NO_ACLOCAL
- NO_LIBTOOLIZE
- NO_AUTOCONF
- NO_AUTOHEADER
- NO_AUTOMAKE
- NO_AUTOPOINT
- ACLOCAL_FLAGS

- cygconf

- AUTOCONF_VERSION
- CYGCONF_SOURCE
- CYGCONF_ARGS

- src_compile (autotools)

## autotools.cygclass

[ Top ] [ Cygclasses ] [ Cygclasses ]

DESCRIPTION

GNU Autotools (comprising of Gettext, Autoconf, Automake, and Libtool) comprise the build system of many source packages of all types.

This Cygclass provides the functions necessary to configure and build autotool-based packages. Since these are so widespread, this is the assumed build system if no other is specified, and provides the default src_compile accordingly.

EXAMPLES

A basic autotool-based program package can be as simple as:

        NAME="grep"
        VERSION=2.14
        RELEASE=1
        CATEGORY="Base"
        SUMMARY="Searches files for text patterns"
        DESCRIPTION="The grep command searches one or more input files for lines
        containing a match to a specified pattern. By default, grep prints the
        matching lines."
        HOMEPAGE="https://www.gnu.org/software/grep/"
        LICENSE="GPL-2.0-or-later"
        SRC_URI="mirror://gnu/grep/grep-${VERSION}.tar.xz"

If the only customization needed is to add configure flags, use CYGCONF_ARGS:

        NAME="nano"
        VERSION=2.2.6
        RELEASE=1
        CATEGORY="Editors"
        SUMMARY="Enhanced clone of Pico editor"
        DESCRIPTION="GNU nano is a small and friendly console-mode text editor, based
        on and mostly compatible with UW Pico. Besides basic text editing, nano offers
        many extra features like an interactive search and replace, go to line and
        column number, auto-indentation, feature toggles, internationalization support,
        and filename tab completion."
        HOMEPAGE="https://www.nano-editor.org/"
        LICENSE="GPL-3.0-or-later"
        SRC_URI="https://www.nano-editor.org/dist/v${VERSION%.*}/nano-${VERSION}.tar.gz"
        PATCH_URI="2.2.4-wchar.patch"

        DIFF_EXCLUDES="nano.spec"

        CYGCONF_ARGS="--without-slang"

Packages providing libraries need a bit more to handle split lib/devel packaging:

        NAME="libdatrie"
        VERSION=0.2.6
        RELEASE=1
        CATEGORY="Libs"
        SUMMARY="Double-array digital search tree library"
        DESCRIPTION="This is an implementation of double-array structure for
        representing trie, as proposed by Junichi Aoe."
        HOMEPAGE="https://linux.thai.net/~thep/datrie/datrie.html"
        LICENSE="LGPL"

        PKG_NAMES="${NAME}1 ${NAME}-devel ${NAME}-doc"
        # see PKG_CONTENTS
        libdatrie1_CONTENTS="usr/bin/cygdatrie-1.dll"
        # trietool is a dev-util
        libdatrie_devel_CONTENTS="usr/bin/trietool* usr/include/ usr/lib/ usr/share/man/"
        libdatrie_doc_CONTENTS="usr/share/doc/"

Sometimes a package uses its own aclocal macros but does not ship them, or uses an older autoconf which is incompatible with the current version, making cygautoreconf impossible. In that case, as long as the package does not use libtool, you may be able to skip cygautoreconf:

        src_compile() {
          # cannot autoreconf: undefined macro: AC_ACVERSION
          cd ${B}
          cygconf --enable-iconv
          cygmake
        }

For more complicated packages, additional compile and/or install steps may be necessary, in which case you should override the default src_compile and/or src_install:

        src_compile() {
          # the configure script is not distributed, and VPATH builds aren't supported
          cd ${S}
          cygmake configure
          lndirs
          cd ${B}
          cygconf --htmldir=/usr/share/doc/${NAME}/html --mandir=/usr/share/man
          cygmake all
          # these can't be built in parallel
          cygmake html
          cygmake man
          cygmake info
          cygmake pdf
        }

        src_install() {
          cd ${B}
          cyginstall install-html install-man install-info install-pdf pdfdir=/usr/share/doc/${NAME}

          # ship bash completion
          insinto /etc/bash_completion.d
          doins ${S}/contrib/completion/*.bash
        }

As noted below, cygconf is only intended for autoconf-compatible configure scripts. Some packages use a custom configure script which is not compatible, in which case you need to call configure yourself:

        src_compile() {
          # package is not VPATH aware
          lndirs
          cd ${B}
          # custom configure incompatible with autoconf
          ./configure --prefix=/usr || error "configure failed"
          cygmake
       }

NOTES

These functions were previously part of cygport itself, but were moved out for easier maintainability. For backwards compatibility, this cygclass is automatically inherit()ed, so these functions are always available as before.

Normally, a cygclass can only be inherited once. Even though this is auto-inherit()ed, it can still be manually inherit()ed once more if desired. In most cases this is unnecessary, but it can be useful if you inherit other cygclasses but still want the default src_compile(). For example:

        inherit perl autotools

provides all the PERL_* definitions and perl_*() functions, but will build with cygconf/cygmake by default instead of with perl's ExtUtils::MakeMaker or Module::Build.

INHERITED BY

No Cygclass actually inherit()s autotools.cygclass for the reasons stated above, but the functions defined herein are used by a number of Cygclasses:

gnome2.cygclass, gst-plugins.cygclass, gtkmm.cygclass, httpd.cygclass, kde3.cygclass, mate.cygclass, php.cygclass, pygtk.cygclass, toolchain.cygclass, xfce4.cygclass, xorg.cygclass

## gnuconfigize

[ Top ] [ autotools.cygclass ] [ Compile Functions ]

SYNOPSIS

      gnuconfigize DIRECTORY [DIRECTORY ...]

DESCRIPTION

Updates the config.guess and config.sub files in the given directory(ies). This may be necessary when building packages natively for x86_64-cygwin, which is not recognized by older versions of this file.

NOTE

This function is called automatically during cygautoreconf; it need only be called directly for packages which install their copies of this file (e.g. the autotools themselves) or in the unusual case where cygautoreconf absolutely cannot be used.

## cygautoreconf

[ Top ] [ autotools.cygclass ] [ Compile Functions ]

SYNOPSIS

      cygautoreconf

DESCRIPTION

Updates the autotool build system with autoreconf, which runs the tools from autoconf, automake, gettext-devel, and libtool to update their respective components. Must be run in the directory containing the top-level configure.ac or configure.in (usually $S).

NOTE

If, during cygautoreconf, you get a warning such as:

         Warning: ./configure.ac may require LT_OUTPUT macro

then the package configure script is relying on libtool 1.5 behaviour where the libtool script is generated during AC_PROG_LIBTOOL, and can therefore be called anytime thereafter in the configure script. Some packages do this either to read the libtool config, or to run compiling/linking tests with the libtool script.

However, with the current libtool 2.2, the libtool script is generated during the AC_OUTPUT phase at the end of configure, so these configure commands will not work as designed. The simplest portable solution is to add the following line after the AC_PROG_LIBTOOL call:

        m4_ifdef([LT_OUTPUT], [LT_OUTPUT])

which means: if libtool 2.2 is in use, generate a libtool script early so that it can be used during configure; if libtool 1.5 is in use, this line has no effect. Such a patch is suitable to be pushed upstream.

WARNING

Skipping this step is strongly discouraged. Patches to configure.ac, aclocal macros, or Makefile.am files will not take effect until their tools have been regenerated. Also, Cygwin's libtool package often includes patches which are not yet available in the latest upstream release, so libraries may not be built optimally, or even correctly, without this step having been run.

REQUIRES

autoconf, automake, gettext-devel, libtool

## WANT_AUTOCONF

[ Top ] [ cygautoreconf ] [ Variables ]

DESCRIPTION

This variable controls the version of autoconf to be used. Valid settings are "2.1" (for the 2.13 version), "2.5" (for the 2.5x/2.6x series) and "2.7" (the default, for the 2.7x series).

## WANT_AUTOMAKE

[ Top ] [ cygautoreconf ] [ Variables ]

DESCRIPTION

This variable controls the version of automake to be used. Valid settings are currently "1.4", "1.5" through to "1.16", etc. If undefined, the version used by the preexisting automake files will be used; if nonexistant (e.g. a VCS checkout), the newest available automake will be used.

## NO_ACLOCAL

[ Top ] [ cygautoreconf ] [ Variables ]

DESCRIPTION

Define this variable to a boolean true value to skip running aclocal during cygautoreconf.

WARNING

This is strongly discouraged, and should only be used when a package uses its own aclocal macros which are not provided in the tarball *and* the package does not use libtool.

## NO_LIBTOOLIZE

[ Top ] [ cygautoreconf ] [ Variables ]

DESCRIPTION

Define this variable to a boolean true value to skip running libtoolize during cygautoreconf.

WARNING

This is strongly discouraged. Cygwin's libtool usually includes patches required for optimal results on Cygwin which are not yet available in even the most recent upstream releases.

## NO_AUTOCONF

[ Top ] [ cygautoreconf ] [ Variables ]

DESCRIPTION

Define this variable to a boolean true value to skip running autoconf during cygautoreconf.

WARNING

This is strongly discouraged. Running libtoolize, changes to aclocal macros, or changes to configure.ac/configure.in all require autoconf to be run for a working build.

## NO_AUTOHEADER

[ Top ] [ cygautoreconf ] [ Variables ]

DESCRIPTION

Sometimes autoreconf thinks a package uses autoheader when in fact it does not, in which case cygautoreconf will fail during the autoheader stage. In such cases, provided you have not patched any AC_DEFINEs, set this variable to a boolean true value to skip the autoheader step.

## NO_AUTOMAKE

[ Top ] [ cygautoreconf ] [ Variables ]

DESCRIPTION

Define this variable to a boolean true value to skip running automake during cygautoreconf.

WARNING

This is strongly discouraged. If aclocal and/or autoconf have been run, running automake is required for a working build.

## NO_AUTOPOINT

[ Top ] [ cygautoreconf ] [ Variables ]

DESCRIPTION

Define this variable to a boolean true value to skip running autopoint during cygautoreconf.

WARNING

This is strongly discouraged. Cygwin's gettext package often has patches which are not yet available in even the latest official release, and earlier versions of gettext are incompatible with the current libtool.

## ACLOCAL_FLAGS

[ Top ] [ cygautoreconf ] [ Variables ]

DESCRIPTION

Set this variable when a package ships with its own aclocal macros but their directory is not included when running aclocal during cygautoreconf. If needed, usually in the form "-I DIR" (where DIR is the relative subdirectory containing the aclocal macros, often m4/).

## cygconf

[ Top ] [ autotools.cygclass ] [ Compile Functions ]

SYNOPSIS

      cygconf [CONFIGURE_FLAG] [CONFIGURE_FLAG] ...

DESCRIPTION

Runs the configure script for the package. cygconf passes configure the flags necessary to install the package into the /usr prefix and according to the Filesystem Hierarchy Standard and the Cygwin package guidelines. In addition, all arguments to cygconf are passed to configure, followed by CYGCONF_ARGS, if set.

NOTES

- cygconf should be run in or under $B, as it defines the build directory of the package and creates numerous files.
- If the configure script is not in $S, see CYGCONF_SOURCE.
- cygconf is intended for configure scripts generated by, or compatible with, autoconf. Packages with handwritten configure scripts may not accept all the flags used by cygconf, in which case a direct call to the configure script is in order.

## AUTOCONF_VERSION

[ Top ] [ cygconf ] [ Variables ]

DESCRIPTION

In some in some rare cases, cygport cannot automatically detect the autoconf version that was used to generate the configure script (typically when cygautoreconf is not being used, and the autoconfigury has been heavily customized). This variable can be set to indicate the autoconf version the configure script's options are compatible with e.g. "2.50", "2.60", "2.70".

## CYGCONF_SOURCE

[ Top ] [ cygconf ] [ Variables ]

DESCRIPTION

Set this variable to the directory containing the configure script. This is only necessary when configure is not in $S and cygconf is not being run in the same subdirectory of $B which under $S contains configure. (IOW if the configure script is in $S/unix and cygconf is run from $B/unix, setting CYGCONF_SOURCE would not be necessary.)

## CYGCONF_ARGS

[ Top ] [ cygconf ] [ Variables ]

DESCRIPTION

Additional flags to pass to configure, as a string.

NOTE

Flags in CYGCONF_ARGS follow, and therefore override, flags passed by default and as arguments to cygconf.

## src_compile (autotools)

[ Top ] [ autotools.cygclass ] [ Overloads ]

DEFINITION

    src_compile() {
            cd ${S}
            cygautoreconf
            cd ${B}
            cygconf
            cygmake
    }