1 |
Lie Ryan posted on Fri, 22 Jan 2010 14:05:55 +1100 as excerpted: |
2 |
|
3 |
> The FEATURES variable can set some useful optional portage features. |
4 |
> Look at "man make.conf" for valid options. Some options can speed up |
5 |
> compiling, others may increase security. Some of the most useful |
6 |
> FEATURES: |
7 |
|
8 |
> ccache: you'll need to emerge dev-utils/ccache and tune the |
9 |
> CCACHE_SIZE |
10 |
|
11 |
> parallel-fetch: the name describes best |
12 |
|
13 |
> test: runs "make check" for packages that have them and fail the |
14 |
> install when the test don't pass. Be aware that quite a lot of package |
15 |
> is shipped with failed tests. You may want to add "--keep-going" |
16 |
> when emerging a large number of packages. |
17 |
|
18 |
Also be aware that a number of packages are known to take a **LONG** time |
19 |
to do their tests -- several times the length of the actual compile. |
20 |
mysql is I believe the most (in)famous of these, with tests taking |
21 |
something like an entire day. Similarly, some packages have additional |
22 |
(uncommon) dependencies that are /only/ brought in for the tests -- |
23 |
effectively you're installing extra packages /just/ for the tests. |
24 |
|
25 |
Finally and perhaps most importantly, for at least one package (udev), |
26 |
enabling test has security implications -- the tests require an insecure |
27 |
build that upstream warns NOT to install in production environments, the |
28 |
tests are designed for development use only. |
29 |
|
30 |
Thus, FEATURES=test is definitely one feature that should be considered |
31 |
well before enabling. Yes, it does make your installation more robust in |
32 |
general, but there are implications that should be considered as well, |
33 |
and particular applications for which you will probably want the feature |
34 |
disabled. (This can be accomplished using an appropriate /etc/portage/ |
35 |
bashrc, setting FEATURES=-test conditional on the specific exception |
36 |
package.) |
37 |
|
38 |
> userfetch, usersandbox, usersync: these may add a little bit of |
39 |
> security. |
40 |
|
41 |
> See "man make.conf" for more options |
42 |
|
43 |
My favorite is FEATURES=buildpkg, or if you're space-constrained, |
44 |
FEATURES=buildsyspkg. If either/both of these are enabled, also consider |
45 |
FEATURES=fixpackages, and set the PKGDIR variable as appropriate, also. |
46 |
|
47 |
This has saved me many an unnecessary recompile over the years, when some |
48 |
update went wrong, and I was able to simply emerge --usepkgeonly the |
49 |
previous version. As the binpkgs are simply tarballs with some |
50 |
additional metadata tacked on the end, they can be browsed/opened with |
51 |
your favorite archiver as well, thus enabling troubleshooting such as |
52 |
quick checks of what a particular config file looked like by default, or |
53 |
simply browsing a particular package's as-shipped filesystem. They also |
54 |
come in handy when, for instance, gcc is borked so you can't use it to |
55 |
rebuild gcc (just emerge --usepkgonly the binpkg), or portage or python |
56 |
is borked so you can't emerge at all (just untar a working version over |
57 |
top the live filesystem -- but be sure you have backups of the config |
58 |
files it includes, first). |
59 |
|
60 |
Meanwhile, it's also worth considering LDFLAGS. Here's mine: |
61 |
|
62 |
LDFLAGS="-Wl,-z,now,--as-needed,-O1,--hash-style=gnu,--sort-common" |
63 |
|
64 |
The -Wl bit is the gcc prefix, telling it that the rest of the LDFLAGS |
65 |
are for the linker. |
66 |
|
67 |
-z,now tells the linker to resolve all links at load, instead of "lazy |
68 |
resolution", waiting until functions are needed in some cases to resolve |
69 |
them. This one's purely personal preference, and will at times slightly |
70 |
increase application start times, but if there's going to be a problem, |
71 |
I'd rather it happen when an app is starting, instead of crashing later, |
72 |
after I have unsaved work. There are very rare circular library |
73 |
dependency issues with this as well. (A library loads functions from |
74 |
another library, which needs functions from the first.) One example was |
75 |
xf86-video-ati, but that one has long had a check in the ebuild that |
76 |
disables the flag, if it's found. I've not had issues running with this |
77 |
for some time, now. |
78 |
|
79 |
--as-needed is the one most folks will be interested in. There's talk of |
80 |
eventually making this the Gentoo default, as it can DRAMATICALLY reduce |
81 |
the number of reverse dependency breakage of the sort revdep-rebuild |
82 |
fixes. I'm talking an order of magnitude reduction, having to rebuild |
83 |
maybe 1/10 of the packages that would have to be rebuilt without it. |
84 |
Problems with this one should now be quite rare indeed, because many |
85 |
people run with this LDFLAG, and Flameeyes (Diego P) actively tests |
86 |
packages for breakage with it on his tinderbox, filing bugs and helping |
87 |
devs patch where needed. Given the major benefits in reduced revdep |
88 |
breakage and relatively low risk, I'd DEFINITELY recommend this one. |
89 |
(FWIW, if you want JUST this one: LDFLAGS="-Wl,--as-needed" .) |
90 |
|
91 |
-O1 is linker optimization, similar to gcc's -O flags, only there's just |
92 |
the one level. I /think/ this might be the gentoo default, but am not |
93 |
sure. |
94 |
|
95 |
--hash-style=gnu tells the linker to use GNU style function-lookup |
96 |
hashing. There's another style available also (IDR the name ATM), and |
97 |
"both" can also be used. The Gentoo default, AFAIK is "both", altho |
98 |
there has been some discussion of switching that to "gnu", as there's |
99 |
little reason to include both unless you're compiling for use on other |
100 |
than Gentoo GNU/Linux (IOW, using prefix for the BSDs, or something). |
101 |
|
102 |
--sort-common is another slight look-up optimization, tho in typical use, |
103 |
you'll not notice it. This has been discussed as a Gentoo default and in |
104 |
fact, I think it is already, tho I'm not sure. |
105 |
|
106 |
As mentioned above, --as-needed is the big one with real benefits and |
107 |
little down side due to already active usage. The others, take or leave, |
108 |
as you wish. |
109 |
|
110 |
-- |
111 |
Duncan - List replies preferred. No HTML msgs. |
112 |
"Every nonfree program has a lord, a master -- |
113 |
and if you use the program, he is your master." Richard Stallman |