Lines 34-43
can see real ebuilds in the main tree).
Link Here
|
34 |
</p> |
34 |
</p> |
35 |
|
35 |
|
36 |
<codesample lang="ebuild"> |
36 |
<codesample lang="ebuild"> |
37 |
# Copyright 1999-2010 Gentoo Foundation |
37 |
# Copyright 1999-2012 Gentoo Foundation |
38 |
# Distributed under the terms of the GNU General Public License v2 |
38 |
# Distributed under the terms of the GNU General Public License v2 |
39 |
# $Header: $ |
39 |
# $Header: $ |
40 |
|
40 |
|
|
|
41 |
EAPI=4 |
42 |
|
41 |
DESCRIPTION="Exuberant ctags generates tags files for quick source navigation" |
43 |
DESCRIPTION="Exuberant ctags generates tags files for quick source navigation" |
42 |
HOMEPAGE="http://ctags.sourceforge.net" |
44 |
HOMEPAGE="http://ctags.sourceforge.net" |
43 |
SRC_URI="mirror://sourceforge/ctags/${P}.tar.gz" |
45 |
SRC_URI="mirror://sourceforge/ctags/${P}.tar.gz" |
Lines 47-61
SLOT="0"
Link Here
|
47 |
KEYWORDS="~mips ~sparc ~x86" |
49 |
KEYWORDS="~mips ~sparc ~x86" |
48 |
IUSE="" |
50 |
IUSE="" |
49 |
|
51 |
|
50 |
src_compile() { |
52 |
src_configure() { |
51 |
econf --with-posix-regex |
53 |
econf --with-posix-regex |
52 |
emake || die |
|
|
53 |
} |
54 |
} |
54 |
|
55 |
|
55 |
src_install() { |
56 |
src_install() { |
56 |
emake DESTDIR="${D}" install || die |
57 |
emake DESTDIR="${D}" install |
57 |
|
58 |
|
58 |
dodoc FAQ NEWS README || die |
59 |
dodoc FAQ NEWS README |
59 |
dohtml EXTENDING.html ctags.html |
60 |
dohtml EXTENDING.html ctags.html |
60 |
} |
61 |
} |
61 |
</codesample> |
62 |
</codesample> |
Lines 91-96
the ebuild and package in question.
Link Here
|
91 |
</p> |
92 |
</p> |
92 |
|
93 |
|
93 |
<p> |
94 |
<p> |
|
|
95 |
The <c>EAPI</c> of the ebuild, see <uri link="::ebuild-writing/eapi"/>. |
96 |
</p> |
97 |
|
98 |
<p> |
94 |
The <c>DESCRIPTION</c> variable is set to a <e>short</e> description |
99 |
The <c>DESCRIPTION</c> variable is set to a <e>short</e> description |
95 |
of the package and its purpose. |
100 |
of the package and its purpose. |
96 |
</p> |
101 |
</p> |
Lines 101-110
include the <c>http://</c> part).
Link Here
|
101 |
</p> |
106 |
</p> |
102 |
|
107 |
|
103 |
<p> |
108 |
<p> |
104 |
The <c>LICENSE</c> is <c>GPL-2</c> (the GNU General Public License version 2). |
|
|
105 |
</p> |
106 |
|
107 |
<p> |
108 |
The <c>SRC_URI</c> tells Portage the address to use for downloading |
109 |
The <c>SRC_URI</c> tells Portage the address to use for downloading |
109 |
the source tarball. Here, <c>mirror://sourceforge/</c> is a special |
110 |
the source tarball. Here, <c>mirror://sourceforge/</c> is a special |
110 |
notation meaning "any of the Sourceforge mirrors". |
111 |
notation meaning "any of the Sourceforge mirrors". |
Lines 113-118
name and version <d/> in this case, it would be <c>ctags-5.5.4</c>.
Link Here
|
113 |
</p> |
114 |
</p> |
114 |
|
115 |
|
115 |
<p> |
116 |
<p> |
|
|
117 |
The <c>LICENSE</c> is <c>GPL-2</c> (the GNU General Public License version 2). |
118 |
</p> |
119 |
|
120 |
<p> |
116 |
The <c>SLOT</c> variable tells Portage which slot this package installs to. If |
121 |
The <c>SLOT</c> variable tells Portage which slot this package installs to. If |
117 |
you've not seen slots before, either just use <c>"0"</c> or read |
122 |
you've not seen slots before, either just use <c>"0"</c> or read |
118 |
<uri link="::general-concepts/slotting"/>. |
123 |
<uri link="::general-concepts/slotting"/>. |
Lines 132-146
details.
Link Here
|
132 |
|
137 |
|
133 |
<body> |
138 |
<body> |
134 |
<p> |
139 |
<p> |
135 |
Next, a function named <c>src_compile</c>. Portage will call this |
140 |
Next, a function named <c>src_configure</c>. Portage will call this |
136 |
function when it wants to <e>compile</e> the package. The <c>econf</c> |
141 |
function when it wants to <e>configure</e> the package. The <c>econf</c> |
137 |
function is a wrapper for calling <c>./configure</c>, and <c>emake</c> |
142 |
function is a wrapper for calling <c>./configure</c>. If for some reason |
138 |
is a wrapper for <c>make</c>. In the case of emake, the common <c>|| die |
143 |
an error occurs in <c>econf</c>, Portage will stop rather than trying to |
139 |
"something went wrong"</c> idiom is used <d/> this is to |
144 |
continue with the install. |
140 |
ensure that if for some reason an error occurs, Portage will stop |
|
|
141 |
rather than trying to continue with the install. Note that <c>econf</c> |
142 |
does not need the <c>|| die</c> idiom, as it dies by itself if something |
143 |
failed. |
144 |
</p> |
145 |
</p> |
145 |
|
146 |
|
146 |
<p> |
147 |
<p> |
Lines 149-156
to <e>install</e> the package. A slight subtlety here <d/> rather than
Link Here
|
149 |
installing straight to the live filesystem, we must install to a |
150 |
installing straight to the live filesystem, we must install to a |
150 |
special location which is given by the <c>${D}</c> variable (Portage sets |
151 |
special location which is given by the <c>${D}</c> variable (Portage sets |
151 |
this <d/> see <uri link="::general-concepts/install-destinations"/> and |
152 |
this <d/> see <uri link="::general-concepts/install-destinations"/> and |
152 |
<uri link="::general-concepts/sandbox"/>). Again, we check |
153 |
<uri link="::general-concepts/sandbox"/>). |
153 |
for errors using the <c>|| die</c> construct. |
|
|
154 |
</p> |
154 |
</p> |
155 |
|
155 |
|
156 |
<note> |
156 |
<note> |
Lines 169-180
files into the relevant part of <c>/usr/share/doc</c>.
Link Here
|
169 |
|
169 |
|
170 |
<p> |
170 |
<p> |
171 |
Ebuilds can define other functions (see <uri link="::ebuild-writing/functions"/>). |
171 |
Ebuilds can define other functions (see <uri link="::ebuild-writing/functions"/>). |
172 |
In all cases, Portage provides a reasonable default implementation which quite |
172 |
In all cases, Portage provides a reasonable default implementation which |
173 |
often does the 'right thing'. There was no need to define a <c>src_unpack</c> |
173 |
quite often does the 'right thing'. There was no need to define |
174 |
function here, for example <d/> this function is used to do any unpacking of |
174 |
<c>src_unpack</c> and <c>src_compile</c> functions here, for example |
175 |
tarballs or patching of source files, but the default implementation does |
175 |
<d/> the <c>src_unpack</c> function is used to do any unpacking of |
176 |
everything we need in this case. |
176 |
tarballs or patching of source files, but the default implementation |
|
|
177 |
does everything we need in this case. |
178 |
Similarly, the default <c>src_compile</c> function will call |
179 |
<c>emake</c> which is a wrapper for <c>make</c>. |
177 |
</p> |
180 |
</p> |
|
|
181 |
|
182 |
<note> |
183 |
Formerly, the <c>|| die</c> construct had to be used after every command |
184 |
to check for errors. This is no longer necessary in EAPI 4 <d/> |
185 |
functions provided by Portage will die by themselves if something |
186 |
failed. |
187 |
</note> |
178 |
</body> |
188 |
</body> |
179 |
</subsection> |
189 |
</subsection> |
180 |
|
190 |
|
Lines 197-206
Here's <c>app-misc/detox/detox-1.1.1.ebuild</c>:
Link Here
|
197 |
</p> |
207 |
</p> |
198 |
|
208 |
|
199 |
<codesample lang="ebuild"> |
209 |
<codesample lang="ebuild"> |
200 |
# Copyright 1999-2010 Gentoo Foundation |
210 |
# Copyright 1999-2012 Gentoo Foundation |
201 |
# Distributed under the terms of the GNU General Public License v2 |
211 |
# Distributed under the terms of the GNU General Public License v2 |
202 |
# $Header: $ |
212 |
# $Header: $ |
203 |
|
213 |
|
|
|
214 |
EAPI=4 |
215 |
|
204 |
DESCRIPTION="detox safely removes spaces and strange characters from filenames" |
216 |
DESCRIPTION="detox safely removes spaces and strange characters from filenames" |
205 |
HOMEPAGE="http://detox.sourceforge.net/" |
217 |
HOMEPAGE="http://detox.sourceforge.net/" |
206 |
SRC_URI="mirror://sourceforge/${PN}/${P}.tar.bz2" |
218 |
SRC_URI="mirror://sourceforge/${PN}/${P}.tar.bz2" |
Lines 215-228
DEPEND="${RDEPEND}
Link Here
|
215 |
sys-devel/flex |
227 |
sys-devel/flex |
216 |
sys-devel/bison" |
228 |
sys-devel/bison" |
217 |
|
229 |
|
218 |
src_compile() { |
230 |
src_configure() { |
219 |
econf --with-popt |
231 |
econf --with-popt |
220 |
emake || die |
|
|
221 |
} |
232 |
} |
222 |
|
233 |
|
223 |
src_install() { |
234 |
src_install() { |
224 |
emake DESTDIR="${D}" install || die |
235 |
emake DESTDIR="${D}" install |
225 |
dodoc README CHANGES || die |
236 |
dodoc README CHANGES |
226 |
} |
237 |
} |
227 |
</codesample> |
238 |
</codesample> |
228 |
|
239 |
|
Lines 235-241
variables <d/> see
Link Here
|
235 |
</p> |
246 |
</p> |
236 |
|
247 |
|
237 |
<p> |
248 |
<p> |
238 |
Again, we define <c>src_compile</c> and <c>src_install</c> functions. |
249 |
Again, we define <c>src_configure</c> and <c>src_install</c> functions. |
239 |
</p> |
250 |
</p> |
240 |
|
251 |
|
241 |
<p> |
252 |
<p> |
Lines 253-270
compile-time dependencies, and the <c>RDEPEND</c> lists runtime dependencies. Se
Link Here
|
253 |
|
264 |
|
254 |
<body> |
265 |
<body> |
255 |
<p> |
266 |
<p> |
256 |
Often we need to apply patches. This is done in the <c>src_unpack</c> function |
267 |
Often we need to apply patches. This is done in the <c>src_prepare</c> |
257 |
using the <c>epatch</c> helper function. To use <c>epatch</c> one must first tell |
268 |
function using the <c>epatch</c> helper function. To use <c>epatch</c> |
258 |
Portage that the <c>eutils</c> eclass (an eclass is like a library) is required <d/> |
269 |
one must first tell Portage that the <c>eutils</c> eclass (an eclass is |
|
|
270 |
like a library) is required <d/> |
259 |
this is done via <c>inherit eutils</c> at the top of the ebuild. Here's |
271 |
this is done via <c>inherit eutils</c> at the top of the ebuild. Here's |
260 |
<c>app-misc/detox/detox-1.1.0.ebuild</c>: |
272 |
<c>app-misc/detox/detox-1.1.0.ebuild</c>: |
261 |
</p> |
273 |
</p> |
262 |
|
274 |
|
263 |
<codesample lang="ebuild"> |
275 |
<codesample lang="ebuild"> |
264 |
# Copyright 1999-2010 Gentoo Foundation |
276 |
# Copyright 1999-2012 Gentoo Foundation |
265 |
# Distributed under the terms of the GNU General Public License v2 |
277 |
# Distributed under the terms of the GNU General Public License v2 |
266 |
# $Header: $ |
278 |
# $Header: $ |
267 |
|
279 |
|
|
|
280 |
EAPI=4 |
281 |
|
268 |
inherit eutils |
282 |
inherit eutils |
269 |
|
283 |
|
270 |
DESCRIPTION="detox safely removes spaces and strange characters from filenames" |
284 |
DESCRIPTION="detox safely removes spaces and strange characters from filenames" |
Lines 276-302
SLOT="0"
Link Here
|
276 |
KEYWORDS="~hppa ~mips ~sparc ~x86" |
290 |
KEYWORDS="~hppa ~mips ~sparc ~x86" |
277 |
IUSE="" |
291 |
IUSE="" |
278 |
|
292 |
|
279 |
RDEPEND="dev-libs/popt |
293 |
RDEPEND="dev-libs/popt" |
280 |
DEPEND="${RDEPEND} |
294 |
DEPEND="${RDEPEND} |
281 |
sys-devel/flex |
295 |
sys-devel/flex |
282 |
sys-devel/bison" |
296 |
sys-devel/bison" |
283 |
|
297 |
|
284 |
src_unpack() { |
298 |
src_prepare() { |
285 |
unpack ${A} |
|
|
286 |
cd "${S}" |
287 |
|
288 |
epatch "${FILESDIR}"/${P}-destdir.patch \ |
299 |
epatch "${FILESDIR}"/${P}-destdir.patch \ |
289 |
"${FILESDIR}"/${P}-parallel_build.patch |
300 |
"${FILESDIR}"/${P}-parallel_build.patch |
290 |
} |
301 |
} |
291 |
|
302 |
|
292 |
src_compile() { |
303 |
src_configure() { |
293 |
econf --with-popt |
304 |
econf --with-popt |
294 |
emake || die |
|
|
295 |
} |
305 |
} |
296 |
|
306 |
|
297 |
src_install() { |
307 |
src_install() { |
298 |
emake DESTDIR="${D}" install || die |
308 |
emake DESTDIR="${D}" install |
299 |
dodoc README CHANGES || die |
309 |
dodoc README CHANGES |
300 |
} |
310 |
} |
301 |
</codesample> |
311 |
</codesample> |
302 |
|
312 |
|
Lines 321-330
replacement iconv for <c>libc</c> implementations which don't have their own.
Link Here
|
321 |
</p> |
331 |
</p> |
322 |
|
332 |
|
323 |
<codesample lang="ebuild"> |
333 |
<codesample lang="ebuild"> |
324 |
# Copyright 1999-2010 Gentoo Foundation |
334 |
# Copyright 1999-2012 Gentoo Foundation |
325 |
# Distributed under the terms of the GNU General Public License v2 |
335 |
# Distributed under the terms of the GNU General Public License v2 |
326 |
# $Header: $ |
336 |
# $Header: $ |
327 |
|
337 |
|
|
|
338 |
EAPI=4 |
339 |
|
328 |
DESCRIPTION="GNU charset conversion library for libc which doesn't implement it" |
340 |
DESCRIPTION="GNU charset conversion library for libc which doesn't implement it" |
329 |
HOMEPAGE="http://www.gnu.org/software/libiconv/" |
341 |
HOMEPAGE="http://www.gnu.org/software/libiconv/" |
330 |
SRC_URI="ftp://ftp.gnu.org/pub/gnu/libiconv/${P}.tar.gz" |
342 |
SRC_URI="ftp://ftp.gnu.org/pub/gnu/libiconv/${P}.tar.gz" |
Lines 336-348
IUSE="nls"
Link Here
|
336 |
|
348 |
|
337 |
DEPEND="!sys-libs/glibc" |
349 |
DEPEND="!sys-libs/glibc" |
338 |
|
350 |
|
339 |
src_compile() { |
351 |
src_configure() { |
340 |
econf $(use_enable nls) |
352 |
econf $(use_enable nls) |
341 |
emake || die |
|
|
342 |
} |
353 |
} |
343 |
|
354 |
|
344 |
src_install() { |
355 |
src_install() { |
345 |
emake DESTDIR="${D}" install || die |
356 |
emake DESTDIR="${D}" install |
346 |
} |
357 |
} |
347 |
</codesample> |
358 |
</codesample> |
348 |
|
359 |
|
Lines 364-373
Another more complicated example, this time based upon
Link Here
|
364 |
</p> |
375 |
</p> |
365 |
|
376 |
|
366 |
<codesample lang="ebuild"> |
377 |
<codesample lang="ebuild"> |
367 |
# Copyright 1999-2010 Gentoo Foundation |
378 |
# Copyright 1999-2012 Gentoo Foundation |
368 |
# Distributed under the terms of the GNU General Public License v2 |
379 |
# Distributed under the terms of the GNU General Public License v2 |
369 |
# $Header: $ |
380 |
# $Header: $ |
370 |
|
381 |
|
|
|
382 |
EAPI=4 |
383 |
|
371 |
inherit eutils |
384 |
inherit eutils |
372 |
|
385 |
|
373 |
DESCRIPTION="A lightweight email client and newsreader" |
386 |
DESCRIPTION="A lightweight email client and newsreader" |
Lines 392-406
DEPEND="${RDEPEND}
Link Here
|
392 |
dev-util/pkgconfig |
405 |
dev-util/pkgconfig |
393 |
nls? ( >=sys-devel/gettext-0.12.1 )" |
406 |
nls? ( >=sys-devel/gettext-0.12.1 )" |
394 |
|
407 |
|
395 |
src_unpack() { |
408 |
src_prepare() { |
396 |
unpack ${A} |
|
|
397 |
cd "${S}" |
398 |
|
399 |
epatch "${FILESDIR}"/${PN}-namespace.diff \ |
409 |
epatch "${FILESDIR}"/${PN}-namespace.diff \ |
400 |
"${FILESDIR}"/${PN}-procmime.diff |
410 |
"${FILESDIR}"/${PN}-procmime.diff |
401 |
} |
411 |
} |
402 |
|
412 |
|
403 |
src_compile() { |
413 |
src_configure() { |
404 |
econf \ |
414 |
econf \ |
405 |
$(use_enable nls) \ |
415 |
$(use_enable nls) \ |
406 |
$(use_enable ssl) \ |
416 |
$(use_enable ssl) \ |
Lines 410-426
src_compile() {
Link Here
|
410 |
$(use_enable ipv6) \ |
420 |
$(use_enable ipv6) \ |
411 |
$(use_enable imlib) \ |
421 |
$(use_enable imlib) \ |
412 |
$(use_enable xface compface) |
422 |
$(use_enable xface compface) |
413 |
|
|
|
414 |
emake || die |
415 |
} |
423 |
} |
416 |
|
424 |
|
417 |
src_install() { |
425 |
src_install() { |
418 |
emake DESTDIR="${D}" install || die |
426 |
emake DESTDIR="${D}" install |
419 |
|
427 |
|
420 |
doicon sylpheed.png |
428 |
doicon sylpheed.png |
421 |
domenu sylpheed.desktop |
429 |
domenu sylpheed.desktop |
422 |
|
430 |
|
423 |
dodoc [A-Z][A-Z]* ChangeLog* || die |
431 |
dodoc [A-Z][A-Z]* ChangeLog* |
424 |
} |
432 |
} |
425 |
</codesample> |
433 |
</codesample> |
426 |
|
434 |
|
427 |
- |
|
|