/[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.5 - (hide annotations) (download) (as text)
Tue Dec 16 18:08:56 2003 UTC (10 years, 9 months ago) by swift
Branch: MAIN
Changes since 1.4: +3 -3 lines
File MIME type: application/xml
Fix typos and language issues, tx to lodger (karma911 - pacbell.net)

1 swift 1.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 swift 1.5 <!-- $Header: /home/cvsroot/gentoo/xml/htdocs/doc/en/handbook/hb-working-use.xml,v 1.4 2003/11/29 15:39:34 swift Exp $ -->
5 swift 1.1
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 swift 1.2 <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 swift 1.5 with KDE-support if those packages work flawlessly without?
26 swift 1.2 </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 swift 1.5 managment system, to make useful decisions.
33 swift 1.2 </p>
34    
35 swift 1.1 </body>
36     </subsection>
37     <subsection>
38     <title>Definition of a USE-flag</title>
39     <body>
40    
41 swift 1.2 <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 swift 1.3 Portage will know that you want support for the chosen keyword. Of course
45 swift 1.2 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 swift 1.1 </body>
64     </subsection>
65     <subsection>
66     <title>What USE-flags exist?</title>
67     <body>
68    
69 swift 1.2 <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 swift 1.1 </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 swift 1.2 <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 swift 1.1 </body>
156     </subsection>
157     <subsection>
158     <title>Declare temporary USE-flags</title>
159     <body>
160    
161 swift 1.2 <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 swift 1.1 </body>
182     </subsection>
183     <subsection>
184     <title>Inheriting USE-flags</title>
185     <body>
186    
187 swift 1.2 <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 swift 1.3 Of course there is a certain precendence on what setting has priority over the
210 swift 1.2 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 swift 1.4
231     <p>
232     To view the final <c>USE</c> setting as seen by Portage, run <c>emerge info</c>.
233     This will list all relevant variables (including the <c>USE</c> variable) with
234     the content used by Portage.
235     </p>
236    
237     <pre caption="Running emerge info">
238     # <i>emerge info</i>
239     </pre>
240 swift 1.2
241 swift 1.1 </body>
242     </subsection>
243     </section>
244     <section>
245     <title>Package specific USE-flags</title>
246     <subsection>
247 swift 1.2 <title>Viewing available USE-flags</title>
248 swift 1.1 <body>
249 swift 1.2
250     <p>
251     In the next chapter on <uri link="?part=2&amp;chap=2">Portage and Software</uri>
252     we will explain how to manage your installed software and how to work with
253     <c>emerge</c>. However, we will give you a primer on <c>emerge</c> by showing
254     you how to view what USE-flags a package uses.
255     </p>
256    
257     <p>
258     Let us take the example of <c>mozilla</c>: what USE-flags does it listen to? To
259     find out, we use <c>emerge</c> with the <c>--pretend</c> (don't really do
260     anything) and <c>--verbose</c> (give more output) options:
261     </p>
262    
263     <pre caption="Viewing the used USE-flags">
264     # <i>emerge --pretend --verbose mozilla</i>
265     These are the packages that I would merge, in order:
266    
267     Calculating dependencies ...done!
268     [ebuild N ] net-www/mozilla-1.5-r1 +java +crypt -ipv6 -gtk2 +ssl +ldap
269     +gnome -debug +mozcalendar -mozaccess -mozxmlterm -moznoirc -moznomail
270     -moznocompose -moznoxft
271     </pre>
272    
273     <p>
274     <c>emerge</c> isn't the only tool for this job. In fact, we have a tool
275     dedicated to package information called <c>etcat</c> which resides in the
276     <c>gentoolkit</c> package. First, install <c>gentoolkit</c>:
277     </p>
278    
279     <pre caption="Installing gentoolkit">
280     # <i>emerge --usepkg gentoolkit</i>
281     </pre>
282    
283     <p>
284     Now run <c>etcat</c> with the <c>uses</c> argument to view the USE-flags of a
285     certain package. For instance, for the <c>gnumeric</c> package:
286     </p>
287    
288     <pre caption="Using etcat to view used USE-flags">
289     # <i>etcat uses gnumeric</i>
290     [ Colour Code : <i>set</i> <comment>unset</comment> ]
291     [ Legend : (U) Col 1 - Current USE flags ]
292     [ : (I) Col 2 - Installed With USE flags ]
293    
294     U I [ Found these USE variables in : app-office/gnumeric-1.2.0 ]
295     - - <comment>libgda</comment> : Adds GNU Data Access (CORBA wrapper) support for gnumeric
296     - - <comment>gnomedb</comment> : unknown
297     + + <i>python</i> : Adds support/bindings for the Python language
298     + + <i>bonobo</i> : Adds support for gnome-base/bonobo (Gnome CORBA interfaces)
299     </pre>
300 swift 1.1
301     </body>
302     </subsection>
303     </section>
304     </sections>

  ViewVC Help
Powered by ViewVC 1.1.20