Gentoo Archives: gentoo-commits

From: Johannes Huber <johu@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/kde:master commit in: eclass/
Date: Fri, 23 Dec 2016 09:02:08
Message-Id: 1482483700.ed52c23f305de6b6e307be23659649ddc95ec996.johu@gentoo
1 commit: ed52c23f305de6b6e307be23659649ddc95ec996
2 Author: Johannes Huber <johu <AT> gentoo <DOT> org>
3 AuthorDate: Fri Dec 23 09:01:40 2016 +0000
4 Commit: Johannes Huber <johu <AT> gentoo <DOT> org>
5 CommitDate: Fri Dec 23 09:01:40 2016 +0000
6 URL: https://gitweb.gentoo.org/proj/kde.git/commit/?id=ed52c23f
7
8 cmake-utils.eclass: Sync with gentoo main tree
9
10 eclass/cmake-utils.eclass | 40 +++++++++++++++++++++++++++++++++-------
11 1 file changed, 33 insertions(+), 7 deletions(-)
12
13 diff --git a/eclass/cmake-utils.eclass b/eclass/cmake-utils.eclass
14 index 393ee28..1fddae1 100644
15 --- a/eclass/cmake-utils.eclass
16 +++ b/eclass/cmake-utils.eclass
17 @@ -517,22 +517,33 @@ enable_cmake-utils_src_configure() {
18 includes="<INCLUDES>"
19 fi
20 cat > "${build_rules}" <<- _EOF_ || die
21 - SET (CMAKE_AR $(type -P $(tc-getAR)) CACHE FILEPATH "Archive manager" FORCE)
22 - SET (CMAKE_ASM_COMPILE_OBJECT "<CMAKE_C_COMPILER> <DEFINES> ${includes} ${CFLAGS} <FLAGS> -o <OBJECT> -c <SOURCE>" CACHE STRING "ASM compile command" FORCE)
23 + SET (CMAKE_ASM_COMPILE_OBJECT "<CMAKE_ASM_COMPILER> <DEFINES> ${includes} ${CPPFLAGS} <FLAGS> -o <OBJECT> -c <SOURCE>" CACHE STRING "ASM compile command" FORCE)
24 SET (CMAKE_C_COMPILE_OBJECT "<CMAKE_C_COMPILER> <DEFINES> ${includes} ${CPPFLAGS} <FLAGS> -o <OBJECT> -c <SOURCE>" CACHE STRING "C compile command" FORCE)
25 SET (CMAKE_CXX_COMPILE_OBJECT "<CMAKE_CXX_COMPILER> <DEFINES> ${includes} ${CPPFLAGS} <FLAGS> -o <OBJECT> -c <SOURCE>" CACHE STRING "C++ compile command" FORCE)
26 SET (CMAKE_Fortran_COMPILE_OBJECT "<CMAKE_Fortran_COMPILER> <DEFINES> ${includes} ${FCFLAGS} <FLAGS> -o <OBJECT> -c <SOURCE>" CACHE STRING "Fortran compile command" FORCE)
27 - SET (CMAKE_RANLIB $(type -P $(tc-getRANLIB)) CACHE FILEPATH "Archive index generator" FORCE)
28 - SET (PKG_CONFIG_EXECUTABLE $(type -P $(tc-getPKG_CONFIG)) CACHE FILEPATH "pkg-config executable" FORCE)
29 _EOF_
30
31 + local myCC=$(tc-getCC) myCXX=$(tc-getCXX) myFC=$(tc-getFC)
32 +
33 + # !!! IMPORTANT NOTE !!!
34 + # Single slash below is intentional. CMake is weird and wants the
35 + # CMAKE_*_VARIABLES split into two elements: the first one with
36 + # compiler path, and the second one with all command-line options,
37 + # space separated.
38 local toolchain_file=${BUILD_DIR}/gentoo_toolchain.cmake
39 cat > ${toolchain_file} <<- _EOF_ || die
40 - SET (CMAKE_C_COMPILER $(tc-getCC))
41 - SET (CMAKE_CXX_COMPILER $(tc-getCXX))
42 - SET (CMAKE_Fortran_COMPILER $(tc-getFC))
43 + SET (CMAKE_ASM_COMPILER "${myCC/ /;}")
44 + SET (CMAKE_C_COMPILER "${myCC/ /;}")
45 + SET (CMAKE_CXX_COMPILER "${myCXX/ /;}")
46 + SET (CMAKE_Fortran_COMPILER "${myFC/ /;}")
47 + SET (CMAKE_AR $(type -P $(tc-getAR)) CACHE FILEPATH "Archive manager" FORCE)
48 + SET (CMAKE_RANLIB $(type -P $(tc-getRANLIB)) CACHE FILEPATH "Archive index generator" FORCE)
49 _EOF_
50
51 + # We are using the C compiler for assembly by default.
52 + local -x ASMFLAGS=${CFLAGS}
53 + local -x PKG_CONFIG=$(tc-getPKG_CONFIG)
54 +
55 if tc-is-cross-compiler; then
56 local sysname
57 case "${KERNEL:-linux}" in
58 @@ -593,11 +604,26 @@ enable_cmake-utils_src_configure() {
59 local common_config=${BUILD_DIR}/gentoo_common_config.cmake
60 local libdir=$(get_libdir)
61 cat > "${common_config}" <<- _EOF_ || die
62 + SET (CMAKE_GENTOO_BUILD ON CACHE BOOL "Indicate Gentoo package build")
63 SET (LIB_SUFFIX ${libdir/lib} CACHE STRING "library path suffix" FORCE)
64 SET (CMAKE_INSTALL_LIBDIR ${libdir} CACHE PATH "Output directory for libraries")
65 _EOF_
66 [[ "${NOCOLOR}" = true || "${NOCOLOR}" = yes ]] && echo 'SET (CMAKE_COLOR_MAKEFILE OFF CACHE BOOL "pretty colors during make" FORCE)' >> "${common_config}"
67
68 + # Wipe the default optimization flags out of CMake
69 + if [[ ${CMAKE_BUILD_TYPE} != Gentoo ]] && ! has "${EAPI}" 2 3 4 5; then
70 + cat >> ${common_config} <<- _EOF_ || die
71 + SET (CMAKE_ASM_FLAGS_${CMAKE_BUILD_TYPE^^} "" CACHE STRING "")
72 + SET (CMAKE_C_FLAGS_${CMAKE_BUILD_TYPE^^} "" CACHE STRING "")
73 + SET (CMAKE_CXX_FLAGS_${CMAKE_BUILD_TYPE^^} "" CACHE STRING "")
74 + SET (CMAKE_Fortran_FLAGS_${CMAKE_BUILD_TYPE^^} "" CACHE STRING "")
75 + SET (CMAKE_EXE_LINKER_FLAGS_${CMAKE_BUILD_TYPE^^} "" CACHE STRING "")
76 + SET (CMAKE_MODULE_LINKER_FLAGS_${CMAKE_BUILD_TYPE^^} "" CACHE STRING "")
77 + SET (CMAKE_SHARED_LINKER_FLAGS_${CMAKE_BUILD_TYPE^^} "" CACHE STRING "")
78 + SET (CMAKE_STATIC_LINKER_FLAGS_${CMAKE_BUILD_TYPE^^} "" CACHE STRING "")
79 + _EOF_
80 + fi
81 +
82 # Convert mycmakeargs to an array, for backwards compatibility
83 # Make the array a local variable since <=portage-2.1.6.x does not
84 # support global arrays (see bug #297255).