Gentoo Archives: gentoo-user

From: Alan McKinnon <alan.mckinnon@×××××.com>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] How is /etc/portage/env supposed to work?
Date: Tue, 20 Oct 2015 18:26:40
Message-Id: 562686FA.3000502@gmail.com
In Reply to: Re: [gentoo-user] How is /etc/portage/env supposed to work? by Michael Orlitzky
1 On 20/10/2015 16:26, Michael Orlitzky wrote:
2 > On 10/20/2015 10:04 AM, Nikos Chantziaras wrote:
3 >> I'm following the documentation here:
4 >>
5 >> https://wiki.gentoo.org/wiki/Handbook:AMD64/Portage/Advanced#Using_.2Fetc.2Fportage.2Fenv
6 >>
7 >> to hook into the postinst phase of an ebuild.
8 >
9 > Deja vu:
10 >
11 > http://comments.gmane.org/gmane.linux.gentoo.devhelp/151
12 >
13 > https://bugs.gentoo.org/show_bug.cgi?id=388781
14 >
15 > There's two separate uses for /etc/portage/env -- one of them will get
16 > you the make.conf parser (when you list the file in
17 > /etc/portage/package.env) and the other that will get you the bash
18 > parser (when you put the file at /etc/portage/env/${CATEGORY}/${PN}).
19 >
20 > The whole thing is confusing. If you ever get it working please put a
21 > decent example on the wiki because I remember spending hours trying to
22 > do the same thing.
23
24
25 I had to go down this road too recently. The portage man pages mention
26 the two ways and recommend the completely non-obvious one that melted my
27 brain. It works like this:
28
29 $ cat /etc/portage/package.env
30 =app-emulation/virtualbox-5.0.6 vbox-makeopts
31 =app-emulation/virtualbox-5.0.6-r1 vbox-makeopts
32
33 $ cat /etc/portage/env/vbox-makeopts
34 MAKEOPTS="-j2 -l4"
35
36 All the atoms listed in package.env (2 virtual box ebuilds in this case)
37 will apply the environment settings in a file called vbox-makeopts. I
38 had to do this because virtualbox-5 has a weird parallel build bug - it
39 often fails with j=1 or j>2 but never with j=2. Odd.
40
41
42 The other method is very obvious but somehow not recommended:
43
44 $ ls -l /etc/portage/env/mail-client
45 -rw-r--r-- 1 root root 92 Sep 25 17:00 thunderbird-38.2.0
46 -rw-r--r-- 1 root root 92 Oct 1 14:52 thunderbird-38.3.0
47
48 $ cat /etc/portage/env/mail-client/thunderbird-38.2.0
49 LDFLAGS="${LDFLAGS}
50 -Wl,-rpath,/usr/lib/thunderbird,-rpath,/usr/lib/thunderbird/components"
51
52
53 The dir and version structure of env/<pkg>-<version> is compared to
54 what is being merged (IIRC $P, $PN, $PV all work) and the env in the
55 file is applied.
56
57
58
59 --
60 Alan McKinnon
61 alan.mckinnon@×××××.com