Autotools

From Gentoo Wiki
Revision as of 08:21, 24 October 2011 by MGorny (Talk | contribs)

Jump to: navigation, search

Autotools is a build system used commonly in open source projects.

Contents

Eclasses related to autotools

autotools.eclass

autotools eclass provides functions and dependencies necessary to reconfigure (bootstrap) autotools files in packages. These are usually used in live ebuilds and when applying patches to configure.ac or Makefile.am files.

CodeExample ebuild code using autotools.eclass

inherit autotools

src_prepare() {
	eautoreconf
}

The eautoreconf function, similarly to autoreconf -vi, regenerates configure and template files used by autotools. It automatically detects use of automake, libtool, autoheader and subdirectory recursion, and calls the appropriate commands.

Much like autoreconf, it doesn't handle gettext, gtk-doc and other custom bootstrap steps necessary. For the former case, there's additional eautopoint function; for the latter, it is suggested to call the appropriate tool through autotools_run_tool (which prints a nice status message).

CodeExample bootstrap using gettext and gtk-doc

inherit autotools

src_prepare() {
	autotools_run_tool gtkdocize
	eautopoint
	eautoreconf
}

autotools-utils.eclass

The autotools-utils.eclass is meant to provide an extensive support for autotools build system features in ebuilds, in a syntax similar to cmake-utils.eclass.

Right now, autotools-utils.eclass handles:

  • intelligent removal of unnecessary .la files,
  • automatic handling of IUSE=static-libs,
  • out-of-source builds,
  • wrapping base.eclass to handle PATCHES, DOCS, HTML_DOCS and apply user patches,
  • wrapping libtool.eclass for the elibtoolize call.
CodeExample ebuild using autotools-utils.eclass

EAPI=4

IUSE="foo static-libs"

src_configure() {
	local myeconfargs=(
		$(use_enable foo)
	)
	autotools-utils_src_configure
}

libtool.eclass

Note
You don't usually need to use libtool.eclass yourself. It is called by default in autotools-utils.eclass and by eautoreconf

The libtool.eclass is an eclass providing means to apply Gentoo-specific patches and fixes to libtool used in package build system without the need for regenerating build system completely.

Personal tools
Namespaces

Variants
Actions
Gentoo Websites logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Navigation
Toolbox
Categories