/[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.2
1<!-- The content of this document is licensed under the CC-BY-SA license --> 1<!-- The content of this document is licensed under the CC-BY-SA license -->
2<!-- See http://creativecommons.org/licenses/by-sa/1.0 --> 2<!-- See http://creativecommons.org/licenses/by-sa/1.0 -->
3 3
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 $ --> 4<!-- $Header: /var/cvsroot/gentoo/xml/htdocs/doc/en/handbook/hb-working-use.xml,v 1.2 2003/11/25 17:34:47 swift Exp $ -->
5 5
6<sections> 6<sections>
7<section> 7<section>
8<title>What are USE-flags?</title> 8<title>What are USE-flags?</title>
9<subsection> 9<subsection>
10<title>The ideas behind USE-flags</title> 10<title>The ideas behind USE-flags</title>
11<body> 11<body>
12 12
13<p>
14When you are installing Gentoo (or any other distribution, or even operating
15system for that matter) you make choices depending on the environment you are
16working with. A setup for a server differs from a setup for a workstation.
17A gaming workstation differs from a 3D rendering workstation.
18</p>
19
20<p>
21This is not only true for choosing what packages you want to install, but also
22what features a certain package should support. If you don't need OpenGL, why
23would you bother installing OpenGL and build OpenGL support in most of your
24packages? If you don't want to use KDE, why would you bother compiling packages
25with KDE-support if those packages work flawless without?
26</p>
27
28<p>
29To help users in deciding what to install/activate and what not, we wanted the
30user to specify his environment in an easy way. This forces the user into
31deciding what he really wants and eases the process for Portage, our package
32managment system, to make usefull decisions.
33</p>
34
13</body> 35</body>
14</subsection> 36</subsection>
15<subsection> 37<subsection>
16<title>Definition of a USE-flag</title> 38<title>Definition of a USE-flag</title>
17<body> 39<body>
18 40
41<p>
42Enter the USE-flags. Such a flag is a keyword that embodies support and
43dependency-information for a certain concept. If you define a certain USE-flag,
44Portage will know that you want support for the chosen keyword. Ofcourse
45this also alters the dependency information for a package.
46</p>
47
48<p>
49Lets take a look at a specific example: the <c>kde</c> keyword. If you do not
50have this keyword in your <c>USE</c> variable, all packages that have
51<e>optional</e> KDE support will be compiled <e>without</e> KDE support. All
52packages that have an <e>optional</e> KDE dependency will be installed
53<e>without</e> installing the KDE libraries (as dependency). If you have defined
54the <c>kde</c> keyword, then those packages <e>will</e> be compiled with KDE
55support, and the KDE libraries will be installed as dependency.
56</p>
57
58<p>
59By correctly defining the keywords you will receive a system tailored
60specifically to your needs.
61</p>
62
19</body> 63</body>
20</subsection> 64</subsection>
21<subsection> 65<subsection>
22<title>What USE-flags exist?</title> 66<title>What USE-flags exist?</title>
23<body> 67<body>
68
69<p>
70There are two types of USE-flags: <e>global</e> and <e>local</e> USE-flags.
71</p>
72
73<ul>
74 <li>
75 A <e>global</e> USE-flag is used by several packages, system-wide. This is
76 what most people see as USE-flags.
77 </li>
78 <li>
79 A <e>local</e> USE-fag is used by a single package to make package-specific
80 decisions.
81 </li>
82</ul>
83
84<p>
85A list of available global USE-flags can be found <uri
86link="/dyn/use-index.xml">online</uri> or locally in
87<path>/usr/portage/profiles/use.desc</path>. A short (<e>very</e> incomplete)
88snippet:
89</p>
90
91<pre caption="A short snippet of available USE-flags">
92gtk - Adds support for x11-libs/gtk+ (The GIMP Toolkit)
93gtk2 - Use gtk+-2.0.0 over gtk+-1.2 in cases where a program supports both.
94gtkhtml - Adds support for gnome-extra/gtkhtml
95guile - Adds support for dev-util/guile (interpreter for Scheme)
96icc - Use the Intel C++ Compiler if the package supports it
97icc-pgo - Enable PGO data generation or use when use icc.
98imap - Adds support for IMAP
99</pre>
24 100
25</body> 101</body>
26</subsection> 102</subsection>
27</section> 103</section>
28<section> 104<section>
29<title>Using USE-flags</title> 105<title>Using USE-flags</title>
30<subsection> 106<subsection>
31<title>Declare permanent USE-flags</title> 107<title>Declare permanent USE-flags</title>
32<body> 108<body>
33 109
110<p>
111In the hope you are convinced of the importance of USE-flags we will now inform
112you how to declare USE-flags.
113</p>
114
115<p>
116As previously mentioned, all USE-flags are declared inside the <c>USE</c>
117variable. To make it easy for users to search and pick USE-flags, we already
118provide a <e>default</e> USE setting. This setting is a collection of USE-flags
119we think are commonly used by the Gentoo users. This default setting is declared
120in the <path>/etc/make.profile/make.defaults</path> file. Let us take a look at
121this default setting:
122</p>
123
124<pre caption="/etc/make.profile/make.defaults USE variable">
125USE="x86 oss apm arts avi berkdb crypt cups encode foomaticdb gdbm gif gpm gtk
126 imlib jpeg kde gnome libg++ libwww mad mikmod motif mpeg ncurses nls
127 oggvorbis opengl pam pdflib png python qt quicktime readline sdl slang
128 spell ssl svga tcpd truetype X xml2 xmms xv zlib"
129</pre>
130
131<p>
132As you can see, this variable already contains quite a lot of keywords. Do
133<b>not</b> alter the <path>/etc/make.profile/make.defaults</path> file to tailor
134the <c>USE</c> variable to your needs: changes in this file will be undone when
135you update Portage!
136</p>
137
138<p>
139To change this default setting, you need to add or remove keywords to the
140<c>USE</c> variable. This is done globally by defining the <c>USE</c> variable
141in <path>/etc/make.conf</path>. In this variable you add the extra USE-flags you
142require, or remove the USE-flags you don't want. This latter is done by
143prefixing the keyword with the minus-sign ("-").
144</p>
145
146<p>
147For instance, to remove support for KDE and QT but add support for ldap, the
148following <c>USE</c> can be defined in <path>/etc/make.conf</path>:
149</p>
150
151<pre caption="An example USE setting in /etc/make.conf">
152USE="-kde -qt ldap"
153</pre>
154
34</body> 155</body>
35</subsection> 156</subsection>
36<subsection> 157<subsection>
37<title>Declare temporary USE-flags</title> 158<title>Declare temporary USE-flags</title>
38<body> 159<body>
39 160
161<p>
162Sometimes you want to set a certain USE-setting only once. Instead of editing
163<path>/etc/make.conf</path> twice (to do and undo the USE-changes) you can just
164declare the USE-variable as environment variable.
165</p>
166
167<p>
168As an example we will temporarily remove java from the USE-setting
169during the installation of mozilla.
170</p>
171
172<note>
173The <c>emerge</c> command will be discussed more thoroughly in <uri
174link="?part=2&amp;chap=2">Portage and Software</uri>.
175</note>
176
177<pre caption="Using USE as evironment variable">
178# <i>USE="-java" emerge mozilla</i>
179</pre>
180
40</body> 181</body>
41</subsection> 182</subsection>
42<subsection> 183<subsection>
43<title>Inheriting USE-flags</title> 184<title>Inheriting USE-flags</title>
44<body> 185<body>
186
187<p>
188Some packages don't only listen to USE-flags, but also provide USE-flags. When
189you install such a package, the USE-flag they provide is added to your USE
190setting. To view the list of packages that provide a USE-flag, check
191<path>/etc/make.profile/use.defaults</path>:
192</p>
193
194<pre caption="A snippet from /etc/make.profile/use.defaults">
195gnome gnome-base/gnome
196gtk x11-libs/gtk+
197qt x11-libs/qt
198kde kde-base/kdebase
199motif x11-libs/openmotif
200</pre>
201
202</body>
203</subsection>
204<subsection>
205<title>Precendence</title>
206<body>
207
208<p>
209Ofcourse there is a certain precendence on what setting has priority over the
210USE setting. You don't want to declare <c>USE="-java"</c> only to see that
211<c>java</c> is declared anyway. The precedence for the USE setting is, ordered
212by priority (first has lowest priority):
213</p>
214
215<ol>
216 <li>
217 Default USE setting declared in <path>/etc/make.profile/make.defaults</path>
218 </li>
219 <li>
220 Inherited USE setting if a package from
221 <path>/etc/make.profile/use.defaults</path> is installed
222 </li>
223 <li>
224 User-defined USE setting in <path>/etc/make.conf</path>
225 </li>
226 <li>
227 User-defined USE setting as environment variable
228 </li>
229</ol>
45 230
46</body> 231</body>
47</subsection> 232</subsection>
48</section> 233</section>
49<section> 234<section>
50<title>Package specific USE-flags</title> 235<title>Package specific USE-flags</title>
51<subsection> 236<subsection>
52<title>Viewing used USE-flags</title> 237<title>Viewing available USE-flags</title>
53<body> 238<body>
239
240<p>
241In the next chapter on <uri link="?part=2&amp;chap=2">Portage and Software</uri>
242we will explain how to manage your installed software and how to work with
243<c>emerge</c>. However, we will give you a primer on <c>emerge</c> by showing
244you how to view what USE-flags a package uses.
245</p>
246
247<p>
248Let us take the example of <c>mozilla</c>: what USE-flags does it listen to? To
249find out, we use <c>emerge</c> with the <c>--pretend</c> (don't really do
250anything) and <c>--verbose</c> (give more output) options:
251</p>
252
253<pre caption="Viewing the used USE-flags">
254# <i>emerge --pretend --verbose mozilla</i>
255These are the packages that I would merge, in order:
256
257Calculating dependencies ...done!
258[ebuild N ] net-www/mozilla-1.5-r1 +java +crypt -ipv6 -gtk2 +ssl +ldap
259+gnome -debug +mozcalendar -mozaccess -mozxmlterm -moznoirc -moznomail
260-moznocompose -moznoxft
261</pre>
262
263<p>
264<c>emerge</c> isn't the only tool for this job. In fact, we have a tool
265dedicated to package information called <c>etcat</c> which resides in the
266<c>gentoolkit</c> package. First, install <c>gentoolkit</c>:
267</p>
268
269<pre caption="Installing gentoolkit">
270# <i>emerge --usepkg gentoolkit</i>
271</pre>
272
273<p>
274Now run <c>etcat</c> with the <c>uses</c> argument to view the USE-flags of a
275certain package. For instance, for the <c>gnumeric</c> package:
276</p>
277
278<pre caption="Using etcat to view used USE-flags">
279# <i>etcat uses gnumeric</i>
280[ Colour Code : <i>set</i> <comment>unset</comment> ]
281[ Legend : (U) Col 1 - Current USE flags ]
282[ : (I) Col 2 - Installed With USE flags ]
283
284 U I [ Found these USE variables in : app-office/gnumeric-1.2.0 ]
285 - - <comment>libgda</comment> : Adds GNU Data Access (CORBA wrapper) support for gnumeric
286 - - <comment>gnomedb</comment> : unknown
287 + + <i>python</i> : Adds support/bindings for the Python language
288 + + <i>bonobo</i> : Adds support for gnome-base/bonobo (Gnome CORBA interfaces)
289</pre>
54 290
55</body> 291</body>
56</subsection> 292</subsection>
57</section> 293</section>
58</sections> 294</sections>

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

  ViewVC Help
Powered by ViewVC 1.1.20