Gentoo Archives: gentoo-dev

From: Andrew Ammerlaan <andrewammerlaan@g.o>
To: gentoo-dev@l.g.o, davidshen84@×××××.com
Cc: vowstar@×××××.com
Subject: Re: [gentoo-dev] [ebuild] How to do make install while in compilation stage
Date: Mon, 11 Jul 2022 04:35:08
Message-Id: f78a811a-07fc-0417-5dbc-fe95150823ef@gentoo.org
In Reply to: [gentoo-dev] [ebuild] How to do make install while in compilation stage by Xi Shen
1 Hi,
2
3 On 11/07/2022 05:17, Xi Shen wrote:
4 > Hi,
5 >
6 > I am trying to create an ebuild file for
7 > https://github.com/NVIDIA/libnvidia-container
8 > <https://github.com/NVIDIA/libnvidia-container>. It has a few other
9 > dependencies which will be built by itself.
10
11 Such an ebuild already exists in the ::guru overlay (maintainer in CC).
12 I see it is one version behind though. Feel free to bump it to the
13 latest version if you want, probably a simple copy and renaming of the
14 ebuild will do the trick.
15
16 > My ebuild can download and compile those dependencies. But one of the
17 > dependency "libtirpc-1.3.2" needs to install itself in the temporary
18 > portage environment. Its Makefile allows me to pass in the "DESTDIR"
19 > variable which I passed in
20 > "/var/tmp/portage/sys-libs/libnvidia-container-1.10.0/work/libnvidia-container-1.10.0/deps",
21 > but when it installs, the package is installed to
22 > "/var/tmp/portage/sys-libs/libnvidia-container-1.10.0/work/libnvidia-container-1.10.0/deps/var/tmp/portage/sys-libs/libnvidia-container-1.10.0/work/libnvidia-container-1.10.0/deps/usr/local",
23 > the working director got repeated after the "deps" directory.
24 >
25 > I checked the makefile, but could not figure out where that path got
26 > replicated. I guess when running inside the portage build environment,
27 > there's some "chroot" trick that prevents packages from writing the root
28 > file system.
29 >
30 > So I want to ask if I need to do a "make install" during compilation,
31 > how should I pass the destination directory?
32
33 Don't try to install things to the installation directory (${ED}) during
34 the compile phase. If you really have something that insists on being
35 installed somewhere to complete the compilation, then install it to some
36 temporary directory, e.g. ${T} and then if necessary copy it from the
37 temporary directory into the installation directory during the install
38 phase. The ebuild in ::guru seems to solve your problem with a bunch of
39 patches, which I think is a better solution.
40
41 Best regards,
42 Andrew