Anatomy of a Gentoo Linux Ebuild

For every package in Gentoo there is at least one ebuild. Ebuilds are scripts that build packages from source.

Header

# Copyright 1999-2005 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $

Ebuild setup

KEYWORDS

This package has KEYWORDS=~86 which means it is marked unstable for the x86 platform. It will not be emerged unless either an entry in /etc/portage/package.keywords is added or the environment variable ACCEPT_KEYWORDS is set to "~x86". Note: Use of ACCEPT_KEYWORDS is not recommended. Add this line to /etc/portage/package.keywords to build the masked package from the overlay Portage directory.
 =net-misc/sipxportlib-3.0.1 ~x86

RESTRICT

RESTRICT="nomirror" instructs Portage not to download the source traball from the configured Gentoo Linux mirrors, but to use the URL defined in the ebuild. For ebuilds in Portage, this value is normally not set and the source tarballs are downloaded from the standard mirrors.
inherit eutils subversion kde-functions

DESCRIPTION="A native SIP communications system for voice, presence, messaging and collaboration - sipXportLib"
HOMEPAGE="http://www.sipfoundry.org/"
SRC_URI="http://www.sipfoundry.org/temp/sipX/tars/${P}.tar.gz"

LICENSE="LGPL-2"

SLOT="0"
KEYWORDS="~x86"
IUSE="doc latex"
#IUSE="doc latex ssl"
RESTRICT="nomirror"

Dependencies

DEPEND="
	doc? ( >=app-doc/doxygen-1.3.8 )
	>=dev-util/cppunit-1.10.2
	>=sys-devel/libtool-1.4.3
	>=dev-util/pkgconfig-0.15
	>=net-libs/libwww-5.4
	>=dev-libs/libpcre-5.0
	"
	#ssl? ( >=dev-libs/openssl-0.9.7d )

RDEPEND="
	>=dev-libs/libpcre-5.0
	>=net-libs/libwww-5.4
	"
	#ssl? ( >=dev-libs/openssl-0.9.7c )

Unpack the source

src_unpack() {
	unpack ${A}
}

Compile the source

src_compile() {
	econf \
		`use_enable doc doxygen` \
		`use_enable latex latex-docs` \
		--prefix=/usr/sipx \
		--localstatedir=/var \
		--with-sipxportinc=/usr/sipx/include \
		--with-sipxportlib=/usr/sipx/lib \
		--with-sipxmediainc=/usr/sipx/include \
		--with-sipxmedialib=/usr/sipx/lib \
		--with-sipxtackinc=/usr/sipx/include \
		--with-sipxtacklib=/usr/sipx/lib \
		|| die "Error: econf failed"
		#`use_enable ssl sip-tls` \

	emake || die "Error: emake failed"
}

Install

src_install() {
	make DESTDIR=${D} install || die "Error: install failed."
}
mike – Mon, 2005 – 12 – 19 08:47