Gentoo Archives: gentoo-dev

From: Olivier Fisette <ribosome@g.o>
To: gentoo-dev@l.g.o
Subject: Re: [gentoo-dev] per-package environment variables.
Date: Wed, 01 Sep 2004 03:06:01
Message-Id: 200408312305.54733.ribosome@gentoo.org
In Reply to: Re: [gentoo-dev] per-package environment variables. by Mike Frysinger
1 Hello all,
2
3 I see two problems with the implementations that were suggested up to now for
4 per-package environment variables.
5
6 1) They do not allow any flexibility with regard to package versions, as
7 opposed to other Portage configuration files ("package.mask", "package.use",
8 etc.). The file "/etc/portage/packages.env/app-shells/bash" would be sourced
9 for all versions of "app-shells/bash", for instance. This may be problematic
10 for SLOTable packages, and prevents a user from defining or modifying a
11 variable for a particular version of a package (to work around a bug, for
12 example, such as "pymol-0.95" will segfault when raytracing if compiled with
13 "-fgcse").
14
15 2) Having a hierarchy of files and directories miroring the Portage tree, with
16 symlinks and such, looks a bit complicated more complicated than is needed.
17 I'd rather have to deal with only one or a few files.
18
19 My initial suggestion was not flexible enough, since it required to declare
20 the variables repeatedly for each package. Here is another idea:
21
22 A file named "/etc/portage/package.env" could contain entries such as:
23
24 app-office/openoffice lang_ru
25 >=app-sci/emboss-2.8.0 icc
26 =app-sci/pymol-0.95* gcc_low_opt
27
28 The keywords "lang_ru", "ifc" and "gcc_low_opt" would match files with these
29 names, contained in "/etc/portage/env.d". These bash scripts would be sourced
30 to provide per-package env vars. "/etc/portage/env.d/icc" would contain
31 something along these lines:
32
33 CC=icc
34 CXX=icc
35 CFLAGS="-O2 -xN -noalign"
36 CXXFLAGS=$CFLAGS
37 USE="icc"
38
39 If we wanted to make things even easier to configure, we could have something
40 like the following in "/etc/portage/package.env":
41
42 =app-sci/pymol-0.95* [ CC="gcc" CFLAGS="-O1" ]
43
44 ... were a keyword is replaced by a delimited short bash script that would be
45 sourced to provide per package env vars. This would avoid having to create
46 files in "/etc/portage/env.d" which target only one package.
47
48 I don't think this approach is elegant or powerful. A better mechanism would
49 allow to filter and replace flags (like flag-o-matic), to choose compilers
50 and have them merged as dependencies when needed, etc. However, per-package
51 env vars would be enough in 99 % of the cases, and would extend farther than
52 just compilers and compiler flags.
53
54 --
55 Olivier Fisette (ribosome)
56 Gentoo Linux Developer

Replies

Subject Author
Re: [gentoo-dev] per-package environment variables. Anton Starikov <antst@×××××××.se>