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