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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.2 - (show annotations) (download) (as text)
Tue Nov 25 17:34:47 2003 UTC (10 years, 8 months ago) by swift
Branch: MAIN
Changes since 1.1: +238 -2 lines
File MIME type: application/xml
I ve done some writing :)

1 <!-- The content of this document is licensed under the CC-BY-SA license -->
2 <!-- See http://creativecommons.org/licenses/by-sa/1.0 -->
3
4 <!-- $Header: /home/cvsroot/gentoo/xml/htdocs/doc/en/handbook/hb-working-use.xml,v 1.1 2003/11/20 10:52:35 swift Exp $ -->
5
6 <sections>
7 <section>
8 <title>What are USE-flags?</title>
9 <subsection>
10 <title>The ideas behind USE-flags</title>
11 <body>
12
13 <p>
14 When you are installing Gentoo (or any other distribution, or even operating
15 system for that matter) you make choices depending on the environment you are
16 working with. A setup for a server differs from a setup for a workstation.
17 A gaming workstation differs from a 3D rendering workstation.
18 </p>
19
20 <p>
21 This is not only true for choosing what packages you want to install, but also
22 what features a certain package should support. If you don't need OpenGL, why
23 would you bother installing OpenGL and build OpenGL support in most of your
24 packages? If you don't want to use KDE, why would you bother compiling packages
25 with KDE-support if those packages work flawless without?
26 </p>
27
28 <p>
29 To help users in deciding what to install/activate and what not, we wanted the
30 user to specify his environment in an easy way. This forces the user into
31 deciding what he really wants and eases the process for Portage, our package
32 managment system, to make usefull decisions.
33 </p>
34
35 </body>
36 </subsection>
37 <subsection>
38 <title>Definition of a USE-flag</title>
39 <body>
40
41 <p>
42 Enter the USE-flags. Such a flag is a keyword that embodies support and
43 dependency-information for a certain concept. If you define a certain USE-flag,
44 Portage will know that you want support for the chosen keyword. Ofcourse
45 this also alters the dependency information for a package.
46 </p>
47
48 <p>
49 Lets take a look at a specific example: the <c>kde</c> keyword. If you do not
50 have 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
52 packages 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
54 the <c>kde</c> keyword, then those packages <e>will</e> be compiled with KDE
55 support, and the KDE libraries will be installed as dependency.
56 </p>
57
58 <p>
59 By correctly defining the keywords you will receive a system tailored
60 specifically to your needs.
61 </p>
62
63 </body>
64 </subsection>
65 <subsection>
66 <title>What USE-flags exist?</title>
67 <body>
68
69 <p>
70 There 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>
85 A list of available global USE-flags can be found <uri
86 link="/dyn/use-index.xml">online</uri> or locally in
87 <path>/usr/portage/profiles/use.desc</path>. A short (<e>very</e> incomplete)
88 snippet:
89 </p>
90
91 <pre caption="A short snippet of available USE-flags">
92 gtk - Adds support for x11-libs/gtk+ (The GIMP Toolkit)
93 gtk2 - Use gtk+-2.0.0 over gtk+-1.2 in cases where a program supports both.
94 gtkhtml - Adds support for gnome-extra/gtkhtml
95 guile - Adds support for dev-util/guile (interpreter for Scheme)
96 icc - Use the Intel C++ Compiler if the package supports it
97 icc-pgo - Enable PGO data generation or use when use icc.
98 imap - Adds support for IMAP
99 </pre>
100
101 </body>
102 </subsection>
103 </section>
104 <section>
105 <title>Using USE-flags</title>
106 <subsection>
107 <title>Declare permanent USE-flags</title>
108 <body>
109
110 <p>
111 In the hope you are convinced of the importance of USE-flags we will now inform
112 you how to declare USE-flags.
113 </p>
114
115 <p>
116 As previously mentioned, all USE-flags are declared inside the <c>USE</c>
117 variable. To make it easy for users to search and pick USE-flags, we already
118 provide a <e>default</e> USE setting. This setting is a collection of USE-flags
119 we think are commonly used by the Gentoo users. This default setting is declared
120 in the <path>/etc/make.profile/make.defaults</path> file. Let us take a look at
121 this default setting:
122 </p>
123
124 <pre caption="/etc/make.profile/make.defaults USE variable">
125 USE="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>
132 As 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
134 the <c>USE</c> variable to your needs: changes in this file will be undone when
135 you update Portage!
136 </p>
137
138 <p>
139 To 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
141 in <path>/etc/make.conf</path>. In this variable you add the extra USE-flags you
142 require, or remove the USE-flags you don't want. This latter is done by
143 prefixing the keyword with the minus-sign ("-").
144 </p>
145
146 <p>
147 For instance, to remove support for KDE and QT but add support for ldap, the
148 following <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">
152 USE="-kde -qt ldap"
153 </pre>
154
155 </body>
156 </subsection>
157 <subsection>
158 <title>Declare temporary USE-flags</title>
159 <body>
160
161 <p>
162 Sometimes 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
164 declare the USE-variable as environment variable.
165 </p>
166
167 <p>
168 As an example we will temporarily remove java from the USE-setting
169 during the installation of mozilla.
170 </p>
171
172 <note>
173 The <c>emerge</c> command will be discussed more thoroughly in <uri
174 link="?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
181 </body>
182 </subsection>
183 <subsection>
184 <title>Inheriting USE-flags</title>
185 <body>
186
187 <p>
188 Some packages don't only listen to USE-flags, but also provide USE-flags. When
189 you install such a package, the USE-flag they provide is added to your USE
190 setting. 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">
195 gnome gnome-base/gnome
196 gtk x11-libs/gtk+
197 qt x11-libs/qt
198 kde kde-base/kdebase
199 motif x11-libs/openmotif
200 </pre>
201
202 </body>
203 </subsection>
204 <subsection>
205 <title>Precendence</title>
206 <body>
207
208 <p>
209 Ofcourse there is a certain precendence on what setting has priority over the
210 USE 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
212 by 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>
230
231 </body>
232 </subsection>
233 </section>
234 <section>
235 <title>Package specific USE-flags</title>
236 <subsection>
237 <title>Viewing available USE-flags</title>
238 <body>
239
240 <p>
241 In the next chapter on <uri link="?part=2&amp;chap=2">Portage and Software</uri>
242 we 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
244 you how to view what USE-flags a package uses.
245 </p>
246
247 <p>
248 Let us take the example of <c>mozilla</c>: what USE-flags does it listen to? To
249 find out, we use <c>emerge</c> with the <c>--pretend</c> (don't really do
250 anything) 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>
255 These are the packages that I would merge, in order:
256
257 Calculating 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
265 dedicated 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>
274 Now run <c>etcat</c> with the <c>uses</c> argument to view the USE-flags of a
275 certain 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>
290
291 </body>
292 </subsection>
293 </section>
294 </sections>

  ViewVC Help
Powered by ViewVC 1.1.20