Gentoo Archives: gentoo-soc

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

Replies