Gentoo Archives: gentoo-dev

From: Antst GD <antst@×××××××.se>
To: gentoo-dev@l.g.o
Subject: [gentoo-dev] per-package environment variables.
Date: Tue, 31 Aug 2004 22:26:25
Message-Id: 4134FB0B.9060501@ifm.liu.se
1 OK, lets develop discussion about option to choose environment variables
2 per-package (compiler, flags and not only).
3
4 As some of us know, definition of problem already include 90% solution.
5 So, lets start from user-side.
6 Want we want to see?
7 1) Possibility to change ENV during building some packages.
8 2) it should be automatic, no more definition of environment variables
9 and manual emerging packages. No more spaming /etc/make.conf with some
10 environment variables which correspond only to one package (RXVT_TERM,
11 for example)
12 3) Solution must be flexible and allow us to have not only
13 "per-package" variables set, but also define some general sets for
14 inclusion. For example if we want to build soft1,soft2,ans soft3 with
15 IFC, we really don't want to have 3 copies of something like:
16 F77=ifc
17 FC=ifc
18 F90=ifc
19 FFLAGS="-xN -ip"
20 Moreover, when we will decide to change CPU, we will not need to edit 3
21 files and change -xN to -xP. We want to do it once. :)
22
23 4) BTW, in such case it also not bad to have option to include something
24 like
25 USE="ifc"
26 into this environment, and it should be parsed in proper way. I hope
27 that this is clear. If we want to build something with IFC and set
28 proper variables, we really don't want to go and edit one more file
29 (/etc/portage/package.use). And we don't want to edit also two files,
30 when we will figure out that we like coming gfortran :)
31
32 5) even more. I'll start not with per-package basic, but with
33 per-environment basic, as a first iteration.
34
35 So, lets define our problem in more details:
36 1) Assume that default configuration of my system is
37 GCC 3.4.1
38 CFLAGS="-O2 -pipe" in /etc/make.conf
39 LINGUAS="ru" in /etc/make.conf
40 there is no defined ifc and icc USE flags in /etc/make.conf
41
42 2) I have set of packages, that require something "extra"
43 lam-mpi : want to compile with ICC, IFC
44 blas-reference : want to compile with g77 and high optimization
45 lapack-reference : want to compile with g77 and high optimization
46 blas-atlas: want to compile with IFC, ICC
47 lapack-atlas: want to compile with IFC, ICC
48 xine-lib : want to compile with low-optimization for GCC
49 open office : want to compile with LANGUAGE="RUSS" and GCC 3.3.4 and
50 low-optimization
51 kde-i18n : want to have with LINGUAS="fr" and GCC 3.3.4
52 rxvt : want to compile with RXVT_TERM=xterm
53 octave : want to build with high-optimization for GCC
54
55
56 so, what I see?
57 Something like:
58
59 #cat /etc/portage/package.env
60 lam-mpi: icc ifc
61 blas-reference: g77high.env
62 lapack-reference: g77high.env
63 blas-atlas: ifc.env icc.env
64 lapack-atlas: ifc.env icc.env
65 xine-lib: GCC_lowopt.env
66 openoffice: language_ru.env GCC_334.env GCC_lowopt.env
67 kde-i18n: linguas_fr.env
68 rxvt: rxvt.env
69 octave: GCC_highopt.env
70
71
72 #ls /etc/portage/env
73 ifc.env
74 ifc.env
75 GCC_highopt.env
76 GCC_lowopt.env
77 rxvt.env
78 linguas_fr.env
79 language_ru.env
80 GCC_334.env
81 g77high.env
82
83 and
84 #cat /etc/portage/env/icc.env
85 CC=icc
86 CXX=icc
87 CFLAGS="-O2 -xN -noalign"
88 CXXFLAGS=$CFLAGS
89 USE="icc"
90
91 #cat /etc/portage/env/GCC_highopt.env
92 CFLAGS="-O3 -ffast-math -funroll-all-loops -fmove-all-movables"
93
94 #cat /etc/portage/env/GCC_lowopt.env
95 CFLAGS="-O1"
96
97 #cat /etc/portage/env/GCC_334.env
98 CC=/usr/i686-pc-linux-gnu/gcc-bin/3.3/gcc
99 g77=/usr/i686-pc-linux-gnu/gcc-bin/3.3/g77
100
101 And rest it similar.
102
103 Of course, it could be not so bad, to have option, to include name of
104 file with ENV, or just env, to not produce tens of files with one
105 variable, like RXVT_TERM="xterm"... There is seems to be two solutions:
106 1) just have second file with definitions, where not filenames, but
107 defined variables.
108 2) change syntax of /etc/portage/package.env in such way, that allow to
109 include both kind of records, filename and strict definition inline.
110 something like
111 openoffice: GCC_334.env GCC_lowopt.env -- LANGUAGE="RUSS"
112
113
114 For the moment both solutions looks ugly for me. At least I can't
115 imaging simple and easy-to-understand syntax for package.env, which will
116 look nice and will parce without problems.
117
118 What do you think about?
119
120 --
121 Anton Starikov
122
123 --
124 gentoo-dev@g.o mailing list

Replies