/[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.32 - (show annotations) (download) (as text)
Tue Oct 17 02:28:45 2006 UTC (7 years, 10 months ago) by nightmorph
Branch: MAIN
Changes since 1.31: +8 -8 lines
File MIME type: application/xml
Fixed non-portage ccache paragraph, related to bug 151083, and per vapier and lisa's advice on IRC. PATH in 00basic is a big no-no.

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

  ViewVC Help
Powered by ViewVC 1.1.20