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