1 |
On 20-06-28 08:18:23, Michael Orlitzky wrote: |
2 |
> As many of you probably know, ago@ has been expanding the scope of our |
3 |
> CFLAGS/CC support to include some other common build variables: |
4 |
> |
5 |
> * CC |
6 |
> * CXX |
7 |
> * AR |
8 |
> * CPP |
9 |
> * NM |
10 |
> * RANLIB |
11 |
> * AS |
12 |
> * LD |
13 |
> |
14 |
> Some of those are POSIX standards[0], |
15 |
> |
16 |
> * CC |
17 |
> * AR |
18 |
> |
19 |
> Others are de-facto GNU make standards[1], |
20 |
> |
21 |
> * CXX |
22 |
> * CPP |
23 |
> * AS |
24 |
> |
25 |
> and a few are de-facto GNU libtool standards[2]: |
26 |
> |
27 |
> * NM |
28 |
> * RANLIB |
29 |
> * LD |
30 |
> |
31 |
> If we expect them all to work properly in Gentoo, we have to agree on |
32 |
> what they mean, and thus how they should be injected into build systems. |
33 |
> For example, we had a problem with sci-mathematics/pari, whose upstream |
34 |
> is using the LD environment variable for something other than what GNU |
35 |
> libtool uses it for. With LD set to something libtooly in the |
36 |
> environment, the pari build fails. We can solve that by unsetting LD in |
37 |
> the ebuild, but for that to be The Right Thing To Do, we should be |
38 |
> expecting LD to contain something libtooly, and thus something |
39 |
> inappropriate to be passed to the pari build. |
40 |
> |
41 |
> To avoid these issues, I suggest creating a list of "Gentoo environment |
42 |
> variables" in the devmanual with descriptions of how they should be used |
43 |
> and pointers to the references (for why we chose that meaning). That way |
44 |
> a user can export LD, for example, and know that it will be used how he |
45 |
> thinks it will be used. |
46 |
> |
47 |
> |
48 |
> [0] https://pubs.opengroup.org/onlinepubs/009695399/utilities/make.html |
49 |
> |
50 |
> [1] |
51 |
> https://www.gnu.org/software/make/manual/html_node/Implicit-Variables.html |
52 |
> |
53 |
> [2] https://www.gnu.org/software/libtool/manual/libtool.html |
54 |
> |
55 |
|
56 |
I'd like to suggest allowing only approved variables in the build |
57 |
environment, having portage unset all variables and setting only what is |
58 |
needed (or configured). |
59 |
|
60 |
I'd like to see some variable like this used in make.conf (or maybe one |
61 |
exists that I don't know about...). |
62 |
|
63 |
# set the default bash array if GENTOO_EMERGE_ENV is not defined as an array |
64 |
if ! declare -p GENTOO_EMERGE_ENV 2> /dev/null | grep -q '^declare \-a'; then |
65 |
declare -a GENTOO_EMERGE_ENV |
66 |
GENTOO_EMERGE_ENV+=("USE=\"-build\"") |
67 |
GENTOO_EMERGE_ENV+=("FEATURES=\"binpkg-multi-instance buildpkg parallel-fetch parallel-install\"") |
68 |
GENTOO_EMERGE_ENV+=("PKGDIR=\"/tmp/portage-pkgdir\"") |
69 |
GENTOO_EMERGE_ENV+=("DISTDIR=\"/tmp/portage-distdir\"") |
70 |
GENTOO_EMERGE_ENV+=("PORTDIR=\"/tmp/portage-portdir\"") |
71 |
export GENTOO_EMERGE_ENV |
72 |
fi |
73 |
# itterate over the array, exporting each 'line' |
74 |
for (( i=0; i<${#GENTOO_EMERGE_ENV[@]}; i++ )); do |
75 |
eval export "${GENTOO_EMERGE_ENV[i]}" |
76 |
done |
77 |
|
78 |
-- |
79 |
Matthew Thode (prometheanfire) |