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