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

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

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.34 - (hide annotations) (download) (as text)
Fri Nov 3 22:03:06 2006 UTC (8 years, 1 month ago) by nightmorph
Branch: MAIN
Changes since 1.33: +31 -3 lines
File MIME type: application/xml
Updated handbook for Portage 2.1, bug 144128. thanks to antarus, genone, and zmedico for reviewing

1 swift 1.10 <?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 swift 1.29 <!-- See http://creativecommons.org/licenses/by-sa/2.5 -->
6 swift 1.1
7 nightmorph 1.34 <!-- $Header: /var/cvsroot/gentoo/xml/htdocs/doc/en/handbook/hb-working-features.xml,v 1.33 2006/10/28 09:17:55 neysx Exp $ -->
8 swift 1.1
9     <sections>
10 swift 1.23
11 neysx 1.33 <abstract>
12     Discover the features Portage has, such as support for distributed compiling,
13     ccache and more.
14     </abstract>
15    
16 nightmorph 1.34 <version>1.30</version>
17     <date>2006-11-03</date>
18 swift 1.23
19 swift 1.1 <section>
20 swift 1.19 <title>Portage Features</title>
21     <body>
22    
23     <p>
24     Portage has several additional features that makes your Gentoo experience even
25     better. Many of these features rely on certain software tools that improve
26     performance, reliability, security, ...
27     </p>
28    
29     <p>
30     To enable or disable certain Portage features you need to edit
31 swift 1.28 <path>/etc/make.conf</path>'s <c>FEATURES</c> variable which contains the
32     various feature keywords, separated by white space. In several cases you
33 swift 1.19 will also need to install the additional tool on which the feature relies.
34     </p>
35    
36     <p>
37     Not all features that Portage supports are listed here. For a full overview,
38 swift 1.21 please consult the <path>make.conf</path> man page:
39 swift 1.19 </p>
40    
41 swift 1.21 <pre caption="Consulting the make.conf man page">
42 swift 1.19 $ <i>man make.conf</i>
43     </pre>
44    
45     <p>
46 cam 1.27 To find out what FEATURES are default set, run <c>emerge --info</c> and search
47     for the FEATURES variable or grep it out:
48 swift 1.19 </p>
49    
50     <pre caption="Finding out the FEATURES that are already set">
51 cam 1.27 $ <i>emerge --info | grep FEATURES</i>
52 swift 1.19 </pre>
53    
54     </body>
55     </section>
56     <section>
57     <title>Distributed Compiling</title>
58 swift 1.1 <subsection>
59 swift 1.19 <title>Using distcc</title>
60 swift 1.1 <body>
61    
62 swift 1.2 <p>
63 swift 1.19 <c>distcc</c> is a program to distribute compilations across several, not
64 swift 1.2 necessarily identical, machines on a network. The <c>distcc</c> client sends all
65 swift 1.19 necessary information to the available distcc servers (running <c>distccd</c>)
66     so they can compile pieces of source code for the client. The net result is a
67 swift 1.2 faster compilation time.
68     </p>
69    
70     <p>
71 swift 1.19 You can find more information about <c>distcc</c> (and how to have it work
72     with Gentoo) in our <uri link="/doc/en/distcc.xml">Gentoo Distcc
73     Documentation</uri>.
74 swift 1.2 </p>
75    
76 swift 1.1 </body>
77     </subsection>
78     <subsection>
79 swift 1.19 <title>Installing distcc</title>
80 swift 1.1 <body>
81    
82 swift 1.2 <p>
83     Distcc ships with a graphical monitor to monitor tasks that your computer is
84 swift 1.19 sending away for compilation. If you use Gnome then put 'gnome' in your USE
85     variable. However, if you don't use Gnome and would still like to have the
86     monitor then you should put 'gtk' in your USE variable.
87 swift 1.2 </p>
88    
89 swift 1.19 <pre caption="Installing distcc">
90 swift 1.2 # <i>emerge distcc</i>
91     </pre>
92    
93 swift 1.1 </body>
94     </subsection>
95     <subsection>
96     <title>Activating Portage Support</title>
97     <body>
98    
99 swift 1.2 <p>
100 swift 1.19 Add <c>distcc</c> to the FEATURES variable inside <path>/etc/make.conf</path>.
101     Next, edit the MAKEOPTS variable to your liking. A known guideline is to fill in
102     "-jX" with X the number of CPUs that run <c>distccd</c> (including the current
103     host) plus one, but you might have better results with other numbers.
104 swift 1.2 </p>
105    
106     <p>
107 swift 1.19 Now run <c>distcc-config</c> and enter the list of available distcc servers. For
108     a simple example we assume that the available DistCC servers are 192.168.1.102
109     (the current host), 192.168.1.103 and 192.168.1.104 (two "remote" hosts):
110 swift 1.2 </p>
111    
112 swift 1.19 <pre caption="Configuring distcc to use three available distcc servers">
113 swift 1.3 # <i>distcc-config --set-hosts "192.168.1.102 192.168.1.103 192.168.1.104"</i>
114     </pre>
115    
116     <p>
117 swift 1.19 Don't forget to run the <c>distccd</c> daemon as well:
118 swift 1.3 </p>
119    
120 swift 1.19 <pre caption="Starting the distccd daemons">
121     # <i>rc-update add distccd default</i>
122 swift 1.3 # <i>/etc/init.d/distccd start</i>
123     </pre>
124    
125 swift 1.1 </body>
126     </subsection>
127     </section>
128     <section>
129 swift 1.19 <title>Caching Compilation</title>
130 swift 1.1 <subsection>
131 swift 1.19 <title>About ccache</title>
132 swift 1.1 <body>
133    
134 swift 1.4 <p>
135 swift 1.19 <c>ccache</c> is a fast compiler cache. When you compile a program, it will
136     cache intermediate results so that, whenever you recompile the same program, the
137     compilation time is greatly reduced. In common compilations this can result in 5
138     to 10 times faster compilation times.
139 swift 1.4 </p>
140    
141     <p>
142 swift 1.19 If you are interested in the ins and outs of ccache, please visit the
143 swift 1.4 <uri link="http://ccache.samba.org">ccache homepage</uri>.
144     </p>
145    
146 swift 1.1 </body>
147     </subsection>
148     <subsection>
149 swift 1.4 <title>Installing ccache</title>
150 swift 1.1 <body>
151    
152 swift 1.4 <p>
153 swift 1.19 To install <c>ccache</c>, run <c>emerge ccache</c>:
154 swift 1.4 </p>
155    
156     <pre caption="Installing ccache">
157     # <i>emerge ccache</i>
158     </pre>
159    
160 swift 1.1 </body>
161     </subsection>
162     <subsection>
163 swift 1.19 <title>Activating Portage Support</title>
164 swift 1.1 <body>
165 swift 1.4
166     <p>
167 swift 1.19 Open <path>/etc/make.conf</path> and add <c>ccache</c> to the FEATURES variable.
168     Next, add a new variable called CCACHE_SIZE and set it to "2G":
169 swift 1.4 </p>
170    
171     <pre caption="Editing CCACHE_SIZE in /etc/make.conf">
172     CCACHE_SIZE="2G"
173     </pre>
174    
175     <p>
176 swift 1.30 To check if ccache functions, ask ccache to provide you with its statistics.
177     Because Portage uses a different ccache home directory, you need to set the
178     <c>CCACHE_DIR</c> variable as well:
179 swift 1.4 </p>
180    
181     <pre caption="Viewing ccache statistics">
182 swift 1.30 # <i>CCACHE_DIR="/var/tmp/ccache" ccache -s</i>
183 swift 1.4 </pre>
184 swift 1.1
185 swift 1.30 <p>
186     The <path>/var/tmp/ccache</path> location is Portage' default ccache home
187     directory; if you want to alter this setting you can set the <c>CCACHE_DIR</c>
188     variable in <path>/etc/make.conf</path>.
189     </p>
190    
191     <p>
192     However, if you would run <c>ccache</c>, it would use the default location of
193     <path>${HOME}/.ccache</path>, which is why you needed to set the
194     <c>CCACHE_DIR</c> variable when asking for the (Portage) ccache statistics.
195     </p>
196    
197 swift 1.1 </body>
198     </subsection>
199 swift 1.12 <subsection>
200 swift 1.19 <title>Using ccache for non-Portage C Compiling</title>
201 swift 1.12 <body>
202    
203     <p>
204     If you would like to use ccache for non-Portage compilations, add
205 nightmorph 1.32 <path>/usr/lib/ccache/bin</path> to the beginning of your PATH variable (before
206     <path>/usr/bin</path>). This can be accomplished by editing
207     <path>.bash_profile</path> in your user's home directory. Using
208     <path>.bash_profile</path> is one way to define PATH variables.
209 swift 1.12 </p>
210    
211 nightmorph 1.32 <pre caption="Editing .bash_profile">
212 swift 1.29 PATH="<i>/usr/lib/ccache/bin</i>:/opt/bin"
213 swift 1.12 </pre>
214    
215     </body>
216     </subsection>
217 swift 1.1 </section>
218     <section>
219 swift 1.19 <title>Binary Package Support</title>
220 swift 1.1 <subsection>
221 swift 1.19 <title>Creating Prebuilt Packages</title>
222 swift 1.1 <body>
223    
224 swift 1.2 <p>
225 swift 1.19 Portage supports the installation of prebuilt packages. Even though Gentoo does
226     not provide prebuilt packages by itself (except for the GRP snapshots) Portage
227     can be made fully aware of prebuilt packages.
228 swift 1.2 </p>
229    
230     <p>
231 swift 1.19 To create a prebuilt package you can use <c>quickpkg</c> if the package is
232     already installed on your system, or <c>emerge</c> with the <c>--buildpkg</c> or
233     <c>--buildpkgonly</c> options.
234 swift 1.2 </p>
235    
236     <p>
237 swift 1.19 If you want Portage to create prebuilt packages of every single package you
238     install, add <c>buildpkg</c> to the FEATURES variable.
239 swift 1.2 </p>
240    
241     <p>
242 swift 1.19 More extended support for creating prebuilt package sets can be obtained with
243     <c>catalyst</c>. For more information on catalyst please read the <uri
244 swift 1.31 link="/proj/en/releng/catalyst/2.x/reference.xml">Catalyst Reference
245     Manual</uri> and <uri link="/proj/en/releng/catalyst/faq.xml">Catalyst
246     Frequently Asked Questions</uri>.
247 swift 1.2 </p>
248 swift 1.6
249 swift 1.5 </body>
250     </subsection>
251     <subsection>
252 swift 1.19 <title>Installing Prebuilt Packages</title>
253 swift 1.5 <body>
254    
255     <p>
256 swift 1.19 Although Gentoo doesn't provide one, you can create a central repository where
257     you store prebuilt packages. If you want to use this repository, you need to
258     make Portage aware of it by having the PORTAGE_BINHOST variable point to
259     it. For instance, if the prebuilt packages are on ftp://buildhost/gentoo:
260 swift 1.5 </p>
261    
262 swift 1.19 <pre caption="Setting PORTAGE_BINHOST in /etc/make.conf">
263     PORTAGE_BINHOST="ftp://buildhost/gentoo"
264 swift 1.5 </pre>
265    
266     <p>
267 swift 1.19 When you want to install a prebuilt package, add the <c>--getbinpkg</c> option
268     to the emerge command alongside of the <c>--usepkg</c> option. The former tells
269     emerge to download the prebuilt package from the previously defined server
270     while the latter asks emerge to try to install the prebuilt package first before
271     fetching the sources and compiling it.
272 swift 1.5 </p>
273    
274 swift 1.7 <p>
275 swift 1.19 For instance, to install <c>gnumeric</c> with prebuilt packages:
276 swift 1.7 </p>
277    
278 swift 1.19 <pre caption="Installing the gnumeric prebuilt package">
279     # <i>emerge --usepkg --getbinpkg gnumeric</i>
280 swift 1.7 </pre>
281    
282 swift 1.5 <p>
283 swift 1.19 More information about emerge's prebuilt package options can be found in the
284 swift 1.21 emerge man page:
285 swift 1.5 </p>
286    
287 swift 1.21 <pre caption="Reading the emerge man page">
288 swift 1.19 $ <i>man emerge</i>
289 swift 1.2 </pre>
290 swift 1.1
291     </body>
292     </subsection>
293     </section>
294 nightmorph 1.34 <section>
295     <title>Fetching Files</title>
296     <subsection>
297     <title>Parallel fetch</title>
298     <body>
299    
300     <p>
301     When you are emerging a series of packages, Portage can fetch the source files
302     for the next package in the list even while it is compiling another package,
303     thus shortening compile times. To make use of this capability, add
304     "parallel-fetch" to your FEATURES.
305     </p>
306    
307     </body>
308     </subsection>
309     <subsection>
310     <title>Userfetch</title>
311     <body>
312    
313     <p>
314     When Portage is run as root, FEATURES="userfetch" will allow Portage to drop
315     root privileges while fetching package sources. This is a small security
316     improvement.
317     </p>
318    
319     </body>
320     </subsection>
321     </section>
322 swift 1.1 </sections>

  ViewVC Help
Powered by ViewVC 1.1.20