Jump to content

ebuild

From Wikipedia, the free encyclopedia

This is an old revision of this page, as edited by Ansell (talk | contribs) at 23:30, 28 August 2006 (Examples: replace with currently available example which adds PATCHES and removes unnecessary comment by developer). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

An ebuild is a specialized bash script written for the Portage system of Gentoo Linux to install software on the system. An ebuild is an automated way to script the compilation and install procedure used to compile and install GNU autotools-based source packages (although ebuilds can be written for software using any build system). In addition to automation, ebuilds (and Portage in general) allow for automatic dependency calculation, full live system upgrades (without having to reinstall the entire distribution), package uninstallation and more.

Each application or package in the portage tree has an ebuild written for it. This ebuild can be invoked with the emerge command like this: emerge [name of ebuild].

This command calculates dependencies (installing them if necessary), downloads the source code, patches it (if necessary), configures (based on USE flag settings), compiles and performs a sandboxed install (in /var/tmp/portage/[ebuild name]/ by default). After these steps are successful, a list of installed files is created and the installed binaries are merged into the system.

Most ebuilds are used in the above way to compile source code, but there are also ebuilds to install binary packages (such as proprietary software or very large applications such as OpenOffice.org), ebuilds that install only documentation or data such as fonts, and metabuilds that trigger the execution of a group of other ebuilds (such as the GNOME or KDE metabuilds).

Examples

Here is an example ebuild for the Beep software:

<nowiki># Copyright 1999-2006 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/app-misc/beep/beep-1.2.2-r1.ebuild,v 1.3 2006/08/19 11:00:37 kloeri Exp $

inherit eutils base

DESCRIPTION="the advanced PC speaker beeper"
HOMEPAGE="http://www.johnath.com/beep/"
SRC_URI="http://www.johnath.com/beep/${P}.tar.gz"

LICENSE="GPL-2"
SLOT="0"
KEYWORDS="alpha amd64 ~ppc ~ppc64 ~sparc ~x86"
IUSE=""

PATCHES="${FILESDIR}/${P}-nosuid.patch"

src_compile() {
	emake FLAGS="${CFLAGS}" || die "compile problem"
}

src_install() {
	dobin beep
	fperms 0711 /usr/bin/beep
	doman beep.1.gz
	dodoc CHANGELOG CREDITS README
}

See also