b461437b14264f51c15c8d95a51d600859ae76a8
[portage.git] / man / ebuild.5
1 .TH "EBUILD" "5" "May 2013" "Portage VERSION" "Portage"
2
3 .SH "NAME"
4 ebuild \- the internal format, variables, and functions in an ebuild script
5
6 .SH "DESCRIPTION"
7 The \fBebuild\fR(1) program accepts a single ebuild script as an argument.
8 This script contains variables and commands that specify how to download,
9 unpack, patch, compile, install and merge a particular software package from
10 its original sources.  In addition to all of this, the ebuild script can also
11 contain pre/post install/remove commands, as required.  All ebuild scripts are
12 written in bash.
13
14 .SS "Dependencies"
15 A \fIdepend atom\fR is simply a dependency that is used by portage when calculating
16 relationships between packages.  Please note that if the atom has not already
17 been emerged, then the latest version available is matched.
18 .TP
19 .B Atom Bases
20 The base atom is just a full category/packagename.
21
22 Examples:
23 .nf
24 .I      sys\-apps/sed
25 .I      sys\-libs/zlib
26 .I      net\-misc/dhcp
27 .fi
28 .TP
29 .B Atom Versions
30 It is nice to be more specific and say that only certain versions of atoms are
31 acceptable.  Note that versions must be combined with a prefix (see below).  
32 Hence you may add a version number as a postfix to the base.
33
34 Examples:
35 .nf
36         sys\-apps/sed\fI\-4.0.5\fR
37         sys\-libs/zlib\fI\-1.1.4\-r1\fR
38         net\-misc/dhcp\fI\-3.0_p2\fR
39 .fi
40
41 Versions are normally made up of two or three numbers separated by periods, such
42 as 1.2 or 4.5.2.  This string may be followed by a character such as 1.2a or 
43 4.5.2z.  Note that this letter is \fInot\fR meant to indicate alpha, beta,
44 etc... status.  For that, use the optional suffix; either _alpha, _beta, _pre 
45 (pre\-release), _rc (release candidate), or _p (patch).  This means for the 
46 3rd pre\-release of a package, you would use something like 1.2_pre3.  The 
47 suffixes here can be arbitrarily chained without limitation.
48 .TP
49 .B Atom Prefix Operators [> >= = <= <]
50 Sometimes you want to be able to depend on general versions rather than specifying
51 exact versions all the time.  Hence we provide standard boolean operators:
52
53 Examples:
54 .nf
55         \fI>\fRmedia\-libs/libgd\-1.6
56         \fI>=\fRmedia\-libs/libgd\-1.6
57         \fI=\fRmedia\-libs/libgd\-1.6
58         \fI<=\fRmedia\-libs/libgd\-1.6
59         \fI<\fRmedia\-libs/libgd\-1.6
60 .fi
61 .TP
62 .B Extended Atom Prefixes [!~] and Postfixes [*]
63 Now to get even fancier, we provide the ability to define blocking packages and
64 version range matching.  Also note that these extended prefixes/postfixes may
65 be combined in any way with the atom classes defined above.
66 .RS
67 .TP
68 .I ~
69 means match any revision of the base version specified.  So in the
70 example below, we would match versions '1.0.2a', '1.0.2a\-r1', '1.0.2a\-r2',
71 etc...
72
73 Example:
74 .nf
75         \fI~\fRnet\-libs/libnet\-1.0.2a
76 .fi
77 .TP
78 .I !
79 means block packages from being installed at the same time.
80
81 Example:
82 .nf
83         \fI!\fRapp\-text/dos2unix
84 .fi
85 .TP
86 .I !!
87 means block packages from being installed at the same time
88 and explicitly disallow them from being temporarily installed
89 simultaneously during a series of upgrades. This syntax is supported
90 beginning with \fBEAPI 2\fR.
91
92 Example:
93 .nf
94         \fI!!\fR<sys\-apps/portage\-2.1.4_rc1
95 .fi
96 .TP
97 .I *
98 means match any version of the package so long
99 as the specified string prefix is matched. So with a
100 version of '2*', we can match '2.1', '2.2', '2.2.1',
101 etc... and not match version '1.0', '3.0', '4.1', etc...
102 Beware that, due to the string matching nature, '20'
103 will also be matched by '2*'. The version part
104 that comes before the '*' must be a valid version in the absence of the '*'.
105 For example, '2' is a valid version and '2.' is not. Therefore, '2*' is
106 allowed and '2.*' is not.
107
108 Examples:
109 .nf
110         =dev\-libs/glib\-2\fI*\fR
111         \fI!\fR=net\-fs/samba\-2\fI*\fR
112 .fi
113 .RE
114 .TP
115 .B Atom Slots
116 Beginning with \fBEAPI 1\fR, any atom can be constrained to match a specific
117 \fBSLOT\fR. This is accomplished by appending a colon followed by a
118 \fBSLOT\fR:
119
120 Examples:
121 .nf
122         x11\-libs/qt:3
123         \fI~\fRx11\-libs/qt-3.3.8:3
124         \fI>=\fRx11\-libs/qt-3.3.8:3
125         \fI=\fRx11\-libs/qt-3.3*:3
126 .fi
127 .TP
128 .B Sub Slots
129 Beginning with \fBEAPI 5\fR, a slot dependency may contain an
130 optional sub\-slot part that follows the regular slot and is
131 delimited by a \fI/\fR character.
132
133 Examples:
134 .nf
135         dev\-libs/icu:0/0
136         dev\-libs/icu:0/49
137         dev\-lang/perl:0/5.12
138         dev\-libs/glib:2/2.30
139 .fi
140 .TP
141 .B Atom Slot Operators
142 Beginning with \fBEAPI 5\fR, slot operator dependency consists
143 of a colon followed by one of the following operators:
144 .RS
145 .TP
146 .I *
147 Indicates that any slot value is acceptable. In addition,
148 for runtime dependencies, indicates that the package will not
149 break if the matched package is uninstalled and replaced by
150 a different matching package in a different slot.
151
152 Examples:
153 .nf
154         dev\-libs/icu:*
155         dev\-lang/perl:*
156         dev-libs/glib:*
157 .fi
158 .TP
159 .I =
160 Indicates that any slot value is acceptable. In addition,
161 for runtime dependencies, indicates that the package will
162 break unless a matching package with slot and sub\-slot equal
163 to the slot and sub\-slot of the best installed version at the
164 time the package was installed is available.
165
166 Examples:
167 .nf
168         dev\-libs/icu:=
169         dev\-lang/perl:=
170         dev-libs/glib:=
171 .fi
172 .TP
173 .I slot=
174 Indicates that only a specific slot value is acceptable, and
175 otherwise behaves identically to the plain equals slot operator.
176
177 Examples:
178 .nf
179         dev\-libs/icu:0=
180         dev\-lang/perl:0=
181         dev-libs/glib:2=
182 .fi
183 .PP
184 To implement the equals slot operator, the package manager
185 will need to store the slot/sub\-slot pair of the best installed
186 version of the matching package. This syntax is only for package
187 manager use and must not be used by ebuilds. The package manager
188 may do this by inserting the appropriate slot/sub\-slot pair
189 between the colon and equals sign when saving the package's
190 dependencies. The sub\-slot part must not be omitted here
191 (when the SLOT variable omits the sub\-slot part, the package
192 is considered to have an implicit sub\-slot which is equal to
193 the regular slot).
194
195 Examples:
196 .nf
197         dev\-libs/icu:0/0=
198         dev\-libs/icu:0/49=
199         dev\-lang/perl:0/5.12=
200         dev-libs/glib:2/2.30=
201 .fi
202 .RE
203 .TP
204 .B Atom USE
205 Beginning with \fBEAPI 2\fR, any atom can be constrained to match specific
206 \fBUSE\fR flag settings. When used together with \fBSLOT\fR dependencies,
207 \fBUSE\fR dependencies appear on the right hand side of \fBSLOT\fR
208 dependencies.
209 .RS
210 .TP
211 .B Unconditional USE Dependencies
212 .TS
213 l l
214 __
215 l l.
216 Example Meaning
217 foo[bar]        foo must have bar enabled
218 foo[bar,baz]    foo must have both bar and baz enabled
219 foo[\-bar,baz]  foo must have bar disabled and baz enabled
220 .TE
221 .TP
222 .B Conditional USE Dependencies
223 .TS
224 l l
225 __
226 l l.
227 Compact Form    Equivalent Expanded Form
228 foo[bar?]       bar? ( foo[bar] ) !bar? ( foo )
229 foo[!bar?]      bar? ( foo ) !bar? ( foo[\-bar] )
230 foo[bar=]       bar? ( foo[bar] ) !bar? ( foo[\-bar] )
231 foo[!bar=]      bar? ( foo[\-bar] ) !bar? ( foo[bar] )
232 .TE
233 .RE
234 .TP
235 .B Atom USE defaults
236 Beginning with \fBEAPI 4\fR, \fBUSE\fR dependencies may specify default
237 assumptions about values for flags that may or may not be missing from
238 the \fBIUSE\fR of the matched package. Such defaults are specified by
239 immediately following a flag with either \fI(+)\fR or \fI(\-)\fR. Use
240 \fI(+)\fR to behave as if a missing flag is present and enabled, or
241 \fI(\-)\fR to behave as if it is present and disabled:
242
243 Examples:
244 .nf
245         media\-video/ffmpeg[threads(+)]
246         media\-video/ffmpeg[-threads(\-)]
247 .fi
248 .TP
249 .B Dynamic Dependencies
250 Sometimes programs may depend on different things depending on the USE
251 variable.  Portage offers a few options to handle this.  Note that when
252 using the following syntaxes, each case is considered as 1 Atom in the
253 scope it appears.  That means that each Atom both conditionally include
254 multiple Atoms and be nested to an infinite depth.
255 .RS
256 .TP
257 .B usevar? ( Atom )
258 To include the jpeg library when the user has jpeg in \fBUSE\fR, simply use the
259 following syntax:
260
261 jpeg? ( media\-libs/jpeg )
262 .TP
263 .B !usevar? ( Atom )
264 If you want to include a package only if the user does not have a certain option
265 in their \fBUSE\fR variable, then use the following syntax:
266
267 !nophysfs? ( dev\-games/physfs )
268
269 This is often useful for those times when you want to want to add optional support
270 for a feature and have it enabled by default.
271 .TP
272 .B usevar? ( Atom if true ) !usevar? ( Atom if false )
273 For functionality like the tertiary operator found in C you must use
274 two statements, one normal and one inverted.  If a package uses
275 GTK2 or GTK1, but not both, then you can handle that like this:
276
277 gtk2? ( =x11\-libs/gtk+\-2* ) !gtk2? ( =x11\-libs/gtk+\-1* )
278
279 That way the default is the superior GTK2 library.
280 .TP
281 .B || ( Atom Atom ... )
282 When a package can work with a few different packages but a virtual is not
283 appropriate, this syntax can easily be used.
284
285 Example:
286 .nf
287 || (
288         app\-games/unreal\-tournament
289         app\-games/unreal\-tournament\-goty
290 )
291 .fi
292
293 Here we see that unreal\-tournament has a normal version and it has a goty
294 version.  Since they provide the same base set of files, another package can
295 use either.  Adding a virtual is inappropriate due to the small scope of it.
296
297 Another good example is when a package can be built with multiple video
298 interfaces, but it can only ever have just one.
299
300 Example:
301 .nf
302 || (
303         sdl? ( media\-libs/libsdl )
304         svga? ( media\-libs/svgalib )
305         opengl? ( virtual/opengl )
306         ggi? ( media\-libs/libggi )
307         virtual/x11
308 )
309 .fi
310
311 Here only one of the packages will be chosen, and the order of preference is
312 determined by the order in which they appear.  So sdl has the best chance of
313 being chosen, followed by svga, then opengl, then ggi, with a default of X if
314 the user does not specify any of the previous choices.
315
316 Note that if any of the packages listed are already merged, the package manager
317 will use that to consider the dependency satisfied.
318
319 .SS "Cross-compilation"
320 Portage supports cross-compilation into a subdirectory specified by \fBROOT\fR.
321 .TP
322 .B Host
323 \fIHost\fR in this context means the platform hosting the build process, i.e.
324 what autotools calls CBUILD.
325 Its packages are contained in the root of the filesystem ("\fI/\fR").
326
327 If \fBROOT\fR is "\fI/\fR", all dependency types will be installed there.
328 Otherwise, for EAPIs that support \fBHDEPEND\fR (experimental
329 \fBEAPI 5-hdepend\fR), only \fBHDEPEND\fR is installed into "\fI/\fR".
330 For EAPIs that do not support \fBHDEPEND\fR, the behaviour is controlled by the
331 \fI\-\-root-deps\fR flag to \fBemerge\fR(1), defaulting to install only
332 \fBDEPEND\fR into the \fIhost\fR.
333 .TP
334 .B Target
335 \fITarget\fR refers to the platform that the package will later run on, i.e.
336 what autotools calls CHOST.
337 The directory housing this system is specified by \fBROOT\fR.
338 If it is different from "\fI/\fR", i.e. \fIhost\fR and \fItarget\fR are not the
339 same, this variable contains the path to the directory housing the \fItarget\fR
340 system.
341
342 For EAPIs that support \fBHDEPEND\fR (experimental \fBEAPI 5-hdepend\fR),
343 \fBDEPEND\fR, \fBRDEPEND\fR, and \fBPDEPEND\fR
344 list the \fItarget\fR dependencies, i.e. those to be installed into \fBROOT\fR.
345 For EAPIs that do not support \fBHDEPEND\fR, the \fBemerge\fR(1) flag
346 \fI\-\-root-deps\fR controls what the package manager installs there.
347 Without it, \fBemerge\fR defaults to install only runtime dependencies (i.e.
348 \fBRDEPEND\fR and \fBPDEPEND\fR) into \fBROOT\fR.
349 .PP
350 See section \fBVARIABLES\fR for more information about the \fBDEPEND\fR,
351 \fBRDEPEND\fR and \fBHDEPEND\fR variables.
352 .TP
353 .B The targetroot USE flag
354 For EAPIs that support the "\fItargetroot\fR" USE flag, that flag is
355 automatically enabled by the package manager if \fIhost\fR and \fItarget\fR
356 system are not the same, i.e. if the \fBROOT\fR is not "\fI/\fR".
357 This is necessary where the package to be built needs an executable copy of
358 itself during the build process.
359 A known example is dev-lang/python, which needs to run a Python interpreter
360 during compilation.
361
362 .SH "VARIABLES"
363 .TP
364 .B Usage Notes
365 \- All variables defined in \fBmake.conf\fR(5) are available for use in
366 ebuilds (such as the PORTAGE* and PORTDIR* variables)
367 .br
368 \- When assigning values to variables in ebuilds, you \fIcannot have a
369 space\fR between the variable name and the equal sign.
370 .br
371 \- Variable values should only contain characters that are members of the
372 \fBascii\fR(7) character set. This requirement is mandated by \fBGLEP 31\fR.
373 .TP
374 .B P
375 This variable contains the package name without the ebuild revision.
376 This variable must NEVER be modified.
377
378 xfree\-4.2.1\-r2.ebuild \-\-> $P=='xfree\-4.2.1'
379 .TP
380 .B PN
381 Contains the name of the script without the version number.
382
383 xfree\-4.2.1\-r2.ebuild \-\-> $PN=='xfree'
384 .TP
385 .B PV
386 Contains the version number without the revision.
387
388 xfree\-4.2.1\-r2.ebuild \-\-> $PV=='4.2.1'
389 .TP
390 .B PR
391 Contains the revision number or 'r0' if no revision number exists.
392
393 xfree\-4.2.1\-r2.ebuild \-\-> $PR=='r2'
394 .TP
395 .B PVR
396 Contains the version number with the revision.
397
398 xfree\-4.2.1\-r2.ebuild \-\-> $PVR=='4.2.1\-r2'
399 .TP
400 .B PF
401 Contains the full package name \fBPN\fR\-\fBPVR\fR
402
403 xfree\-4.2.1\-r2.ebuild \-\-> $PF=='xfree\-4.2.1\-r2'
404 .TP
405 .B CATEGORY
406 Contains the package category name.
407 .TP
408 .B A
409 Contains all source files required for the package.  This variable must
410 not be defined. It is autogenerated from the \fBSRC_URI\fR variable.
411 .TP
412 .B WORKDIR\fR = \fI"${PORTAGE_TMPDIR}/portage/${CATEGORY}/${PF}/work"
413 Contains the path to the package build root.  Do not modify this variable.
414 .TP
415 .B FILESDIR\fR = \fI"${PORTDIR}/${CATEGORY}/${PN}/files"
416 Contains the path to the 'files' sub folder in the package specific
417 location in the portage tree.  Do not modify this variable.
418 .TP
419 .B EBUILD_PHASE
420 Contains the abreviated name of the phase function that is
421 currently executing, such as "setup", "unpack", "compile", or
422 "preinst".
423 .TP
424 .B EBUILD_PHASE_FUNC
425 Beginning with \fBEAPI 5\fR, contains the full name of the phase
426 function that is currently executing, such as "pkg_setup",
427 "src_unpack", "src_compile", or "pkg_preinst".
428 .TP
429 .B EPREFIX
430 Beginning with \fBEAPI 3\fR, contains the offset
431 that this Portage was configured for during
432 installation.  The offset is sometimes necessary in an ebuild or eclass,
433 and is available in such cases as ${EPREFIX}.  EPREFIX does not contain
434 a trailing slash, therefore an absent offset is represented by the empty
435 string.  Do not modify this variable.
436 .TP
437 .B S\fR = \fI"${WORKDIR}/${P}"
438 Contains the path to the temporary \fIbuild directory\fR.  This variable
439 is used by the functions \fIsrc_compile\fR and \fIsrc_install\fR.  Both
440 are executed with \fIS\fR as the current directory.  This variable may
441 be modified to match the extraction directory of a tarball for the package.
442 .TP
443 .B T\fR = \fI"${PORTAGE_TMPDIR}/portage/${CATEGORY}/${PF}/temp"
444 Contains the path to a \fItemporary directory\fR.  You may use this for
445 whatever you like.
446 .TP
447 .B D\fR = \fI"${PORTAGE_TMPDIR}/portage/${CATEGORY}/${PF}/image/"
448 Contains the path to the temporary \fIinstall directory\fR.  Every write
449 operation that does not involve the helper tools and functions (found below)
450 should be prefixed with ${D}.
451 Beginning with \fBEAPI 3\fR, the offset prefix often needs
452 to be taken into account here, for which the variable
453 ${ED} is provided (see below).
454 Do not modify this variable.
455 .TP
456 .B ED\fR = \fI"${PORTAGE_TMPDIR}/portage/${CATEGORY}/${PF}/image/${EPREFIX}/"
457 Beginning with \fBEAPI 3\fR, contains the path
458 "${D%/}${EPREFIX}/" for convenience purposes.
459 For EAPI values prior to \fBEAPI 3\fR which do
460 not support ED, helpers use \fBD\fR where
461 they would otherwise use ED.
462 Do not modify this variable.
463 .TP
464 .B MERGE_TYPE
465 Beginning with \fBEAPI 4\fR, the MERGE_TYPE variable can be used to
466 query the current merge type. This variable will contain one of the
467 following possible values:
468
469 .RS
470 .TS
471 l l
472 __
473 l l.
474 Value   Meaning
475 binary  previously\-built which is scheduled for merge
476 buildonly       source\-build which is not scheduled for merge
477 source  source\-build which is scheduled for merge
478 .TE
479 .RE
480 .TP
481 .B PORTAGE_LOG_FILE
482 Contains the path of the build log. If \fBPORT_LOGDIR\fR variable is unset then
483 PORTAGE_LOG_FILE=\fI"${T}/build.log"\fR.
484 .TP
485 .B REPLACED_BY_VERSION
486 Beginning with \fBEAPI 4\fR, the REPLACED_BY_VERSION variable can be
487 used in pkg_prerm and pkg_postrm to query the package version that
488 is replacing the current package. If there is no replacement package,
489 the variable will be empty, otherwise it will contain a single version
490 number.
491 .TP
492 .B REPLACING_VERSIONS
493 Beginning with \fBEAPI 4\fR, the REPLACING_VERSIONS variable can be
494 used in pkg_pretend, pkg_setup, pkg_preinst and pkg_postinst to query
495 the package version(s) that the current package is replacing. If there
496 are no packages to replace, the variable will be empty, otherwise it
497 will contain a space\-separated list of version numbers corresponding
498 to the package version(s) being replaced. Typically, this variable will
499 not contain more than one version, but according to PMS it can contain
500 more.
501 .TP
502 .B ROOT\fR = \fI"/"
503 Contains the path that portage should use as the root of the live filesystem.
504 When packages wish to make changes to the live filesystem, they should do so in
505 the tree prefixed by ${ROOT}.  Often the offset prefix needs to be taken
506 into account here, for which the variable ${EROOT} is provided (see
507 below).  Do not modify this variable.
508 .TP
509 .B EROOT\fR = \fI"${ROOT%/}${EPREFIX}/"
510 Beginning with \fBEAPI 3\fR, contains
511 "${ROOT%/}${EPREFIX}/" for convenience
512 purposes. Do not modify this variable.
513 .TP
514 .B DESCRIPTION\fR = \fI"A happy little package"
515 Should contain a short description of the package.
516 .TP
517 .B EAPI\fR = \fI"0"
518 Defines the ebuild API version to which this package conforms. If not
519 defined then it defaults to "0". If portage does not recognize the
520 EAPI value then it will mask the package and refuse to perform any
521 operations with it since this means that a newer version of portage
522 needs to be installed first. For maximum backward compatiblity, a
523 package should conform to the lowest possible EAPI. Note that anyone
524 who uses the \fBebuild\fR(1) and \fBrepoman\fR(1) commands with this
525 package will be required to have a version of portage that recognizes
526 the EAPI to which this package conforms.
527 .TP
528 .B SRC_URI\fR = \fI"http://example.com/path/${P}.tar.gz"
529 Contains a list of URIs for the required source files.  It can contain
530 multiple URIs for a single source file.  The list is processed in order
531 if the file was not found on any of the \fIGENTOO_MIRRORS\fR.
532 Beginning with \fBEAPI 2\fR, the output file name of a given URI may be
533 customized with a "->" operator on the right hand side, followed by the
534 desired output file name. All tokens, including the operator and output
535 file name, should be separated by whitespace.
536 .TP
537 .B HOMEPAGE\fR = \fI"http://example.com/"
538 Should contain a list of URIs for the sources main sites and other further
539 package dependent information.
540 .TP
541 .B KEYWORDS\fR = \fI[\-~][x86,ppc,sparc,mips,alpha,arm,hppa]
542 Should contain appropriate list of arches that the ebuild is know to
543 work/not work.  By default if you do not know if an ebuild runs under
544 a particular arch simply omit that KEYWORD.  If the ebuild will not
545 work on that arch include it as \-ppc for example.  If the ebuild is
546 being submitted for inclusion, it must have ~arch set for architectures
547 where it has been PROVEN TO WORK.  (Packages KEYWORDed this way may be
548 unmasked for testing by setting ACCEPT_KEYWORDS="~arch" on the command
549 line, or in \fBmake.conf\fR(5)) For an authoritative list please review
550 /usr/portage/profiles/arch.list.  Please keep this list in alphabetical order.
551 .TP
552 .B SLOT
553 This sets the SLOT for packages that may need to have multiple versions
554 co\-exist.  By default you should set \fBSLOT\fR="0".  If you are unsure, then
555 do not fiddle with this until you seek some guidance from some guru.  This
556 value should \fINEVER\fR be left undefined.
557
558 Beginning with \fBEAPI 5\fR, the SLOT variable may contain
559 an optional sub\-slot part that follows the regular slot and
560 is delimited by a / character. The sub\-slot must be a valid
561 slot name. The sub\-slot is used to represent cases in which
562 an upgrade to a new version of a package with a different
563 sub\-slot may require dependent packages to be rebuilt. When
564 the sub\-slot part is omitted from the SLOT definition, the
565 package is considered to have an implicit sub\-slot which is
566 equal to the regular slot. Refer to the \fBAtom Slot
567 Operators\fR section for more information about sub\-slot
568 usage.
569 .TP
570 .B LICENSE
571 This should be a space delimited list of licenses that the package falls
572 under.  This \fB_must_\fR be set to a matching license in
573 /usr/portage/licenses/. If the license does not exist in portage yet, you
574 must add it first.
575 .TP
576 .B IUSE
577 This should be a list of any and all USE flags that are leveraged within
578 your build script.  The only USE flags that should not be listed here are
579 arch related flags (see \fBKEYWORDS\fR). Beginning with \fBEAPI 1\fR, it
580 is possible to prefix flags with + or - in order to create default settings
581 that respectively enable or disable the corresponding \fBUSE\fR flags. For
582 details about \fBUSE\fR flag stacking order, refer to the \fBUSE_ORDER\fR
583 variable in \fBmake.conf\fR(5). Given the default \fBUSE_ORDER\fR setting,
584 negative IUSE default settings are effective only for negation of
585 repo\-level USE settings, since profile and user configuration settings
586 override them.
587 .TP
588 .B DEPEND
589 This should contain a list of all packages that are required for the program
590 to compile (aka \fIbuildtime\fR dependencies).  These are usually libraries and
591 headers.
592
593 Starting from experimental \fBEAPI 5-hdepend\fR, tools should go into the
594 \fBHDEPEND\fR variable instead, as \fBDEPEND\fR will only be installed into the
595 \fItarget\fR system and hence cannot be executed in a cross\-compile setting.
596 (See section \fBCross\-compilation\fR for more information.)
597
598 You may use the syntax described above in the \fBDependencies\fR section.
599 .TP
600 .B RDEPEND
601 This should contain a list of all packages that are required for this
602 program to run (aka \fIruntime\fR dependencies).  These are usually libraries.
603
604 In \fBEAPI 3\fR or earlier, if this is not set, then it defaults to the value
605 of \fBDEPEND\fR. In \fBEAPI 4\fR or later, \fBRDEPEND\fR will never be
606 implicitly set.
607
608 You may use the syntax described above in the \fBDependencies\fR section.
609 .TP
610 .B HDEPEND
611 This should contain a list of all packages that are required to be executable
612 during compilation of this program (aka \fIhost\fR buildtime dependencies).
613 These are usually tools, like interpreters or (cross\-)compilers.
614
615 This variable is new in experimental \fBEAPI 5-hdepend\fR and will be installed
616 into the \fIhost\fR system.
617 (See section \fBCross-compilation\fR for more information.)
618
619 You may use the syntax described above in the \fBDependencies\fR section.
620 .TP
621 .B PDEPEND
622 This should contain a list of all packages that should be merged after this
623 one (aka \fIpost\fR merge dependencies), but which may be installed by the
624 package manager at any time, if that is not possible.
625
626 .B ***WARNING***
627 .br
628 Use this only as last resort to break cyclic dependencies!
629
630 You may use the syntax described above in the \fBDependencies\fR section.
631 .TP
632 .B REQUIRED_USE
633 Beginning with \fBEAPI 4\fR, the \fBREQUIRED_USE\fR variable can be
634 used to specify combinations of \fBUSE\fR flags that are allowed
635 or not allowed. Elements can be nested when necessary.
636 .TS
637 l l
638 __
639 l l.
640 Behavior        Expression
641 If flag1 enabled then flag2 disabled    flag1? ( !flag2 )
642 If flag1 enabled then flag2 enabled     flag1? ( flag2 )
643 If flag1 disabled then flag2 enabled    !flag1? ( flag2 )
644 If flag1 disabled then flag2 disabled   !flag1? ( !flag2 )
645 Must enable any one or more (inclusive or)      || ( flag1 flag2 flag3 )
646 Must enable exactly one but not more (exclusive or)     ^^ ( flag1 flag2 flag3 )
647 May enable at most one (EAPI 5 or later)        ?? ( flag1 flag2 flag3 )
648 .TE
649 .TP
650 .B RESTRICT\fR = \fI[strip,mirror,fetch,userpriv]
651 This should be a space delimited list of portage features to restrict.
652 You may use conditional syntax to vary restrictions as seen above in DEPEND.
653 .PD 0
654 .RS
655 .TP
656 .I binchecks
657 Disable all QA checks for binaries.  This should ONLY be used in packages
658 for which binary checks make no sense (linux\-headers and kernel\-sources, for
659 example, can safely be skipped since they have no binaries).  If the binary
660 checks need to be skipped for other reasons (such as proprietary binaries),
661 see the \fBQA CONTROL VARIABLES\fR section for more specific exemptions.
662 .TP
663 .I bindist
664 Distribution of built packages is restricted.
665 .TP
666 .I fetch
667 like \fImirror\fR but the files will not be fetched via \fBSRC_URI\fR either.
668 .TP
669 .I installsources
670 Disables installsources for specific packages. This is for packages with
671 binaries that are not compatible with debugedit.
672 .TP
673 .I mirror
674 files in \fBSRC_URI\fR will not be downloaded from the \fBGENTOO_MIRRORS\fR.
675 .TP
676 .I preserve\-libs
677 Disables preserve\-libs for specific packages. Note than when a package is
678 merged, RESTRICT=preserve\-libs applies if either the new instance or the
679 old instance sets RESTRICT=preserve\-libs.
680 .TP
681 .I primaryuri
682 fetch from URIs in \fBSRC_URI\fR before \fBGENTOO_MIRRORS\fR.
683 .TP
684 .I splitdebug
685 Disables splitdebug for specific packages. This is for packages with
686 binaries that trigger problems with splitdebug, such as file\-collisions
687 between symlinks in /usr/lib/debug/.build-id (triggered by bundled libraries).
688 .TP
689 .I strip
690 final binaries/libraries will not be stripped of debug symbols.
691 .TP
692 .I test
693 do not run src_test even if user has \fBFEATURES\fR=test.
694 .TP
695 .I userpriv
696 Disables userpriv for specific packages.
697 .RE
698 .PD 1
699 .TP
700 .B PROPERTIES\fR = \fI[interactive]
701 A space delimited list of properties, with conditional syntax support.
702 .PD 0
703 .RS
704 .TP
705 .I interactive
706 One or more ebuild phases will produce a prompt that requires user interaction.
707 .RE
708 .PD 1
709 .TP
710 .B PROVIDE\fR = \fI"virtual/TARGET"
711 This variable should only be used when a package provides a virtual target.
712 For example, blackdown\-jdk and sun\-jdk provide \fIvirtual/jdk\fR.  This
713 allows for packages to depend on \fIvirtual/jdk\fR rather than on blackdown
714 or sun specifically.
715
716 The \fBPROVIDE\fR variable has been deprecated. See
717 \fIhttp://www.gentoo.org/proj/en/glep/glep-0037.html\fR for details.
718
719 .TP
720 .B DOCS
721 Beginning with \fBEAPI 4\fR, an array or space\-delimited list of documentation
722 files for the default src_install function to install using dodoc. If
723 undefined, a reasonable default list is used. See the documentation for
724 src_install below.
725
726 .SS "QA Control Variables:"
727 .TP
728 .B Usage Notes
729 Several QA variables are provided which allow an ebuild to manipulate some
730 of the QA checks performed by portage.  Use of these variables in ebuilds
731 should be kept to an absolute minimum otherwise they defeat the purpose
732 of the QA checks, and their use is subject to agreement of the QA team.
733 They are primarily intended for use by ebuilds that install closed\-source
734 binary objects that cannot be altered.
735
736 Note that objects that violate these rules may fail on some architectures.
737 .TP
738 .B QA_PREBUILT
739 This should contain a list of file paths, relative to the image
740 directory, of files that are pre\-built binaries. Paths
741 listed here will be appended to each of the QA_* variables
742 listed below. The paths may contain fnmatch\-like patterns
743 which will be internally translated to regular expressions for
744 the QA_* variables that support regular expressions instead
745 of fnmatch patterns. The translation mechanism simply replaces
746 "*" with ".*".
747 .TP
748 .B QA_TEXTRELS
749 This variable can be set to a list of file paths, relative to the image
750 directory, of files that contain text relocations that cannot be eliminated.
751 The paths may contain fnmatch patterns.
752
753 This variable is intended to be used on closed\-source binary objects that
754 cannot be altered.
755 .TP
756 .B QA_EXECSTACK
757 This should contain a list of file paths, relative to the image directory, of
758 objects that require executable stack in order to run.
759 The paths may contain fnmatch patterns.
760
761 This variable is intended to be used on objects that truly need executable
762 stack (i.e. not those marked to need it which in fact do not).
763 .TP
764 .B QA_WX_LOAD
765 This should contain a list of file paths, relative to the image directory, of
766 files that contain writable and executable segments.  These are rare.
767 The paths may contain fnmatch patterns.
768 .TP
769 .B QA_FLAGS_IGNORED
770 This should contain a list of file paths, relative to the image directory, of
771 files that do not contain .GCC.command.line sections or contain .hash sections.
772 The paths may contain regular expressions with escape\-quoted special characters.
773
774 This variable is intended to be used on files of binary packages which ignore
775 CFLAGS, CXXFLAGS, FFLAGS, FCFLAGS, and LDFLAGS variables.
776 .TP
777 .B QA_MULTILIB_PATHS
778 This should contain a list of file paths, relative to the image directory, of
779 files that should be ignored for the multilib\-strict checks.
780 The paths may contain regular expressions with escape\-quoted special characters.
781 .TP
782 .B QA_PRESTRIPPED
783 This should contain a list of file paths, relative to the image directory, of
784 files that contain pre-stripped binaries. The paths may contain regular
785 expressions with escape\-quoted special characters.
786 .TP
787 .B QA_SONAME
788 This should contain a list of file paths, relative to the image directory, of
789 shared libraries that lack SONAMEs. The paths may contain regular expressions
790 with escape\-quoted special characters.
791 .TP
792 .B QA_SONAME_NO_SYMLINK
793 This should contain a list of file paths, relative to the image directory, of
794 shared libraries that have SONAMEs but should not have a corresponding SONAME
795 symlink in the same directory. The paths may contain regular expressions
796 with escape\-quoted special characters.
797 .TP
798 .B QA_AM_MAINTAINER_MODE
799 This should contain a list of lines containing automake missing \-\-run
800 commands. The lines may contain regular expressions with escape\-quoted
801 special characters.
802 .TP
803 .B QA_CONFIGURE_OPTIONS
804 This should contain a list of configure options which trigger warnings about
805 unrecognized options. The options may contain regular expressions with
806 escape\-quoted special characters.
807 .TP
808 .B QA_DT_NEEDED
809 This should contain a list of file paths, relative to the image directory, of
810 shared libraries that lack NEEDED entries. The paths may contain regular
811 expressions with escape\-quoted special characters.
812 .TP
813 .B QA_DESKTOP_FILE
814 This should contain a list of file paths, relative to the image directory, of
815 desktop files which should not be validated. The paths may contain regular
816 expressions with escape\-quoted special characters.
817
818 .SH "PORTAGE DECLARATIONS"
819 .TP
820 .B inherit
821 Inherit is portage's maintenance of extra classes of functions that are
822 external to ebuilds and provided as inheritable capabilities and data. They
823 define functions and set data types as drop\-in replacements, expanded, and
824 simplified routines for extremely common tasks to streamline the build
825 process. Call to inherit cannot depend on conditions which can vary in given
826 ebuild. Specification of the eclasses contains only their name and not the
827 \fI.eclass\fR extension. Also note that the inherit statement must come
828 before other variable declarations unless these variables are used in global
829 scope of eclasses.
830
831 .SH "PHASE FUNCTIONS"
832 .TP
833 .B pkg_pretend
834 Beginning with \fBEAPI 4\fR, this function can be defined in order to
835 check that miscellaneous requirements are met. It is called as early
836 as possible, before any attempt is made to satisfy dependencies. If the
837 function detects a problem then it should call eerror and die. The
838 environment (variables, functions, temporary directories, etc..) that
839 is used to execute pkg_pretend is not saved and therefore is not
840 available in phases that execute afterwards.
841 .TP
842 .B pkg_nofetch
843 This function will be executed when the files in \fBSRC_URI\fR
844 cannot be fetched for any reason. If you turn on \fIfetch\fR in
845 \fBRESTRICT\fR, this is useful for displaying information to the
846 user on *how* to obtain said files. All
847 you have to do is output a message and let the function return.  Do not
848 end the function with a call to \fBdie\fR.
849 .TP
850 .B pkg_setup
851 This function can be used if the package needs specific setup actions or
852 checks to be preformed before anything else.
853 .br
854 Initial working directory: $PORTAGE_TMPDIR
855 .TP
856 .B src_unpack
857 This function is used to unpack all the sources in \fIA\fR to \fIWORKDIR\fR.
858 If not defined in the \fIebuild script\fR it calls \fIunpack ${A}\fR. Any
859 patches and other pre configure/compile modifications should be done here.
860 .br
861 Initial working directory: $WORKDIR
862 .TP
863 .B src_prepare
864 All preparation of source code, such as application of patches, should be done
865 here. This function is supported beginning with \fBEAPI 2\fR.
866 .br
867 Initial working directory: $S
868 .TP
869 .B src_configure
870 All necessary steps for configuration should be done here. This function is
871 supported beginning with \fBEAPI 2\fR.
872 .br
873 Initial working directory: $S
874 .TP
875 .B src_compile
876 With less than \fBEAPI 2\fR, all necessary steps for both configuration and
877 compilation should be done here. Beginning with \fBEAPI 2\fR, only compilation
878 steps should be done here.
879 .br
880 Initial working directory: $S
881 .TP
882 .B src_test
883 Run all package specific test cases. The default is to run
884 \'emake check\' followed \'emake test\'. Prior to \fBEAPI 5\fR,
885 the default src_test implementation will automatically pass the
886 \-j1 option as the last argument to emake, and beginning with
887 \fBEAPI 5\fR it will allow the tests to run in parallel.
888 .br
889 Initial working directory: $S
890 .TP
891 .B src_install
892 Should contain everything required to install the package in the temporary
893 \fIinstall directory\fR.
894 .br
895 Initial working directory: $S
896
897 Beginning with \fBEAPI 4\fR, if src_install is undefined then the
898 following default implementation is used:
899
900 .nf
901 src_install() {
902     if [[ \-f Makefile || \-f GNUmakefile || \-f makefile ]] ; then
903         emake DESTDIR="${D}" install
904     fi
905
906     if ! declare -p DOCS &>/dev/null ; then
907         local d
908         for d in README* ChangeLog AUTHORS NEWS TODO CHANGES \\
909                 THANKS BUGS FAQ CREDITS CHANGELOG ; do
910             [[ \-s "${d}" ]] && dodoc "${d}"
911         done
912     elif [[ $(declare \-p DOCS) == "declare \-a "* ]] ; then
913         dodoc "${DOCS[@]}"
914     else
915         dodoc ${DOCS}
916     fi
917 }
918 .fi
919 .TP
920 .B pkg_preinst pkg_postinst
921 All modifications required on the live\-filesystem before and after the
922 package is merged should be placed here. Also commentary for the user
923 should be listed here as it will be displayed last.
924 .br
925 Initial working directory: $PWD
926 .TP
927 .B pkg_prerm pkg_postrm
928 Like the pkg_*inst functions but for unmerge.
929 .br
930 Initial working directory: $PWD
931 .TP
932 .B pkg_config
933 This function should contain optional basic configuration steps.
934 .br
935 Initial working directory: $PWD
936
937 .SH "HELPER FUNCTIONS"
938 .SS "Phases:"
939 .TP
940 .B default
941 Calls the default phase function implementation for the currently executing
942 phase. This function is supported beginning with \fBEAPI 2\fR.
943 .TP
944 .B default_*
945 Beginning with \fBEAPI 2\fR, the default pkg_nofetch and src_* phase
946 functions are accessible via a function having a name that begins with
947 default_ and ends with the respective phase function name. For example,
948 a call to a function with the name default_src_compile is equivalent to
949 a call to the default src_compile implementation.
950
951 .RS
952 .TS
953 l
954 _
955 l.
956 Default Phase Functions
957 default_pkg_nofetch
958 default_src_unpack
959 default_src_prepare
960 default_src_configure
961 default_src_compile
962 default_src_test
963 .TE
964 .RE
965
966 .SS "General:"
967 .TP
968 .B die\fR \fI[reason]
969 Causes the current emerge process to be aborted. The final display will
970 include \fIreason\fR.
971
972 Beginning with \fBEAPI 4\fR, all helpers automatically call \fBdie\fR
973 whenever some sort of error occurs. Helper calls may be prefixed with
974 the \fBnonfatal\fR helper in order to prevent errors from being fatal.
975 .TP
976 .B nonfatal\fR \fI<helper>
977 Execute \fIhelper\fR and \fIdo not\fR call die if it fails.
978 The \fBnonfatal\fR helper is available beginning with \fBEAPI 4\fR.
979 .TP
980 .B use\fR \fI<USE item>
981 If \fIUSE item\fR is in the \fBUSE\fR variable, the function will silently
982 return 0 (aka shell true).  If \fIUSE item\fR is not in the \fBUSE\fR
983 variable, the function will silently return 1 (aka shell false).  \fBusev\fR
984 is a verbose version of \fBuse\fR.
985 .RS
986 .TP
987 .I Example:
988 .nf
989 if use gnome ; then
990         guiconf="\-\-enable\-gui=gnome \-\-with\-x"
991 elif use gtk ; then
992         guiconf="\-\-enable\-gui=gtk \-\-with\-x"
993 elif use X ; then
994         guiconf="\-\-enable\-gui=athena \-\-with\-x"
995 else
996         # No gui version will be built
997         guiconf=""
998 fi
999 .fi
1000 .RE
1001 .TP
1002 .B usex\fR \fI<USE flag>\fR \fI[true output]\fR \fI[false output]\fR \fI[true suffix]\fR \fI[false suffix]
1003 If USE flag is set, echo [true output][true suffix] (defaults to
1004 "yes"), otherwise echo [false output][false suffix] (defaults to
1005 "no"). The usex helper is available beginning with \fBEAPI 5\fR.
1006 .TP
1007 .B use_with\fR \fI<USE item>\fR \fI[configure name]\fR \fI[configure opt]
1008 Useful for creating custom options to pass to a configure script. If \fIUSE
1009 item\fR is in the \fBUSE\fR variable and a \fIconfigure opt\fR is specified,
1010 then the string \fI\-\-with\-[configure name]=[configure opt]\fR will be echoed.
1011 If \fIconfigure opt\fR is not specified, then just \fI\-\-with\-[configure
1012 name]\fR will be echoed.  If \fIUSE item\fR is not in the \fBUSE\fR variable,
1013 then the string \fI\-\-without\-[configure name]\fR will be echoed. If
1014 \fIconfigure name\fR is not specified, then \fIUSE item\fR will be used in
1015 its place. Beginning with \fBEAPI 4\fR, an empty \fIconfigure opt\fR argument
1016 is recognized. In \fBEAPI 3\fR and earlier, an empty \fIconfigure opt\fR
1017 argument is treated as if it weren't provided.
1018 .RS
1019 .TP
1020 .I Examples:
1021 .nf
1022 USE="opengl"
1023 myconf=$(use_with opengl)
1024 (myconf now has the value "\-\-with\-opengl")
1025
1026 USE="jpeg"
1027 myconf=$(use_with jpeg libjpeg)
1028 (myconf now has the value "\-\-with\-libjpeg")
1029
1030 USE=""
1031 myconf=$(use_with jpeg libjpeg)
1032 (myconf now has the value "\-\-without\-libjpeg")
1033
1034 USE="sdl"
1035 myconf=$(use_with sdl SDL all\-plugins)
1036 (myconf now has the value "\-\-with\-SDL=all\-plugins")
1037 .fi
1038 .RE
1039 .TP
1040 .B use_enable\fR \fI<USE item>\fR \fI[configure name]\fR \fI[configure opt]
1041 Same as \fBuse_with\fR above, except that the configure options are
1042 \fI\-\-enable\-\fR instead of \fI\-\-with\-\fR and \fI\-\-disable\-\fR instead of
1043 \fI\-\-without\-\fR. Beginning with \fBEAPI 4\fR, an empty \fIconfigure opt\fR
1044 argument is recognized. In \fBEAPI 3\fR and earlier, an empty
1045 \fIconfigure opt\fR argument is treated as if it weren't provided.
1046 .TP
1047 .B hasv\fR \fI<item>\fR \fI<item list>
1048 If \fIitem\fR is in \fIitem list\fR, then \fIitem\fR is echoed and \fBhasv\fR
1049 returns 0.  Otherwise, nothing is echoed and 1 is returned. As indicated with
1050 use, there is a non\-echoing version \fBhas\fR. Please use \fBhas\fR in all
1051 places where output is to be disregarded. Never use the output for calculation.
1052 .br
1053 The \fIitem list\fR is delimited by the \fIIFS\fR variable.  This variable
1054 has a default value of ' ', or a space.  It is a \fBbash\fR(1) setting.
1055 .TP
1056 .B has_version\fR \fI[\-\-host\-root]\fR \fI<category/package\-version>
1057 Check to see if \fIcategory/package\-version\fR is installed on the system.
1058 The parameter accepts all values that are acceptable in the \fBDEPEND\fR
1059 variable.  The function returns 0 if \fIcategory/package\-version\fR is
1060 installed, 1 otherwise. Beginning with \fBEAPI 5\fR, the
1061 \-\-host\-root option may be used in order to cause the query
1062 to apply to the host root instead of ${ROOT}.
1063 .TP
1064 .B best_version\fR \fI[\-\-host\-root]\fR \fI<package name>
1065 This function will look up \fIpackage name\fR in the database of currently
1066 installed programs and echo the "best version" of the package that is
1067 currently installed. Beginning with \fBEAPI 5\fR, the
1068 \-\-host\-root option may be used in order to cause the query
1069 to apply to the host root instead of ${ROOT}.
1070
1071 Example:
1072 .nf
1073         VERINS="$(best_version net\-ftp/glftpd)"
1074         (VERINS now has the value "net\-ftp/glftpd\-1.27" if glftpd\-1.27 is installed)
1075 .fi
1076
1077 .SS "Hooks:"
1078 .TP
1079 .B register_die_hook\fR \fI[list of function names]
1080 Register one or more functions to call when the ebuild fails for any reason,
1081 including file collisions with other packages.
1082 .TP
1083 .B register_success_hook\fR \fI[list of function names]
1084 Register one or more functions to call when the ebuild builds and/or installs
1085 successfully.
1086
1087 .SS "Output:"
1088 .TP
1089 .B einfo\fR \fI"disposable message"
1090 Same as \fBelog\fR, but should be used when the message isn't important to the
1091 user (like progress or status messages during the build process).
1092 .TP
1093 .B elog\fR \fI"informative message"
1094 If you need to display a message that you wish the user to read and take
1095 notice of, then use \fBelog\fR.  It works just like \fBecho\fR(1), but
1096 adds a little more to the output so as to catch the user's eye. The message
1097 will also be logged by portage for later review.
1098 .TP
1099 .B ewarn\fR \fI"warning message"
1100 Same as \fBeinfo\fR, but should be used when showing a warning to the user.
1101 .TP
1102 .B eqawarn\fR \fI"QA warning message"
1103 Same as \fBeinfo\fR, but should be used when showing a QA warning to the user.
1104 .TP
1105 .B eerror\fR \fI"error message"
1106 Same as \fBeinfo\fR, but should be used when showing an error to the user.
1107 .TP
1108 .B ebegin\fR \fI"helpful message"
1109 Like \fBeinfo\fR, we output a \fIhelpful message\fR and then hint that the
1110 following operation may take some time to complete.  Once the task is
1111 finished, you need to call \fBeend\fR.
1112 .TP
1113 .B eend\fR \fI<status>\fR \fI["error message"]
1114 Followup the \fBebegin\fR message with an appropriate "OK" or "!!" (for
1115 errors) marker.  If \fIstatus\fR is non\-zero, then the additional \fIerror
1116 message\fR is displayed.
1117
1118 .SS "Unpack:"
1119 .TP
1120 .B unpack\fR \fI<source>\fR \fI[list of more sources]
1121 This function uncompresses and/or untars a list of sources into the current
1122 directory. The function will append \fIsource\fR to the \fBDISTDIR\fR variable.
1123
1124 .SS "Compile:"
1125 .TP
1126 .B econf\fR \fI[configure options]
1127 This is used as a replacement for configure.  Performs:
1128 .nf
1129 ${\fIECONF_SOURCE\fR:-.}/configure \\
1130         ${CBUILD:+\-\-build=${CBUILD}} \\
1131         \-\-datadir="${EPREFIX}"/usr/share \\
1132         \-\-host=${CHOST} \\
1133         \-\-infodir="${EPREFIX}"/usr/share/info \\
1134         \-\-localstatedir="${EPREFIX}"/var/lib \\
1135         \-\-prefix="${EPREFIX}"/usr \\
1136         \-\-mandir="${EPREFIX}"/usr/share/man \\
1137         \-\-sysconfdir="${EPREFIX}"/etc \\
1138         ${CTARGET:+\-\-target=${CTARGET}} \\
1139         \-\-disable\-dependency\-tracking \\
1140         \fI${EXTRA_ECONF}\fR \\
1141         \fIconfigure options\fR || die "econf failed"
1142 .fi
1143 Note that the \fIEXTRA_ECONF\fR is for users only, not for ebuild
1144 writers.  If you wish to pass more options to configure, just pass the
1145 extra arguments to \fBeconf\fR. Also note that \fBeconf\fR automatically
1146 calls \fBdie\fR if the configure script fails.
1147 Beginning with \fBEAPI 3\fR, \fBeconf\fR uses the \fB${EPREFIX}\fR
1148 variable which is disregarded for prior \fBEAPI\fR values.
1149 Beginning with \fBEAPI 4\fR, \fBeconf\fR adds
1150 \fI\-\-disable\-dependency\-tracking\fR to the arguments if the
1151 string \fIdisable\-dependency\-tracking\fR occurs in the output
1152 of \fIconfigure \-\-help\fR.
1153 Beginning with \fBEAPI 5\fR, \fBeconf\fR adds
1154 \fIdisable\-silent\-rules\fR to the arguments if the
1155 string \fIdisable\-silent\-rules\fR occurs in the output
1156 of \fIconfigure \-\-help\fR.
1157 .TP
1158 .B emake\fR \fI[make options]
1159 This is used as a replacement for make.  Performs 'make ${MAKEOPTS}
1160 \fImake options\fR' (as set in make.globals), default is MAKEOPTS="\-j2".
1161
1162 .B ***WARNING***
1163 .br
1164 if you are going to use \fBemake\fR, make sure your build is happy with
1165 parallel makes (make \-j2).  It should be tested thoroughly as parallel
1166 makes are notorious for failing _sometimes_ but not always.  If you determine
1167 that your package fails to build in parallel, and you are unable to resolve
1168 the issue, then you should run '\fBemake\fR \-j1' instead of 'make'.
1169
1170 .SS "Install:"
1171 .TP
1172 .B einstall\fR \fI[make options]
1173 This is used as a replacement for make install.  Performs:
1174 .nf
1175 make \\
1176         prefix=${ED}/usr \\
1177         datadir=${ED}/usr/share \\
1178         infodir=${ED}/usr/share/info \\
1179         localstatedir=${ED}/var/lib \\
1180         mandir=${ED}/usr/share/man \\
1181         sysconfdir=${ED}/etc \\
1182         \fI${EXTRA_EINSTALL}\fR \\
1183         \fImake options\fR \\
1184         install
1185 .fi
1186 Please do \fBnot\fR use this in place of 'emake install DESTDIR=${D}'.
1187 That is the preferred way of installing make\-based packages.  Also, do
1188 not utilize the \fIEXTRA_EINSTALL\fR variable since it is for users.
1189
1190 .PD 0
1191 .TP
1192 .B prepall
1193 .TP
1194 .B prepalldocs
1195 .TP
1196 .B prepallinfo
1197 .TP
1198 .B prepallman
1199 .TP
1200 .B prepallstrip
1201 .PD 1
1202 Useful for when a package installs into \fB${D}\fR via scripts
1203 (i.e. makefiles).  If you want to be sure that libraries are executable,
1204 aclocal files are installed into the right place, doc/info/man files are
1205 all compressed, and that executables are all stripped of debugging symbols,
1206 then use these suite of functions.
1207 .RS
1208 .PD 0
1209 .TP
1210 .B prepall:
1211 Runs \fBprepallman\fR, \fBprepallinfo\fR, \fBprepallstrip\fR, sets
1212 libraries +x, and then checks aclocal directories.  Please note this
1213 does \fI*not*\fR run \fBprepalldocs\fR.
1214 .TP
1215 .B prepalldocs:
1216 Compresses all doc files in ${ED}/usr/share/doc.
1217 .TP
1218 .B prepallinfo:
1219 Compresses all info files in ${ED}/usr/share/info.
1220 .TP
1221 .B prepallman:
1222 Compresses all man files in ${ED}/usr/share/man.
1223 .TP
1224 .B prepallstrip:
1225 Strips all executable files of debugging symboles.  This includes libraries.
1226 .RE
1227
1228 .TP
1229 .B prepinfo\fR \fI[dir]
1230 .TP
1231 .B prepman\fR \fI[dir]
1232 .TP
1233 .B prepstrip\fR \fI[dir]
1234 .PD 1
1235 Similar to the \fBprepall\fR functions, these are subtle in their differences.
1236 .RS
1237 .PD 0
1238 .TP
1239 .B prepinfo:
1240 If a \fIdir\fR is not specified, then \fBprepinfo\fR will assume the dir
1241 \fIusr\fR. \fBprepinfo\fR will then compress all the files in
1242 ${ED}/\fIdir\fR/info.
1243 .TP
1244 .B prepman:
1245 If a \fIdir\fR is not specified, then \fBprepman\fR will assume the dir
1246 \fIusr\fR. \fBprepman\fR will then compress all the files in
1247 ${ED}/\fIdir\fR/man/*/.
1248 .TP
1249 .B prepstrip:
1250 All the files found in ${ED}/\fIdir\fR will be stripped.  You may specify
1251 multiple directories.
1252 .RE
1253 .PD 1
1254 .TP
1255 .B docompress\fR \fI[\-x] <path> [list of more paths]
1256 .RS
1257 Beginning with \fBEAPI 4\fR, the \fBdocompress\fR helper is used to
1258 manage lists of files to be included or excluded from optional compression.
1259 If the first argument is \fB\-x\fR, add each of its subsequent arguments to
1260 the exclusion list. Otherwise, add each argument to the inclusion list.
1261 The inclusion list initially contains \fI/usr/share/doc\fR,
1262 \fI/usr/share/info\fR, and \fI/usr/share/man\fR. The exclusion list
1263 initially contains \fI/usr/share/doc/${PF}/html\fR.
1264
1265 The optional compression shall be carried out after \fBsrc_install\fR
1266 has completed, and before the execution of any subsequent phase
1267 function. For each item in the inclusion list, pretend it has the
1268 value of the \fBD\fR variable prepended, then:
1269
1270 .RS
1271 If it is a directory, act as if every file or directory immediately
1272 under this directory were in the inclusion list.
1273
1274 If the item is a file, it may be compressed unless it has been
1275 excluded as described below.
1276
1277 If the item does not exist, it is ignored.
1278 .RE
1279
1280 Whether an item is to be excluded is determined as follows: For each
1281 item in the exclusion list, pretend it has the value of the \fBD\fR
1282 variable prepended, then:
1283
1284 .RS
1285 If it is a directory, act as if every file or directory immediately
1286 under this directory were in the exclusion list.
1287
1288 If the item is a file, it shall not be compressed.
1289
1290 If the item does not exist, it is ignored.
1291 .RE
1292 .RE
1293 .TP
1294 .B dosed\fR \fI"s:orig:change:g" <filename>
1295 Beginning with \fBEAPI 4\fR, the \fBdosed\fR helper no longer exists. Ebuilds
1296 should call \fBsed(1)\fR directly (and assume that it is GNU sed).
1297
1298 Performs sed in place on \fIfilename\fR inside ${ED}. If no expression is
1299 given then \fI"s:${D}::g"\fR is used as the default expression.  Note
1300 that this expression does \fBNOT\fR use the offset prefix.
1301 .br
1302 .BR 'dosed\ "s:/usr/local:/usr:g"\ /usr/bin/some\-script'
1303 runs sed on ${ED}/usr/bin/some\-script
1304 .TP
1305 .B dodir\fR \fI<path> [more paths]
1306 Creates directories inside of ${ED}.
1307 .br
1308 .BR 'dodir\ /usr/lib/apache'
1309 creates ${ED}/usr/lib/apache.  Note that the do* functions will run
1310 \fBdodir\fR for you.
1311 .TP
1312 .B diropts\fR \fI[options for install(1)]
1313 Can be used to define options for the install function used in
1314 \fBdodir\fR.  The default is \fI\-m0755\fR.
1315 .TP
1316 .B into\fR \fI<path>
1317 Sets the root (\fIDESTTREE\fR) for other functions like \fBdobin\fR,
1318 \fBdosbin\fR, \fBdoman\fR, \fBdoinfo\fR, \fBdolib\fR.
1319 .br
1320 The default root is /usr.
1321 .TP
1322 .B keepdir\fR \fI<path> [more paths]
1323 Tells portage to leave directories behind even if they're empty.  Functions
1324 the same as \fBdodir\fR.
1325 .TP
1326 .B dobin\fR \fI<binary> [list of more binaries]
1327 Installs a \fIbinary\fR or a list of binaries into \fIDESTTREE\fR/bin.
1328 Creates all necessary dirs.
1329 .TP
1330 .B dosbin\fR \fI<binary> [list of more binaries]
1331 Installs a \fIbinary\fR or a list of binaries into \fIDESTTREE\fR/sbin.
1332 Creates all necessary dirs.
1333 .TP
1334 .B doinitd\fR \fI<init.d script> [list of more init.d scripts]
1335 Install Gentoo \fIinit.d scripts\fR.  They will be installed into the
1336 correct location for Gentoo init.d scripts (/etc/init.d/).  Creates all
1337 necessary dirs.
1338 .TP
1339 .B doconfd\fR \fI<conf.d file> [list of more conf.d file]
1340 Install Gentoo \fIconf.d files\fR.  They will be installed into the
1341 correct location for Gentoo conf.d files (/etc/conf.d/).  Creates all
1342 necessary dirs.
1343 .TP
1344 .B doenvd\fR \fI<env.d entry> [list of more env.d entries]
1345 Install Gentoo \fIenv.d entries\fR.  They will be installed into the
1346 correct location for Gentoo env.d entries (/etc/env.d/).  Creates all
1347 necessary dirs.
1348
1349 .PD 0
1350 .TP
1351 .B dolib\fR \fI<library>\fR \fI[list of more libraries]
1352 .TP
1353 .B dolib.a\fR \fI<library>\fR \fI[list of more libraries]
1354 .TP
1355 .B dolib.so\fR \fI<library>\fR \fI[list of more libraries]
1356 .PD 1
1357 Installs a library or a list of libraries into \fIDESTTREE\fR/lib.
1358 Creates all necessary dirs.
1359 .TP
1360 .B libopts\fR \fI[options for install(1)]
1361 Can be used to define options for the install function used in
1362 the \fBdolib\fR functions.  The default is \fI\-m0644\fR.
1363 .TP
1364 .B doman\fR \fI[\-i18n=<locale>]\fR \fI<man\-page> [list of more man\-pages]
1365 Installs manual\-pages into /usr/share/man/man[0\-9n] depending on the
1366 manual file ending.  The files are compressed if they are not already.  You
1367 can specify locale\-specific manpages with the \fI\-i18n\fR option.  Then the
1368 man\-page will be installed into /usr/share/man/\fI<locale>\fR/man[0\-9n].
1369 Beginning with \fBEAPI 2\fR, a locale\-specific manpage which contains a locale
1370 in the file name will be installed in /usr/share/man/\fI<locale>\fR/man[0\-9n],
1371 with the locale portion of the file name removed, and the \fI\-i18n\fR option
1372 has no effect. For example, with \fBEAPI 2\fR, a manpage named
1373 foo.\fI<locale>\fR.1 will be installed as
1374 /usr/share/man/\fI<locale>\fR/man1/foo.1. Beginning with \fBEAPI 4\fR,
1375 the \fI\-i18n\fR option takes precedence over the locale suffix of the
1376 file name.
1377
1378 .PD 0
1379 .TP
1380 .B dohard\fR \fI<filename> <linkname>
1381 Beginning with \fBEAPI 4\fR, the \fBdohard\fR helper no longer exists. Ebuilds
1382 should call \fBln(1)\fR directly.
1383 .TP
1384 .B dosym\fR \fI<filename> <linkname>
1385 .PD 1
1386 Performs the ln command to create a symlink.
1387 .TP
1388 .B doheader\fR \fI[\-r] <file> [list of more files]
1389 Installs the given header files into /usr/include/, by default
1390 with file mode \fI0644\fR (this can be overridden with the
1391 \fBinsopts\fR function). Setting \-r sets recursive. The
1392 \fBdoheader\fR helper is available beginning with \fBEAPI 5\fR.
1393 .TP
1394 .B dohtml\fR \fI [\-a filetypes] [\-r] [\-x list\-of\-dirs\-to\-ignore] [list\-of\-files\-and\-dirs]
1395 Installs the files in the list of files (space\-separated list) into
1396 /usr/share/doc/${PF}/html provided the file ends in .htm, .html, .css, .js, .gif, .jpeg, .jpg, or .png.
1397 Setting \fI\-a\fR limits what types of files will be included,
1398 \fI\-A\fR appends to the default list, setting \fI\-x\fR sets which dirs to
1399 exclude (CVS excluded by default), \fI\-p\fR sets a document prefix, \fI\-r\fR sets recursive.
1400 .TP
1401 .B doinfo\fR \fI<info\-file> [list of more info\-files]
1402 Installs info\-pages into \fIDESTDIR\fR/info.  Files are automatically
1403 gzipped.  Creates all necessary dirs.
1404 .TP
1405 .B domo\fR \fI<locale\-file> [list of more locale\-files]
1406 Installs locale\-files into \fIDESTDIR\fR/usr/share/locale/[LANG]
1407 depending on local\-file's ending.  Creates all necessary dirs.
1408
1409 .PD 0
1410 .TP
1411 .B fowners\fR \fI<permissions> <file> [files]
1412 .TP
1413 .B fperms\fR \fI<permissions> <file> [files]
1414 .PD 1
1415 Performs chown (\fBfowners\fR) or chmod (\fBfperms\fR), applying
1416 \fIpermissions\fR to \fIfiles\fR.
1417 .TP
1418 .B insinto\fR \fI[path]
1419 Sets the destination path for the \fBdoins\fR function.
1420 .br
1421 The default path is /.
1422 .TP
1423 .B insopts\fR \fI[options for install(1)]
1424 Can be used to define options for the install function used in
1425 \fBdoins\fR.  The default is \fI\-m0644\fR.
1426 .TP
1427 .B doins\fR \fI[\-r] <file> [list of more files]
1428 Installs files into the path controlled by \fBinsinto\fR.  This function
1429 uses \fBinstall\fR(1).  Creates all necessary dirs.
1430 Setting \-r sets recursive. Beginning with \fBEAPI 4\fR, both
1431 \fBdoins\fR and \fBnewins\fR preserve symlinks. In \fBEAPI 3\fR and
1432 earlier, symlinks are dereferenced rather than preserved.
1433 .TP
1434 .B exeinto\fR \fI[path]
1435 Sets the destination path for the \fBdoexe\fR function.
1436 .br
1437 The default path is /.
1438 .TP
1439 .B exeopts\fR \fI[options for install(1)]
1440 Can be used to define options for the install function used in \fBdoexe\fR.
1441 The default is \fI\-m0755\fR.
1442 .TP
1443 .B doexe\fR \fI<executable> [list of more executables]
1444 Installs executables into the path controlled by \fBexeinto\fR.  This function
1445 uses \fBinstall\fR(1).  Creates all necessary dirs.
1446 .TP
1447 .B docinto\fR \fI[path]
1448 Sets the subdir used by \fBdodoc\fR and \fBdohtml\fR
1449 when installing into the document tree
1450 (based in /usr/share/doc/${PF}/).  Default is no subdir, or just "".
1451 .TP
1452 .B dodoc\fR \fI[-r] <document> [list of more documents]
1453 Installs a document or a list of documents into /usr/share/doc/${PF}/\fI<docinto path>\fR.
1454 Documents are marked for compression.  Creates all necessary dirs.
1455 Beginning with \fBEAPI 4\fR, there is support for recursion, enabled by the
1456 new \fI\-r\fR option.
1457
1458 .PD 0
1459 .TP
1460 .B newbin\fR \fI<old file> <new filename>
1461 .TP
1462 .B newsbin\fR \fI<old file> <new filename>
1463 .TP
1464 .B newinitd\fR \fI<old file> <new filename>
1465 .TP
1466 .B newconfd\fR \fI<old file> <new filename>
1467 .TP
1468 .B newenvd\fR \fI<old file> <new filename>
1469 .TP
1470 .B newlib.so\fR \fI<old file> <new filename>
1471 .TP
1472 .B newlib.a\fR \fI<old file> <new filename>
1473 .TP
1474 .B newman\fR \fI<old file> <new filename>
1475 .TP
1476 .B newinfo\fR \fI<old file> <new filename>
1477 .TP
1478 .B newins\fR \fI<old file> <new filename>
1479 .TP
1480 .B newexe\fR \fI<old file> <new filename>
1481 .TP
1482 .B newdoc\fR \fI<old file> <new filename>
1483 .PD 1
1484 All these functions act like the do* functions, but they only work with one
1485 file and the file is installed as \fI[new filename]\fR.
1486 Beginning with \fBEAPI 5\fR, standard input is read when the
1487 first parameter is \- (a hyphen).
1488
1489 .SH "EXAMPLES"
1490 .DS
1491 .nf
1492 # Copyright 1999\-2013 Gentoo Foundation
1493 # Distributed under the terms of the GNU General Public License v2
1494 # $Header: $
1495
1496 EAPI="5"
1497
1498 inherit some_eclass another_eclass
1499
1500 DESCRIPTION="Super\-useful stream editor (sed)"
1501 HOMEPAGE="http://www.gnu.org/software/sed/sed.html"
1502 SRC_URI="ftp://alpha.gnu.org/pub/gnu/${PN}/${P}.tar.gz"
1503
1504 LICENSE="GPL\-2"
1505 SLOT="0"
1506 KEYWORDS="~x86"
1507 IUSE=""
1508
1509 RDEPEND=""
1510 DEPEND="nls? ( sys-devel/gettext )"
1511
1512 src_configure() {
1513         econf \\
1514                 \-\-bindir="${EPREFIX}"/bin
1515 }
1516
1517 src_install() {
1518         emake DESTDIR="${D}" install
1519         dodoc NEWS README* THANKS AUTHORS BUGS ChangeLog
1520 }
1521 .fi
1522 .DE
1523
1524 .SH "FILES"
1525 .TP
1526 The \fI/usr/lib/portage/bin/ebuild.sh\fR script.
1527 .TP
1528 The helper apps in \fI/usr/lib/portage/bin\fR.
1529 .TP
1530 .B /etc/portage/make.conf
1531 Contains variables for the build\-process and overwrites those in make.defaults.
1532 .TP
1533 .B /usr/share/portage/config/make.globals
1534 Contains the default variables for the build\-process, you should edit
1535 \fI/etc/portage/make.conf\fR instead.
1536 .TP
1537 .B /etc/portage/color.map
1538 Contains variables customizing colors.
1539
1540 .SH "SEE ALSO"
1541 .BR ebuild (1),
1542 .BR make.conf (5),
1543 .BR color.map (5)
1544
1545 .SH "REPORTING BUGS"
1546 Please report bugs via http://bugs.gentoo.org/
1547
1548 .SH "AUTHORS"
1549 .nf
1550 Achim Gottinger <achim@gentoo.org>
1551 Mark Guertin <gerk@gentoo.org>
1552 Nicholas Jones <carpaski@gentoo.org>
1553 Mike Frysinger <vapier@gentoo.org>
1554 Arfrever Frehtes Taifersar Arahesis <Arfrever.FTA@gmail.com>
1555 Fabian Groffen <grobian@gentoo.org>
1556 .fi