/[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.18 - (show annotations) (download) (as text)
Sun Sep 19 21:55:58 2004 UTC (10 years, 3 months ago) by vapier
Branch: MAIN
Changes since 1.17: +5 -5 lines
File MIME type: application/xml
you dont edit files in /etc/env.d #64518

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/1.0 -->
6
7 <!-- $Header: /var/cvsroot/gentoo/xml/htdocs/doc/en/handbook/hb-working-features.xml,v 1.17 2004/09/09 11:27:14 swift Exp $ -->
8
9 <sections>
10 <section>
11 <title>DistCC</title>
12 <subsection>
13 <title>What is DistCC?</title>
14 <body>
15
16 <p>
17 <c>distcc</c> is a program to distribute compilations across several, not
18 necessarily identical, machines on a network. The <c>distcc</c> client sends all
19 necessary information to the available DistCC servers (running <c>distccd</c>)
20 so they can compile pieces of source code for the client. The net result is a
21 faster compilation time.
22 </p>
23
24 <p>
25 You can find more elaborate information about <c>distcc</c> (and information on
26 how to have it work with Gentoo) in our <uri link="/doc/en/distcc.xml">Gentoo
27 Distcc Documentation</uri>.
28 </p>
29
30 </body>
31 </subsection>
32 <subsection>
33 <title>Installing DistCC</title>
34 <body>
35
36 <p>
37 Distcc ships with a graphical monitor to monitor tasks that your computer is
38 sending away for compilation. If you use Gnome then put 'gnome' in your
39 <c>USE</c> setting. However, if you don't use Gnome and would still like to have
40 the monitor then you should put 'gtk' in your <c>USE</c> setting.
41 </p>
42
43 <p>
44 Installing distcc is, as is with all software available through Gentoo's
45 Portage, extremely easy:
46 </p>
47
48 <pre caption="Installing Distcc">
49 # <i>emerge distcc</i>
50 </pre>
51
52 </body>
53 </subsection>
54 <subsection>
55 <title>Activating Portage Support</title>
56 <body>
57
58 <p>
59 Well, if installation is easy, the rest should be easy too :) So let us quickly
60 activate the Portage support for <c>distcc</c>.
61 </p>
62
63 <p>
64 First, open <path>/etc/make.conf</path> and edit the <c>FEATURES</c> variable so
65 it contains the <c>distcc</c> keyword. Next, edit the <c>MAKEOPTS</c> variable
66 so it reads <c>-jX</c> with <c>X</c> the number of CPUs that run <c>distccd</c>
67 (including the current host) plus one:
68 </p>
69
70 <pre caption="Possible MAKEOPTS setting in /etc/make.conf">
71 <comment># Suppose you have 2 single-CPU distccd hosts excluding this host:</comment>
72 MAKEOPTS="-j4"
73 </pre>
74
75 <p>
76 Now run <c>distcc-config</c> and enter the list of available DistCC servers. For
77 a simple example we assume that the available DistCC servers are
78 <c>192.168.1.102</c> (the current host), <c>192.168.1.103</c> and
79 <c>192.168.1.104</c> (two "remote" hosts):
80 </p>
81
82 <pre caption="Configuring distcc to use three available DistCC servers">
83 # <i>distcc-config --set-hosts "192.168.1.102 192.168.1.103 192.168.1.104"</i>
84 </pre>
85
86 <p>
87 Of course, don't forget to run the <c>distccd</c> daemon too:
88 </p>
89
90 <pre caption="Starting the distcc daemon">
91 # <i>/etc/init.d/distccd start</i>
92 </pre>
93
94 <p>
95 Congratulations, your system will now use distributed compiling! For more
96 in-depth information about DistCC and Gentoo, please read our <uri
97 link="/doc/en/distcc.xml">Gentoo DistCC Documentation</uri>.
98 </p>
99
100 </body>
101 </subsection>
102 </section>
103 <section>
104 <title>ccache</title>
105 <subsection>
106 <title>What is ccache?</title>
107 <body>
108
109 <p>
110 <c>ccache</c> is a fast compiler cache. When you compile a program, it will
111 cache intermediate results so that, whenever you recompile the same program,
112 the compilation time is greatly reduced. In common compilations this can result
113 in 5 to 10 times faster compilation times.
114 </p>
115
116 <p>
117 If you are interested in the ins and outs of <c>ccache</c>, please visit the
118 <uri link="http://ccache.samba.org">ccache homepage</uri>.
119 </p>
120
121 </body>
122 </subsection>
123 <subsection>
124 <title>Installing ccache</title>
125 <body>
126
127 <p>
128 Installing <c>ccache</c> with Gentoo is a breeze. Just emerge it and you're done
129 :)
130 </p>
131
132 <pre caption="Installing ccache">
133 # <i>emerge ccache</i>
134 </pre>
135
136 </body>
137 </subsection>
138 <subsection>
139 <title>Tweaking ccache</title>
140 <body>
141
142 <p>
143 Portage will automatically use ccache if it's installed. However, you can alter
144 the default cache size used by ccache by providing a <c>CCACHE_SIZE</c> variable
145 in <path>/etc/make.conf</path>:
146 </p>
147
148 <pre caption="Editing CCACHE_SIZE in /etc/make.conf">
149 CCACHE_SIZE="2G"
150 </pre>
151
152 <p>
153 As of now, Portage will use <c>ccache</c> to speed up compilations where
154 possible. If you are uncertain that <c>ccache</c> works, you can run <c>ccache
155 -s</c> to view the <c>ccache</c> statistics:
156 </p>
157
158 <pre caption="Viewing ccache statistics">
159 # <i>ccache -s</i>
160 </pre>
161
162 </body>
163 </subsection>
164 <subsection>
165 <title>Using ccache for non-Portage C compiling</title>
166 <body>
167
168 <p>
169 If you would like to use ccache for non-Portage compilations, add
170 <path>/usr/lib/ccache/bin</path> to the beginning of your <c>PATH</c> variable
171 (before <path>/usr/bin</path>). This can be accomplished by editing
172 <path>/etc/profile</path>:
173 </p>
174
175 <pre caption="Editing profile">
176 # <i>nano -w /etc/profile</i>
177 # <i>source /etc/profile</i>
178 </pre>
179
180 </body>
181 </subsection>
182 </section>
183 <section>
184 <title>Binary Packages</title>
185 <subsection>
186 <title>Creating binary packages</title>
187 <body>
188
189 <p>
190 We have already discussed how to work with prebuilt packages, but how do you
191 create your own prebuilt packages?
192 </p>
193
194 <p>
195 If the package is already installed, you can use the <c>quickpkg</c> command
196 which will make a tarball of the installed files. This is very useful for
197 backup purposes!
198 </p>
199
200 <pre caption="Using quickpkg">
201 # <i>quickpkg gnumeric</i>
202 </pre>
203
204 <p>
205 If the package isn't installed yet, you can install it using <c>emerge</c> and
206 ask to build a binary package too. <c>emerge</c> uses the <c>--buildpkg</c>
207 option (<c>-b</c> in short) for this:
208 </p>
209
210 <pre caption="Installing gnumeric and building binary packages too">
211 # <i>emerge --buildpkg gnumeric</i>
212 </pre>
213
214 <p>
215 If you want Portage to do this by default, you should set the <c>buildpkg</c>
216 keyword in the <c>FEATURES</c> variable declared in <path>/etc/make.conf</path>.
217 </p>
218
219 <pre caption="Automatically creating binary packages">
220 FEATURES="buildpkg"
221 </pre>
222
223 <p>
224 If you don't want to install the software, but only build the package, you can
225 use the <c>--buildpkgonly</c> option (<c>-B</c> in short):
226 </p>
227
228 <pre caption="Building a binary package for gnumeric">
229 # <i>emerge --buildpkgonly gnumeric</i>
230 </pre>
231
232 </body>
233 </subsection>
234 </section>
235 <section>
236 <title>Security Related Features</title>
237 <subsection>
238 <title>Sandbox</title>
239 <body>
240
241 <p>
242 While building and installing packages, Portage uses a <e>sandbox</e> to protect
243 your live system. This means that, as long as the package isn't installed on
244 your system, the package cannot touch any file outside the sandbox. This
245 ensures that Portage knows what files are created and modified by a package.
246 </p>
247
248 <p>
249 When the package compilation is finished, Portage will "preinstall" the package
250 in the sandbox, registering what files are placed and where. It will then move
251 those files from the sandbox on your live system.
252 </p>
253
254 </body>
255 </subsection>
256 <subsection>
257 <title>User Privileges</title>
258 <body>
259
260 <p>
261 Portage also supports building packages as non-root user (more precisely, as
262 user "portage", group "portage"). This improves the security during the
263 build process. You can opt to use user privileges with or without sandboxing. Of
264 course, it goes without saying that user privileges and sandboxing is the most
265 preferred method :)
266 </p>
267
268 </body>
269 </subsection>
270 <subsection>
271 <title>Activating sandbox and/or userpriv</title>
272 <body>
273
274 <p>
275 Portage will use <c>sandbox</c> by default. If you want <c>userpriv</c>, you
276 should add it to the <c>FEATURES</c> variable. Note that activating
277 <c>userpriv</c> will drop <c>sandbox</c> support, unless you also activate
278 <c>usersandbox</c>:
279 </p>
280
281 <pre caption="Activating userpriv and usersandbox">
282 FEATURES="userpriv usersandbox"
283 </pre>
284
285 <warn>
286 Do <e>not</e> remove <c>sandbox</c> from the <c>FEATURES</c> variable!
287 </warn>
288
289 </body>
290 </subsection>
291 <subsection>
292 <title>Strict Checking</title>
293 <body>
294
295 <p>
296 Portage can be asked to react strongly to possibly dangerous conditions (such as
297 missing or incorrect Manifest files). To activate this strict checking, add the
298 <c>strict</c> keyword to the <c>FEATURES</c> variable:
299 </p>
300
301 <pre caption="Activating strict checking">
302 FEATURES="strict"
303 </pre>
304
305 </body>
306 </subsection>
307 <subsection>
308 <title>Smart File System Permissions</title>
309 <body>
310
311 <p>
312 Portage can be told to automatically deal with potentially dangerous file
313 permissions that could pose a security risk. It does this by removing the
314 "group" and "other" readable bits on setuid files and removing the "other"
315 readable bit on setgid files in the pre install phase. To activate the
316 smart file permissions, add the <c>sfperms</c> keyword to the
317 <c>FEATURES</c> variable:
318 </p>
319
320 <pre caption="Activating smart file system permissions">
321 FEATURES="sfperms"
322 </pre>
323
324 </body>
325 </subsection>
326 </section>
327 <section>
328 <title>SLOT'ed Software Titles</title>
329 <subsection>
330 <title>SLOT ?</title>
331 <body>
332
333 <p>
334 Occasionally you need to have several versions of a software title installed at
335 the same time to satisfy your system's dependencies. Whereas most distributions
336 allow this by having their packages called to the version (such as
337 <c>freetype</c> and <c>freetype2</c>) Portage uses the concept of <e>SLOT</e>s.
338 </p>
339
340 <p>
341 A <e>SLOT</e> is a (part of a) version number that tells Portage that all
342 equally named packages with a different SLOT are able to coexist on the same
343 system. Portage is able to track both branches of a certain package and update
344 them if updates to the respective branches are available.
345 </p>
346
347 <p>
348 When you perform an update Portage will only automatically unmerge the old
349 instance of a package if it uses the same SLOT. This is why kernel sources are
350 never automatically unmerged as their SLOT is the complete version.
351 </p>
352
353 </body>
354 </subsection>
355 </section>
356 <section>
357 <title>Other Features</title>
358 <subsection>
359 <title>Portage Help</title>
360 <body>
361
362 <p>
363 There are several other keywords you can place in the <c>FEATURES</c> variable.
364 Most of them are targeted towards developers and less interesting for the casual
365 user. If you are interested in learning more about these features (or Portage
366 generally), don't forget to read the <path>make.conf</path> manpage we provide.
367 </p>
368
369 <pre caption="More Portage-related information">
370 # <i>man make.conf</i>
371 </pre>
372
373 </body>
374 </subsection>
375 </section>
376 </sections>

  ViewVC Help
Powered by ViewVC 1.1.20