/[gentoo]/xml/htdocs/doc/en/handbook/hb-working-use.xml
Gentoo

Diff of /xml/htdocs/doc/en/handbook/hb-working-use.xml

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1.1 Revision 1.19
1<?xml version='1.0' encoding='UTF-8'?>
2<!DOCTYPE sections SYSTEM "/dtd/book.dtd">
3
1<!-- The content of this document is licensed under the CC-BY-SA license --> 4<!-- The content of this document is licensed under the CC-BY-SA license -->
2<!-- See http://creativecommons.org/licenses/by-sa/1.0 --> 5<!-- See http://creativecommons.org/licenses/by-sa/1.0 -->
3 6
4<!-- $Header: /var/cvsroot/gentoo/xml/htdocs/doc/en/handbook/hb-working-use.xml,v 1.1 2003/11/20 10:52:35 swift Exp $ --> 7<!-- $Header: /var/cvsroot/gentoo/xml/htdocs/doc/en/handbook/hb-working-use.xml,v 1.19 2004/09/24 14:00:33 swift Exp $ -->
5 8
6<sections> 9<sections>
7<section> 10<section>
8<title>What are USE-flags?</title> 11<title>What are USE-flags?</title>
9<subsection> 12<subsection>
10<title>The ideas behind USE-flags</title> 13<title>The ideas behind USE-flags</title>
11<body> 14<body>
12 15
16<p>
17When you are installing Gentoo (or any other distribution, or even operating
18system for that matter) you make choices depending on the environment you are
19working with. A setup for a server differs from a setup for a workstation.
20A gaming workstation differs from a 3D rendering workstation.
21</p>
22
23<p>
24This is not only true for choosing what packages you want to install, but also
25what features a certain package should support. If you don't need OpenGL, why
26would you bother installing OpenGL and build OpenGL support in most of your
27packages? If you don't want to use KDE, why would you bother compiling packages
28with KDE-support if those packages work flawlessly without?
29</p>
30
31<p>
32To help users in deciding what to install/activate and what not, we wanted the
33user to specify his/her environment in an easy way. This forces the user into
34deciding what they really want and eases the process for Portage, our package
35managment system, to make useful decisions.
36</p>
37
13</body> 38</body>
14</subsection> 39</subsection>
15<subsection> 40<subsection>
16<title>Definition of a USE-flag</title> 41<title>Definition of a USE-flag</title>
17<body> 42<body>
18 43
44<p>
45Enter the USE-flags. Such a flag is a keyword that embodies support and
46dependency-information for a certain concept. If you define a certain USE-flag,
47Portage will know that you want support for the chosen keyword. Of course
48this also alters the dependency information for a package.
49</p>
50
51<p>
52Let us take a look at a specific example: the <c>kde</c> keyword. If you do not
53have this keyword in your <c>USE</c> variable, all packages that have
54<e>optional</e> KDE support will be compiled <e>without</e> KDE support. All
55packages that have an <e>optional</e> KDE dependency will be installed
56<e>without</e> installing the KDE libraries (as dependency). If you have defined
57the <c>kde</c> keyword, then those packages <e>will</e> be compiled with KDE
58support, and the KDE libraries will be installed as dependency.
59</p>
60
61<p>
62By correctly defining the keywords you will receive a system tailored
63specifically to your needs.
64</p>
65
19</body> 66</body>
20</subsection> 67</subsection>
21<subsection> 68<subsection>
22<title>What USE-flags exist?</title> 69<title>What USE-flags exist?</title>
23<body> 70<body>
71
72<p>
73There are two types of USE-flags: <e>global</e> and <e>local</e> USE-flags.
74</p>
75
76<ul>
77 <li>
78 A <e>global</e> USE-flag is used by several packages, system-wide. This is
79 what most people see as USE-flags.
80 </li>
81 <li>
82 A <e>local</e> USE-flag is used by a single package to make package-specific
83 decisions.
84 </li>
85</ul>
86
87<p>
88A list of available global USE-flags can be found <uri
89link="/dyn/use-index.xml">online</uri> or locally in
90<path>/usr/portage/profiles/use.desc</path>. A short (<e>very</e> incomplete)
91snippet:
92</p>
93
94<pre caption="A short snippet of available USE-flags">
95gtk - Adds support for x11-libs/gtk+ (The GIMP Toolkit)
96gtk2 - Use gtk+-2.0.0 over gtk+-1.2 in cases where a program supports both.
97gtkhtml - Adds support for gnome-extra/gtkhtml
98guile - Adds support for dev-util/guile (interpreter for Scheme)
99icc - Use the Intel C++ Compiler if the package supports it
100icc-pgo - Enable PGO data generation or use when use icc.
101imap - Adds support for IMAP
102</pre>
103
104<p>
105A list of available local USE-flags can be found locally in
106<path>/usr/portage/profiles/use.local.desc</path>.
107</p>
24 108
25</body> 109</body>
26</subsection> 110</subsection>
27</section> 111</section>
28<section> 112<section>
29<title>Using USE-flags</title> 113<title>Using USE-flags</title>
30<subsection> 114<subsection>
31<title>Declare permanent USE-flags</title> 115<title>Declare permanent USE-flags</title>
32<body> 116<body>
33 117
118<p>
119In the hope you are convinced of the importance of USE-flags we will now inform
120you how to declare USE-flags.
121</p>
122
123<p>
124As previously mentioned, all USE-flags are declared inside the <c>USE</c>
125variable. To make it easy for users to search and pick USE-flags, we already
126provide a <e>default</e> USE setting. This setting is a collection of USE-flags
127we think are commonly used by the Gentoo users. This default setting is declared
128in the <path>/etc/make.profile/make.defaults</path> file. Let us take a look at
129this default setting:
130</p>
131
132<pre caption="/etc/make.profile/make.defaults USE variable on an x86 system">
133USE="x86 oss apm arts avi berkdb crypt cups encode foomaticdb gdbm gif gpm
134 gtk gtk2 imlib jpeg kde gnome libg++ libwww mad mikmod motif mpeg ncurses
135 nls oggvorbis opengl pam pdflib png python qt quicktime readline sdl
136 slang spell ssl svga tcpd truetype X xml2 xmms xv zlib"
137</pre>
138
139<p>
140As you can see, this variable already contains quite a lot of keywords. Do
141<b>not</b> alter the <path>/etc/make.profile/make.defaults</path> file to tailor
142the <c>USE</c> variable to your needs: changes in this file will be undone when
143you update Portage!
144</p>
145
146<p>
147To change this default setting, you need to add or remove keywords to the
148<c>USE</c> variable. This is done globally by defining the <c>USE</c> variable
149in <path>/etc/make.conf</path>. In this variable you add the extra USE-flags you
150require, or remove the USE-flags you don't want. This latter is done by
151prefixing the keyword with the minus-sign ("-").
152</p>
153
154<p>
155For instance, to remove support for KDE and QT but add support for ldap, the
156following <c>USE</c> can be defined in <path>/etc/make.conf</path>:
157</p>
158
159<pre caption="An example USE setting in /etc/make.conf">
160USE="-kde -qt ldap"
161</pre>
162
163</body>
164</subsection>
165<subsection>
166<title>Declaring USE flags for individual packages</title>
167<body>
168
169<p>
170Sometimes you want to declare a certain USE flag for one (or a couple) of
171applications but not system-wide. To accomplish this, you will need to create
172the <path>/etc/portage</path> directory (if it doesn't exist yet) and edit
173<path>/etc/portage/package.use</path>.
174</p>
175
176<p>
177For instance, if you don't want <c>berkdb</c> support globally but you do want
178it for <c>mysql</c>, you would add:
179</p>
180
181<pre caption="/etc/portage/package.use example">
182dev-db/mysql berkdb
183</pre>
184
185<p>
186You can of course also explicitly <e>disable</e> USE flags for a certain
187application. For instance, if you don't want <c>java</c> support in PHP:
188</p>
189
190<pre caption="/etc/portage/package.use 2nd example">
191dev-php/php -java
192</pre>
193
34</body> 194</body>
35</subsection> 195</subsection>
36<subsection> 196<subsection>
37<title>Declare temporary USE-flags</title> 197<title>Declare temporary USE-flags</title>
38<body> 198<body>
39 199
200<p>
201Sometimes you want to set a certain USE-setting only once. Instead of editing
202<path>/etc/make.conf</path> twice (to do and undo the USE-changes) you can just
203declare the USE-variable as environment variable. Remember that, when you
204re-emerge or update this application (either explicitly or as part of a system
205update) your changes will be lost!
206</p>
207
208<p>
209As an example we will temporarily remove java from the USE-setting
210during the installation of mozilla.
211</p>
212
213<note>
214The <c>emerge</c> command will be discussed more thoroughly in <uri
215link="?part=2&amp;chap=2">Portage and Software</uri>.
216</note>
217
218<pre caption="Using USE as environment variable">
219# <i>USE="-java" emerge mozilla</i>
220</pre>
221
40</body> 222</body>
41</subsection> 223</subsection>
42<subsection> 224<subsection>
43<title>Inheriting USE-flags</title> 225<title>Inheriting USE-flags</title>
44<body> 226<body>
227
228<p>
229Some packages don't only listen to USE-flags, but also provide USE-flags. When
230you install such a package, the USE-flag they provide is added to your USE
231setting. To view the list of packages that provide a USE-flag, check
232<path>/etc/make.profile/use.defaults</path>:
233</p>
234
235<pre caption="A snippet from /etc/make.profile/use.defaults">
236gnome gnome-base/gnome
237gtk x11-libs/gtk+
238qt x11-libs/qt
239kde kde-base/kdebase
240motif x11-libs/openmotif
241</pre>
242
243</body>
244</subsection>
245<subsection>
246<title>Precedence</title>
247<body>
248
249<p>
250Of course there is a certain precedence on what setting has priority over the
251USE setting. You don't want to declare <c>USE="-java"</c> only to see that
252<c>java</c> is declared anyway. The precedence for the USE setting is, ordered
253by priority (first has lowest priority):
254</p>
255
256<ol>
257 <li>
258 Default USE setting declared in <path>/etc/make.profile/make.defaults</path>
259 </li>
260 <li>
261 Inherited USE setting if a package from
262 <path>/etc/make.profile/use.defaults</path> is installed
263 </li>
264 <li>
265 User-defined USE setting in <path>/etc/make.conf</path>
266 </li>
267 <li>
268 User-defined USE setting in <path>/etc/portage/package.use</path>
269 </li>
270 <li>
271 User-defined USE setting as environment variable
272 </li>
273</ol>
274
275<p>
276To view the final <c>USE</c> setting as seen by Portage, run <c>emerge info</c>.
277This will list all relevant variables (including the <c>USE</c> variable) with
278the content used by Portage.
279</p>
280
281<pre caption="Running emerge info">
282# <i>emerge info</i>
283</pre>
284
285</body>
286</subsection>
287<subsection>
288<title>Adapting your Entire System to New USE Flags</title>
289<body>
290
291<p>
292If you have altered your USE flags and you wish to update your entire system to
293use the new USE flags, you can try following the next steps to accomplish this.
294Note however that these steps will take a long time to finish and that work is
295on the way to adjust Portage to handle this behaviour quicker and automatically.
296</p>
297
298<p>
299First of all, rebuild your entire system using the new USE flags:
300</p>
301
302<pre caption="Rebuilding your entire system">
303# <i>emerge --emptytree world</i>
304</pre>
305
306<p>
307Next, run Portage' depclean to remove the conditional dependencies that
308were emerged on your "old" system but that have been obsoleted by the new USE
309flags.
310</p>
311
312<warn>
313Running <c>emerge depclean</c> is a dangerous operation and should be handled
314with care. Double-check the provided list of "obsoleted" packages to make sure
315it doesn't remove packages you need. In the following example we add the
316<c>-p</c> switch to have depclean only list the packages without removing them.
317</warn>
318
319<pre caption="Removing obsoleted packages">
320# <i>emerge -p depclean</i>
321</pre>
322
323<p>
324When depclean has finished, your system is using the new USE flag settings.
325</p>
45 326
46</body> 327</body>
47</subsection> 328</subsection>
48</section> 329</section>
49<section> 330<section>
50<title>Package specific USE-flags</title> 331<title>Package specific USE-flags</title>
51<subsection> 332<subsection>
52<title>Viewing used USE-flags</title> 333<title>Viewing available USE-flags</title>
53<body> 334<body>
335
336<p>
337In the next chapter on <uri link="?part=2&amp;chap=2">Portage and Software</uri>
338we will explain how to manage your installed software and how to work with
339<c>emerge</c>. However, we will give you a primer on <c>emerge</c> by showing
340you how to view what USE-flags a package uses.
341</p>
342
343<p>
344Let us take the example of <c>mozilla</c>: what USE-flags does it listen to? To
345find out, we use <c>emerge</c> with the <c>--pretend</c> (don't really do
346anything) and <c>--verbose</c> (give more output) options:
347</p>
348
349<pre caption="Viewing the used USE-flags">
350# <i>emerge --pretend --verbose mozilla</i>
351These are the packages that I would merge, in order:
352
353Calculating dependencies ...done!
354[ebuild N ] net-www/mozilla-1.5-r1 +java +crypt -ipv6 -gtk2 +ssl +ldap
355+gnome -debug +mozcalendar -mozaccess -mozxmlterm -moznoirc -moznomail
356-moznocompose -moznoxft
357</pre>
358
359<p>
360<c>emerge</c> isn't the only tool for this job. In fact, we have a tool
361dedicated to package information called <c>etcat</c> which resides in the
362<c>gentoolkit</c> package. First, install <c>gentoolkit</c>:
363</p>
364
365<pre caption="Installing gentoolkit">
366# <i>emerge --usepkg gentoolkit</i>
367</pre>
368
369<p>
370Now run <c>etcat</c> with the <c>uses</c> argument to view the USE-flags of a
371certain package. For instance, for the <c>gnumeric</c> package:
372</p>
373
374<pre caption="Using etcat to view used USE-flags">
375# <i>etcat uses gnumeric</i>
376[ Colour Code : <i>set</i> <comment>unset</comment> ]
377[ Legend : (U) Col 1 - Current USE flags ]
378[ : (I) Col 2 - Installed With USE flags ]
379
380 U I [ Found these USE variables in : app-office/gnumeric-1.2.0 ]
381 - - <comment>libgda</comment> : Adds GNU Data Access (CORBA wrapper) support for gnumeric
382 - - <comment>gnomedb</comment> : unknown
383 + + <i>python</i> : Adds support/bindings for the Python language
384 + + <i>bonobo</i> : Adds support for gnome-base/bonobo (Gnome CORBA interfaces)
385</pre>
54 386
55</body> 387</body>
56</subsection> 388</subsection>
57</section> 389</section>
58</sections> 390</sections>

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.19

  ViewVC Help
Powered by ViewVC 1.1.20