/[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.33 - (show annotations) (download) (as text)
Sat Oct 28 09:17:55 2006 UTC (7 years, 10 months ago) by neysx
Branch: MAIN
Changes since 1.32: +6 -1 lines
File MIME type: application/xml
Moved chapter abstracts into shared chapters
No content change, hence no bump

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.32 2006/10/17 02:28:45 nightmorph Exp $ -->
8
9 <sections>
10
11 <abstract>
12 Discover the features Portage has, such as support for distributed compiling,
13 ccache and more.
14 </abstract>
15
16 <version>1.29</version>
17 <date>2006-10-16</date>
18
19 <section>
20 <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 <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 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 please consult the <path>make.conf</path> man page:
39 </p>
40
41 <pre caption="Consulting the make.conf man page">
42 $ <i>man make.conf</i>
43 </pre>
44
45 <p>
46 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 </p>
49
50 <pre caption="Finding out the FEATURES that are already set">
51 $ <i>emerge --info | grep FEATURES</i>
52 </pre>
53
54 </body>
55 </section>
56 <section>
57 <title>Distributed Compiling</title>
58 <subsection>
59 <title>Using distcc</title>
60 <body>
61
62 <p>
63 <c>distcc</c> is a program to distribute compilations across several, not
64 necessarily identical, machines on a network. The <c>distcc</c> client sends all
65 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 faster compilation time.
68 </p>
69
70 <p>
71 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 </p>
75
76 </body>
77 </subsection>
78 <subsection>
79 <title>Installing distcc</title>
80 <body>
81
82 <p>
83 Distcc ships with a graphical monitor to monitor tasks that your computer is
84 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 </p>
88
89 <pre caption="Installing distcc">
90 # <i>emerge distcc</i>
91 </pre>
92
93 </body>
94 </subsection>
95 <subsection>
96 <title>Activating Portage Support</title>
97 <body>
98
99 <p>
100 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 </p>
105
106 <p>
107 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 </p>
111
112 <pre caption="Configuring distcc to use three available distcc servers">
113 # <i>distcc-config --set-hosts "192.168.1.102 192.168.1.103 192.168.1.104"</i>
114 </pre>
115
116 <p>
117 Don't forget to run the <c>distccd</c> daemon as well:
118 </p>
119
120 <pre caption="Starting the distccd daemons">
121 # <i>rc-update add distccd default</i>
122 # <i>/etc/init.d/distccd start</i>
123 </pre>
124
125 </body>
126 </subsection>
127 </section>
128 <section>
129 <title>Caching Compilation</title>
130 <subsection>
131 <title>About ccache</title>
132 <body>
133
134 <p>
135 <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 </p>
140
141 <p>
142 If you are interested in the ins and outs of ccache, please visit the
143 <uri link="http://ccache.samba.org">ccache homepage</uri>.
144 </p>
145
146 </body>
147 </subsection>
148 <subsection>
149 <title>Installing ccache</title>
150 <body>
151
152 <p>
153 To install <c>ccache</c>, run <c>emerge ccache</c>:
154 </p>
155
156 <pre caption="Installing ccache">
157 # <i>emerge ccache</i>
158 </pre>
159
160 </body>
161 </subsection>
162 <subsection>
163 <title>Activating Portage Support</title>
164 <body>
165
166 <p>
167 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 </p>
170
171 <pre caption="Editing CCACHE_SIZE in /etc/make.conf">
172 CCACHE_SIZE="2G"
173 </pre>
174
175 <p>
176 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 </p>
180
181 <pre caption="Viewing ccache statistics">
182 # <i>CCACHE_DIR="/var/tmp/ccache" ccache -s</i>
183 </pre>
184
185 <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 </body>
198 </subsection>
199 <subsection>
200 <title>Using ccache for non-Portage C Compiling</title>
201 <body>
202
203 <p>
204 If you would like to use ccache for non-Portage compilations, add
205 <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 </p>
210
211 <pre caption="Editing .bash_profile">
212 PATH="<i>/usr/lib/ccache/bin</i>:/opt/bin"
213 </pre>
214
215 </body>
216 </subsection>
217 </section>
218 <section>
219 <title>Binary Package Support</title>
220 <subsection>
221 <title>Creating Prebuilt Packages</title>
222 <body>
223
224 <p>
225 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 </p>
229
230 <p>
231 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 </p>
235
236 <p>
237 If you want Portage to create prebuilt packages of every single package you
238 install, add <c>buildpkg</c> to the FEATURES variable.
239 </p>
240
241 <p>
242 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 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 </p>
248
249 </body>
250 </subsection>
251 <subsection>
252 <title>Installing Prebuilt Packages</title>
253 <body>
254
255 <p>
256 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 </p>
261
262 <pre caption="Setting PORTAGE_BINHOST in /etc/make.conf">
263 PORTAGE_BINHOST="ftp://buildhost/gentoo"
264 </pre>
265
266 <p>
267 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 </p>
273
274 <p>
275 For instance, to install <c>gnumeric</c> with prebuilt packages:
276 </p>
277
278 <pre caption="Installing the gnumeric prebuilt package">
279 # <i>emerge --usepkg --getbinpkg gnumeric</i>
280 </pre>
281
282 <p>
283 More information about emerge's prebuilt package options can be found in the
284 emerge man page:
285 </p>
286
287 <pre caption="Reading the emerge man page">
288 $ <i>man emerge</i>
289 </pre>
290
291 </body>
292 </subsection>
293 </section>
294 </sections>

  ViewVC Help
Powered by ViewVC 1.1.20