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