Gentoo Archives: gentoo-soc

From: "Michał Górny" <mgorny@g.o>
To: gentoo-soc@l.g.o
Subject: Re: [gentoo-soc] [xgreenlandforwyy@gmail.com: A question about BUILD_DIR variable in cmake.eclass under EAPI=8]
Date: Sat, 16 Jul 2022 10:15:34
Message-Id: 08e9bf66f0b9a1c89448dd7a06cba08a9a935c20.camel@gentoo.org
In Reply to: [gentoo-soc] [xgreenlandforwyy@gmail.com: A question about BUILD_DIR variable in cmake.eclass under EAPI=8] by wuyy
1 On Sat, 2022-07-16 at 17:38 +0800, wuyy wrote:
2 > Hello all,
3 >
4 > Below is the my question about BUILD_DIR variable in cmake.eclass. I
5 > have previously raised it in IRC channel, but did not get it clear, so I
6 > tried to ask the author of cmake.eclass. It seems that Andreas may be
7 > busy recently and I haven't receive a reply, and I'll keep wait. Thus, I
8 > forward this question here so we can discuss it and keep a public
9 > record. If the problem is confirmed to be rather important, I think we
10 > can move the discussion to Gentoo-dev mailing list.
11 >
12 > ----- Forwarded message from wuyy <xgreenlandforwyy@×××××.com> -----
13 >
14 > Date: Fri, 15 Jul 2022 16:49:45 +0800
15 > From: wuyy <xgreenlandforwyy@×××××.com>
16 > To: Andreas Sturmlechner <asturm@g.o>
17 > Subject: A question about BUILD_DIR variable in cmake.eclass under EAPI=8
18 >
19 > Hello Andreas,
20 >
21 > I'm a student participating in Google Summer of Code this year,
22 > packaging ROCm. I have met a problem when using cmake.eclass, and I'm
23 > not sure whether it should be called a bug or it's just a feature, so I
24 > want to personally ask you, the author of corresponding code.
25 >
26 > As I observe the BUILD_DIR variable is no longer globally set in
27 > cmake.eclass under EAPI=8, with this change:
28 >
29 > -# ${WORKDIR}/${P}_build.
30 > -: ${BUILD_DIR:=${WORKDIR}/${P}_build}
31 > +# ${CMAKE_USE_DIR}_build (in EAPI-7: ${WORKDIR}/${P}_build).
32 > +[[ ${EAPI} == 7 ]] && : ${BUILD_DIR:=${WORKDIR}/${P}_build}
33 > +# EAPI-8: set inside _cmake_check_build_dir
34 >
35 > So I have to use this variable in ebuild after _cmake_check_build_dir
36 > which is inside cmake_src_prepare. That's not an issue in src_prepare.
37 > Also this variable can be used in following phases. Everything seems
38 > nice, until I begin debugging and polishing src_test. After a
39 > successful src_compile, I come to the src_test, which has bugs. I fixed
40 > the bug and rerun ebuild xxx src_test, but it unexpectedly failed,
41 > because BUILD_DIR is empty!
42 >
43 > To summarize, BUILD_DIR can live to other phases when phases are
44 > executed in one call, but cannot be kept if the previous steps are
45 > skipped.
46 >
47 > This is not a problem for most scenarios, but it's a bit annoying when
48 > developing and debugging ebuilds. I have to call _cmake_check_build_dir
49 > explicitly before using BUILD_DIR, although src_prepare has been run. I
50 > wonder this may be a bug, but maybe it's designed to work that way for
51 > some reasons I don't know. If you think this is a bug, I can put it on
52 > bugzilla and find a fix to it. Thank you very much!
53 >
54
55 Can you reproduce while running the test phase via emerge(1)? Using
56 ebuild(1) is known to be buggy.
57
58 --
59 Best regards,
60 Michał Górny

Replies