Gentoo Archives: gentoo-dev

From: Andrew Savchenko <bircoph@g.o>
To: gentoo-dev@l.g.o
Subject: Re: [gentoo-dev] [RFC] Enable CMAKE_WARN_UNUSED_CLI by default in cmake-utils for EAPI>=6
Date: Wed, 18 May 2016 06:23:08
Message-Id: 20160518092253.dcc8a44b4c7e7cb8a07011c4@gentoo.org
In Reply to: [gentoo-dev] [RFC] Enable CMAKE_WARN_UNUSED_CLI by default in cmake-utils for EAPI>=6 by Maciej Mrozowski
1 On Mon, 02 May 2016 18:06:44 +0200 Maciej Mrozowski wrote:
2 > Hello,
3 >
4 > General advise: do not convert ebuilds inheriting cmake-utils to EAPI 6 unless
5 > you know what you are doing (you are fully aware of eclass behaviour removed
6 > with https://bugs.gentoo.org/show_bug.cgi?id=514384).
7 >
8 > Background:
9 >
10 > Pre EAPI-6 cmake-utils.eclass contained certain feature to mitigate CMake
11 > variable case changes done by upstream.
12 > This feature was explicitly removed with
13 > https://bugs.gentoo.org/show_bug.cgi?id=514384 and no alternative was
14 > proposed.
15 > It opened new area of possible ebuild regression bugs when switching to EAPI-6
16 > for ebuilds inheriting cmake-utils.eclass.
17 >
18 > Unfortunately there is common misconception, also among developers, that it's
19 > sufficient to simply replace "${cmake-utils_use_with foo)" with "-DWITH_foo=ON"
20 > etc.
21 > This is MOST OF THE TIME not the case.
22 > When converting cmake-utils ebuild to EAPI>=6, one needs to consult
23 > CMakeLists.txt wrt case each variable is written with since CMake is case-
24 > sensitive and WITH_FOO != WITH_foo != WITH_Foo.
25 >
26 > Proposal:
27 >
28 > CMake allows warning about unused CMake variables passed by CLI. Since this is
29 > how Gentoo passes ebuild configuration options, it's proposed to enable this
30 > feature.
31 > Unfortunately it won't fail compilation but at least it gives a chance to spot
32 > case mismatch when reading build output.
33 >
34 > Future thoughts:
35 >
36 > For better damage control it's technically possible to extend configure phase
37 > of cmake-utuls eclass to check mycmakeargs against parsed package buildsystem
38 > but this might not be very reliable.
39
40 For me the real confusion was from this line:
41
42 die "${FUNCNAME[1]} is banned in EAPI 6 and later: use -D$1${arg}=\"\$(usex $2)\" instead"
43
44 It recommends to use ${arg} without any warning about case, so when I just
45 copied what it recommends: -DWITH_nls="$(usex nls)", I had a nice surprise
46 and fun debugging.
47
48 Best regards,
49 Andrew Savchenko

Replies

Subject Author
Re: [gentoo-dev] [RFC] Enable CMAKE_WARN_UNUSED_CLI by default in cmake-utils for EAPI>=6 Maciej Mrozowski <reavertm@×××××.com>