/[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.21 - (hide annotations) (download) (as text)
Thu Oct 21 10:31:20 2004 UTC (9 years, 10 months ago) by swift
Branch: MAIN
Changes since 1.20: +18 -25 lines
File MIME type: application/xml
#65107 - Added Portage-specific part to the Gentoo Handbook now that .51 is official; major version bump to 3.0

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

  ViewVC Help
Powered by ViewVC 1.1.20