1 |
On 04/11/16 11:55, Maciej Mrozowski wrote: |
2 |
> On czwartek, 3 listopada 2016 07:31:10 CET Michał Górny wrote: |
3 |
>> On Thu, 3 Nov 2016 00:52:16 +0100 |
4 |
>> |
5 |
>> Maciej Mrozowski <reavertm@×××××.com> wrote: |
6 |
>>> From: Maciej Mrozowski <reavertm@g.o> |
7 |
>>> |
8 |
>>> --- |
9 |
>>> |
10 |
>>> eclass/cmake-utils.eclass | 54 |
11 |
>>> ++++++++++++++++++----------------------------- 1 file changed, 21 |
12 |
>>> insertions(+), 33 deletions(-) |
13 |
>>> |
14 |
>>> diff --git a/eclass/cmake-utils.eclass b/eclass/cmake-utils.eclass |
15 |
>>> index 393ee28..88d2163 100644 |
16 |
>>> --- a/eclass/cmake-utils.eclass |
17 |
>>> +++ b/eclass/cmake-utils.eclass |
18 |
>>> @@ -517,13 +517,10 @@ enable_cmake-utils_src_configure() { |
19 |
>>> |
20 |
>>> includes="<INCLUDES>" |
21 |
>>> |
22 |
>>> fi |
23 |
>>> cat > "${build_rules}" <<- _EOF_ || die |
24 |
>>> |
25 |
>>> - SET (CMAKE_AR $(type -P $(tc-getAR)) CACHE FILEPATH "Archive |
26 |
> manager" |
27 |
>>> FORCE)> |
28 |
>>> SET (CMAKE_ASM_COMPILE_OBJECT "<CMAKE_C_COMPILER> <DEFINES> $ |
29 |
> {includes} |
30 |
>>> ${CFLAGS} <FLAGS> -o <OBJECT> -c <SOURCE>" CACHE STRING "ASM |
31 |
> compile |
32 |
>>> command" FORCE) SET (CMAKE_C_COMPILE_OBJECT "<CMAKE_C_COMPILER> |
33 |
>>> <DEFINES> ${includes} ${CPPFLAGS} <FLAGS> -o <OBJECT> -c |
34 |
> <SOURCE>" |
35 |
>>> CACHE STRING "C compile command" FORCE) SET |
36 |
> (CMAKE_CXX_COMPILE_OBJECT |
37 |
>>> "<CMAKE_CXX_COMPILER> <DEFINES> ${includes} ${CPPFLAGS} <FLAGS> |
38 |
> -o |
39 |
>>> <OBJECT> -c <SOURCE>" CACHE STRING "C++ compile command" FORCE) |
40 |
> SET |
41 |
>>> (CMAKE_Fortran_COMPILE_OBJECT "<CMAKE_Fortran_COMPILER> |
42 |
> <DEFINES> |
43 |
>>> ${includes} ${FCFLAGS} <FLAGS> -o <OBJECT> -c <SOURCE>" CACHE |
44 |
> STRING |
45 |
>>> "Fortran compile command" FORCE)> |
46 |
>>> - SET (CMAKE_RANLIB $(type -P $(tc-getRANLIB)) CACHE FILEPATH |
47 |
> "Archive |
48 |
>>> index generator" FORCE) - SET (PKG_CONFIG_EXECUTABLE $(type -P |
49 |
>>> $(tc-getPKG_CONFIG)) CACHE FILEPATH "pkg-config executable" FORCE)> |
50 |
>>> _EOF_ |
51 |
>>> |
52 |
>>> local toolchain_file=${BUILD_DIR}/gentoo_toolchain.cmake |
53 |
>>> |
54 |
>>> @@ -531,6 +528,8 @@ enable_cmake-utils_src_configure() { |
55 |
>>> |
56 |
>>> SET (CMAKE_C_COMPILER $(tc-getCC)) |
57 |
>>> SET (CMAKE_CXX_COMPILER $(tc-getCXX)) |
58 |
>>> SET (CMAKE_Fortran_COMPILER $(tc-getFC)) |
59 |
>>> |
60 |
>>> + SET (CMAKE_AR $(type -P $(tc-getAR)) CACHE FILEPATH "Archive |
61 |
> manager" |
62 |
>>> FORCE) + SET (CMAKE_RANLIB $(type -P $(tc-getRANLIB)) CACHE FILEPATH |
63 |
>>> "Archive index generator" FORCE)> |
64 |
>>> _EOF_ |
65 |
>>> |
66 |
>>> if tc-is-cross-compiler; then |
67 |
>>> |
68 |
>>> @@ -571,32 +570,29 @@ enable_cmake-utils_src_configure() { |
69 |
>>> |
70 |
>>> # in Prefix we need rpath and must ensure cmake gets our |
71 |
> default |
72 |
>>> linker path # right ... except for Darwin hosts |
73 |
>>> IF (NOT APPLE) |
74 |
>>> |
75 |
>>> - SET (CMAKE_SKIP_RPATH OFF CACHE BOOL "" FORCE) |
76 |
>>> - SET (CMAKE_PLATFORM_REQUIRED_RUNTIME_PATH |
77 |
>>> "${EPREFIX}/usr/${CHOST}/lib/gcc;${EPREFIX}/usr/${CHOST}/lib;${EPREFIX}/u |
78 |
>>> sr/$(get_libdir);${EPREFIX}/$(get_libdir)" - CACHE STRING "" |
79 |
> FORCE) |
80 |
>>> - |
81 |
>>> + SET (CMAKE_SKIP_RPATH OFF CACHE BOOL "" FORCE) |
82 |
>>> + SET (CMAKE_PLATFORM_REQUIRED_RUNTIME_PATH |
83 |
>>> "${EPREFIX}/usr/${CHOST}/lib/gcc;${EPREFIX}/usr/${CHOST}/lib;${EPREFIX}/u |
84 |
>>> sr/$(get_libdir);${EPREFIX}/$(get_libdir)" CACHE STRING "" FORCE)> |
85 |
>>> ELSE () |
86 |
>>> |
87 |
>>> - |
88 |
>>> - SET(CMAKE_PREFIX_PATH "${EPREFIX}${PREFIX}" CACHE STRING "" |
89 |
> FORCE) |
90 |
>>> - SET(CMAKE_SKIP_BUILD_RPATH OFF CACHE BOOL "" FORCE) |
91 |
>>> - SET(CMAKE_SKIP_RPATH OFF CACHE BOOL "" FORCE) |
92 |
>>> - SET(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE CACHE BOOL "") |
93 |
>>> - SET(CMAKE_INSTALL_RPATH |
94 |
>>> "${EPREFIX}${PREFIX}/lib;${EPREFIX}/usr/${CHOST}/lib/gcc;${EPREFIX}/usr/$ |
95 |
>>> {CHOST}/lib;${EPREFIX}/usr/$(get_libdir);${EPREFIX}/$(get_libdir)" CACHE |
96 |
>>> STRING "" FORCE) - SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH |
97 |
> TRUE CACHE |
98 |
>>> BOOL "" FORCE) - SET(CMAKE_INSTALL_NAME_DIR "${EPREFIX}$ |
99 |
> {PREFIX}/lib" |
100 |
>>> CACHE STRING "" FORCE) - |
101 |
>>> + SET(CMAKE_PREFIX_PATH "${EPREFIX}${PREFIX}" CACHE |
102 |
> STRING "" FORCE) |
103 |
>>> + SET(CMAKE_SKIP_BUILD_RPATH OFF CACHE BOOL "" FORCE) |
104 |
>>> + SET(CMAKE_SKIP_RPATH OFF CACHE BOOL "" FORCE) |
105 |
>>> + SET(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE CACHE BOOL "") |
106 |
>>> + SET(CMAKE_INSTALL_RPATH |
107 |
>>> "${EPREFIX}${PREFIX}/lib;${EPREFIX}/usr/${CHOST}/lib/gcc;${EPREFIX}/usr/$ |
108 |
>>> {CHOST}/lib;${EPREFIX}/usr/$(get_libdir);${EPREFIX}/$(get_libdir)" CACHE |
109 |
>>> STRING "" FORCE) + SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH |
110 |
> TRUE CACHE |
111 |
>>> BOOL "" FORCE) + SET(CMAKE_INSTALL_NAME_DIR "${EPREFIX}$ |
112 |
> {PREFIX}/lib" |
113 |
>>> CACHE STRING "" FORCE)> |
114 |
>>> ENDIF (NOT APPLE) |
115 |
>>> |
116 |
>>> _EOF_ |
117 |
>>> |
118 |
>>> fi |
119 |
>>> |
120 |
>>> # Common configure parameters (invariants) |
121 |
>>> |
122 |
>>> - local common_config=${BUILD_DIR}/gentoo_common_config.cmake |
123 |
>>> |
124 |
>>> local libdir=$(get_libdir) |
125 |
>>> |
126 |
>>> - cat > "${common_config}" <<- _EOF_ || die |
127 |
>>> - SET (LIB_SUFFIX ${libdir/lib} CACHE STRING "library path suffix" |
128 |
> FORCE) |
129 |
>>> - SET (CMAKE_INSTALL_LIBDIR ${libdir} CACHE PATH "Output directory |
130 |
> for |
131 |
>>> libraries") - _EOF_ |
132 |
>>> - [[ "${NOCOLOR}" = true || "${NOCOLOR}" = yes ]] && echo 'SET |
133 |
>>> (CMAKE_COLOR_MAKEFILE OFF CACHE BOOL "pretty colors during make" FORCE)' |
134 |
>>>>> "${common_config}" + local cmakeargs=( |
135 |
>>> + -DLIB_SUFFIX="${libdir/lib}" |
136 |
>>> + -DCMAKE_INSTALL_LIBDIR="${libdir}" |
137 |
>>> + -DPKG_CONFIG_EXECUTABLE="$(type -P $(tc-getPKG_CONFIG))" |
138 |
>>> + -DCMAKE_USER_MAKE_RULES_OVERRIDE="${build_rules}" |
139 |
>>> + -DCMAKE_TOOLCHAIN_FILE="${toolchain_file}" |
140 |
>>> + ) |
141 |
>> |
142 |
>> Wasn't the point of using a config file to avoid warnings when the |
143 |
>> variables aren't used? |
144 |
> |
145 |
> Nah, config file was there even before CMake supported warning about unused |
146 |
> variables (or at least definitely long before we enabled it in eclass). |
147 |
> The problem _I_ have with config file is that its contents is not visible in |
148 |
> build log. |
149 |
> Though I admit extra warnings are not nice. |
150 |
> -D PKG_CONFIG_EXECUTABLE could be replaced with PKG_CONFIG env var. |
151 |
> But LIB_SUFFIX is some KDE early invention, populated in kde-related projects |
152 |
> (otherwise GNUInstallDirs should be used or manually setting |
153 |
> CMAKE_INSTALL_LIBDIR). |
154 |
> Not sure whether config file is worth having to eliminate one or two CMake |
155 |
> warnings, let's see what others think. |
156 |
> |
157 |
|
158 |
Unless there's a plan to eventually stop passing them unconditionally, I |
159 |
would prefer not to introduce unused variable warnings everywhere. |
160 |
|
161 |
If you're concerned about these not being visible in the build log, we |
162 |
could extend the existing "Gentoo configuration" message appended to |
163 |
every package to include the missing values. |