public inbox for gentoo-dev@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-dev] [PATCH 0/2] cmake-utils small rework + bug 542530
@ 2016-11-02 23:52 Maciej Mrozowski
  2016-11-02 23:52 ` [gentoo-dev] [PATCH 1/2] cmake-utils.eclass: CMake argument passing rework - clean build_rules and toolchain_file files from unrelated stuff (pass to CMake directly) - move some invariant CMake options actually to invariants parts - eliminate common_config (pass to CMake directly) for better transparency Maciej Mrozowski
  2016-11-02 23:52 ` [gentoo-dev] [PATCH 2/2] cmake-utils.eclass: export compilers to environment instead of setting in toolchain file, bug 542530 Maciej Mrozowski
  0 siblings, 2 replies; 11+ messages in thread
From: Maciej Mrozowski @ 2016-11-02 23:52 UTC (permalink / raw
  To: gentoo-dev

From: Maciej Mrozowski <reavertm@gentoo.org>

Bummer, let me start it properly again, this time sending to reachable address.

Maciej Mrozowski (2):
  cmake-utils.eclass: CMake argument passing rework     - clean
    build_rules and toolchain_file files from unrelated stuff (pass to
    CMake directly)     - move some invariant CMake options actually to
    invariants parts     - eliminate common_config (pass to CMake
    directly) for better transparency
  cmake-utils.eclass: export compilers to environment instead of setting
    in toolchain file, bug 542530

 eclass/cmake-utils.eclass | 60 +++++++++++++++++++----------------------------
 1 file changed, 24 insertions(+), 36 deletions(-)

-- 
2.7.3



^ permalink raw reply	[flat|nested] 11+ messages in thread

* [gentoo-dev] [PATCH 1/2] cmake-utils.eclass: CMake argument passing rework - clean build_rules and toolchain_file files from unrelated stuff (pass to CMake directly) - move some invariant CMake options actually to invariants parts - eliminate common_config (pass to CMake directly) for better transparency
  2016-11-02 23:52 [gentoo-dev] [PATCH 0/2] cmake-utils small rework + bug 542530 Maciej Mrozowski
@ 2016-11-02 23:52 ` Maciej Mrozowski
  2016-11-03  6:31   ` Michał Górny
  2016-11-02 23:52 ` [gentoo-dev] [PATCH 2/2] cmake-utils.eclass: export compilers to environment instead of setting in toolchain file, bug 542530 Maciej Mrozowski
  1 sibling, 1 reply; 11+ messages in thread
From: Maciej Mrozowski @ 2016-11-02 23:52 UTC (permalink / raw
  To: gentoo-dev

From: Maciej Mrozowski <reavertm@gentoo.org>

---
 eclass/cmake-utils.eclass | 54 ++++++++++++++++++-----------------------------
 1 file changed, 21 insertions(+), 33 deletions(-)

diff --git a/eclass/cmake-utils.eclass b/eclass/cmake-utils.eclass
index 393ee28..88d2163 100644
--- a/eclass/cmake-utils.eclass
+++ b/eclass/cmake-utils.eclass
@@ -517,13 +517,10 @@ enable_cmake-utils_src_configure() {
 		includes="<INCLUDES>"
 	fi
 	cat > "${build_rules}" <<- _EOF_ || die
-		SET (CMAKE_AR $(type -P $(tc-getAR)) CACHE FILEPATH "Archive manager" FORCE)
 		SET (CMAKE_ASM_COMPILE_OBJECT "<CMAKE_C_COMPILER> <DEFINES> ${includes} ${CFLAGS} <FLAGS> -o <OBJECT> -c <SOURCE>" CACHE STRING "ASM compile command" FORCE)
 		SET (CMAKE_C_COMPILE_OBJECT "<CMAKE_C_COMPILER> <DEFINES> ${includes} ${CPPFLAGS} <FLAGS> -o <OBJECT> -c <SOURCE>" CACHE STRING "C compile command" FORCE)
 		SET (CMAKE_CXX_COMPILE_OBJECT "<CMAKE_CXX_COMPILER> <DEFINES> ${includes} ${CPPFLAGS} <FLAGS> -o <OBJECT> -c <SOURCE>" CACHE STRING "C++ compile command" FORCE)
 		SET (CMAKE_Fortran_COMPILE_OBJECT "<CMAKE_Fortran_COMPILER> <DEFINES> ${includes} ${FCFLAGS} <FLAGS> -o <OBJECT> -c <SOURCE>" CACHE STRING "Fortran compile command" FORCE)
-		SET (CMAKE_RANLIB $(type -P $(tc-getRANLIB)) CACHE FILEPATH "Archive index generator" FORCE)
-		SET (PKG_CONFIG_EXECUTABLE $(type -P $(tc-getPKG_CONFIG)) CACHE FILEPATH "pkg-config executable" FORCE)
 	_EOF_
 
 	local toolchain_file=${BUILD_DIR}/gentoo_toolchain.cmake
@@ -531,6 +528,8 @@ enable_cmake-utils_src_configure() {
 		SET (CMAKE_C_COMPILER $(tc-getCC))
 		SET (CMAKE_CXX_COMPILER $(tc-getCXX))
 		SET (CMAKE_Fortran_COMPILER $(tc-getFC))
+		SET (CMAKE_AR $(type -P $(tc-getAR)) CACHE FILEPATH "Archive manager" FORCE)
+		SET (CMAKE_RANLIB $(type -P $(tc-getRANLIB)) CACHE FILEPATH "Archive index generator" FORCE)
 	_EOF_
 
 	if tc-is-cross-compiler; then
@@ -571,32 +570,29 @@ enable_cmake-utils_src_configure() {
 			# in Prefix we need rpath and must ensure cmake gets our default linker path
 			# right ... except for Darwin hosts
 			IF (NOT APPLE)
-			SET (CMAKE_SKIP_RPATH OFF CACHE BOOL "" FORCE)
-			SET (CMAKE_PLATFORM_REQUIRED_RUNTIME_PATH "${EPREFIX}/usr/${CHOST}/lib/gcc;${EPREFIX}/usr/${CHOST}/lib;${EPREFIX}/usr/$(get_libdir);${EPREFIX}/$(get_libdir)"
-			CACHE STRING "" FORCE)
-
+				SET (CMAKE_SKIP_RPATH OFF CACHE BOOL "" FORCE)
+				SET (CMAKE_PLATFORM_REQUIRED_RUNTIME_PATH "${EPREFIX}/usr/${CHOST}/lib/gcc;${EPREFIX}/usr/${CHOST}/lib;${EPREFIX}/usr/$(get_libdir);${EPREFIX}/$(get_libdir)" CACHE STRING "" FORCE)
 			ELSE ()
-
-			SET(CMAKE_PREFIX_PATH "${EPREFIX}${PREFIX}" CACHE STRING "" FORCE)
-			SET(CMAKE_SKIP_BUILD_RPATH OFF CACHE BOOL "" FORCE)
-			SET(CMAKE_SKIP_RPATH OFF CACHE BOOL "" FORCE)
-			SET(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE CACHE BOOL "")
-			SET(CMAKE_INSTALL_RPATH "${EPREFIX}${PREFIX}/lib;${EPREFIX}/usr/${CHOST}/lib/gcc;${EPREFIX}/usr/${CHOST}/lib;${EPREFIX}/usr/$(get_libdir);${EPREFIX}/$(get_libdir)" CACHE STRING "" FORCE)
-			SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE CACHE BOOL "" FORCE)
-			SET(CMAKE_INSTALL_NAME_DIR "${EPREFIX}${PREFIX}/lib" CACHE STRING "" FORCE)
-
+				SET(CMAKE_PREFIX_PATH "${EPREFIX}${PREFIX}" CACHE STRING "" FORCE)
+				SET(CMAKE_SKIP_BUILD_RPATH OFF CACHE BOOL "" FORCE)
+				SET(CMAKE_SKIP_RPATH OFF CACHE BOOL "" FORCE)
+				SET(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE CACHE BOOL "")
+				SET(CMAKE_INSTALL_RPATH "${EPREFIX}${PREFIX}/lib;${EPREFIX}/usr/${CHOST}/lib/gcc;${EPREFIX}/usr/${CHOST}/lib;${EPREFIX}/usr/$(get_libdir);${EPREFIX}/$(get_libdir)" CACHE STRING "" FORCE)
+				SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE CACHE BOOL "" FORCE)
+				SET(CMAKE_INSTALL_NAME_DIR "${EPREFIX}${PREFIX}/lib" CACHE STRING "" FORCE)
 			ENDIF (NOT APPLE)
 		_EOF_
 	fi
 
 	# Common configure parameters (invariants)
-	local common_config=${BUILD_DIR}/gentoo_common_config.cmake
 	local libdir=$(get_libdir)
-	cat > "${common_config}" <<- _EOF_ || die
-		SET (LIB_SUFFIX ${libdir/lib} CACHE STRING "library path suffix" FORCE)
-		SET (CMAKE_INSTALL_LIBDIR ${libdir} CACHE PATH "Output directory for libraries")
-	_EOF_
-	[[ "${NOCOLOR}" = true || "${NOCOLOR}" = yes ]] && echo 'SET (CMAKE_COLOR_MAKEFILE OFF CACHE BOOL "pretty colors during make" FORCE)' >> "${common_config}"
+	local cmakeargs=(
+		-DLIB_SUFFIX="${libdir/lib}"
+		-DCMAKE_INSTALL_LIBDIR="${libdir}"
+		-DPKG_CONFIG_EXECUTABLE="$(type -P $(tc-getPKG_CONFIG))"
+		-DCMAKE_USER_MAKE_RULES_OVERRIDE="${build_rules}"
+		-DCMAKE_TOOLCHAIN_FILE="${toolchain_file}"
+	)
 
 	# Convert mycmakeargs to an array, for backwards compatibility
 	# Make the array a local variable since <=portage-2.1.6.x does not
@@ -615,25 +611,17 @@ enable_cmake-utils_src_configure() {
 		local mycmakeargs_local=("${mycmakeargs[@]}")
 	fi
 
-	if [[ ${CMAKE_WARN_UNUSED_CLI} == no ]] ; then
-		local warn_unused_cli="--no-warn-unused-cli"
-	else
-		local warn_unused_cli=""
-	fi
-
 	# Common configure parameters (overridable)
 	# NOTE CMAKE_BUILD_TYPE can be only overriden via CMAKE_BUILD_TYPE eclass variable
 	# No -DCMAKE_BUILD_TYPE=xxx definitions will be in effect.
-	local cmakeargs=(
-		${warn_unused_cli}
-		-C "${common_config}"
+	cmakeargs+=(
+		$([[ ${CMAKE_WARN_UNUSED_CLI} == no ]] && echo --no-warn-unused-cli)
+		$([[ "${NOCOLOR}" = true || "${NOCOLOR}" = yes ]] && echo -DCMAKE_COLOR_MAKEFILE=OFF)
 		-G "$(_cmake_generator_to_use)"
 		-DCMAKE_INSTALL_PREFIX="${EPREFIX}${PREFIX}"
 		"${mycmakeargs_local[@]}"
 		-DCMAKE_BUILD_TYPE="${CMAKE_BUILD_TYPE}"
 		$([[ ${EAPI} == [2345] ]] && echo -DCMAKE_INSTALL_DO_STRIP=OFF)
-		-DCMAKE_USER_MAKE_RULES_OVERRIDE="${build_rules}"
-		-DCMAKE_TOOLCHAIN_FILE="${toolchain_file}"
 		"${MYCMAKEARGS}"
 	)
 
-- 
2.7.3



^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [gentoo-dev] [PATCH 2/2] cmake-utils.eclass: export compilers to environment instead of setting in toolchain file, bug 542530
  2016-11-02 23:52 [gentoo-dev] [PATCH 0/2] cmake-utils small rework + bug 542530 Maciej Mrozowski
  2016-11-02 23:52 ` [gentoo-dev] [PATCH 1/2] cmake-utils.eclass: CMake argument passing rework - clean build_rules and toolchain_file files from unrelated stuff (pass to CMake directly) - move some invariant CMake options actually to invariants parts - eliminate common_config (pass to CMake directly) for better transparency Maciej Mrozowski
@ 2016-11-02 23:52 ` Maciej Mrozowski
  2016-11-04 12:20   ` Alexis Ballier
  1 sibling, 1 reply; 11+ messages in thread
From: Maciej Mrozowski @ 2016-11-02 23:52 UTC (permalink / raw
  To: gentoo-dev

From: Maciej Mrozowski <reavertm@gentoo.org>

---
 eclass/cmake-utils.eclass | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/eclass/cmake-utils.eclass b/eclass/cmake-utils.eclass
index 88d2163..23cc094 100644
--- a/eclass/cmake-utils.eclass
+++ b/eclass/cmake-utils.eclass
@@ -525,13 +525,13 @@ enable_cmake-utils_src_configure() {
 
 	local toolchain_file=${BUILD_DIR}/gentoo_toolchain.cmake
 	cat > ${toolchain_file} <<- _EOF_ || die
-		SET (CMAKE_C_COMPILER $(tc-getCC))
-		SET (CMAKE_CXX_COMPILER $(tc-getCXX))
-		SET (CMAKE_Fortran_COMPILER $(tc-getFC))
 		SET (CMAKE_AR $(type -P $(tc-getAR)) CACHE FILEPATH "Archive manager" FORCE)
 		SET (CMAKE_RANLIB $(type -P $(tc-getRANLIB)) CACHE FILEPATH "Archive index generator" FORCE)
 	_EOF_
 
+	# Bug 542530, export those instead of setting paths in toolchain file
+	local -x CC=$(tc-getCC) CXX=$(tc-getCXX) FC=$(tc-getFC)
+
 	if tc-is-cross-compiler; then
 		local sysname
 		case "${KERNEL:-linux}" in
-- 
2.7.3



^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: [gentoo-dev] [PATCH 1/2] cmake-utils.eclass: CMake argument passing rework - clean build_rules and toolchain_file files from unrelated stuff (pass to CMake directly) - move some invariant CMake options actually to invariants parts - eliminate common_config (pass to CMake directly) for better transparency
  2016-11-02 23:52 ` [gentoo-dev] [PATCH 1/2] cmake-utils.eclass: CMake argument passing rework - clean build_rules and toolchain_file files from unrelated stuff (pass to CMake directly) - move some invariant CMake options actually to invariants parts - eliminate common_config (pass to CMake directly) for better transparency Maciej Mrozowski
@ 2016-11-03  6:31   ` Michał Górny
  2016-11-04  0:55     ` Maciej Mrozowski
  0 siblings, 1 reply; 11+ messages in thread
From: Michał Górny @ 2016-11-03  6:31 UTC (permalink / raw
  To: Maciej Mrozowski; +Cc: gentoo-dev

[-- Attachment #1: Type: text/plain, Size: 6291 bytes --]

On Thu,  3 Nov 2016 00:52:16 +0100
Maciej Mrozowski <reavertm@gmail.com> wrote:

> From: Maciej Mrozowski <reavertm@gentoo.org>
> 
> ---
>  eclass/cmake-utils.eclass | 54 ++++++++++++++++++-----------------------------
>  1 file changed, 21 insertions(+), 33 deletions(-)
> 
> diff --git a/eclass/cmake-utils.eclass b/eclass/cmake-utils.eclass
> index 393ee28..88d2163 100644
> --- a/eclass/cmake-utils.eclass
> +++ b/eclass/cmake-utils.eclass
> @@ -517,13 +517,10 @@ enable_cmake-utils_src_configure() {
>  		includes="<INCLUDES>"
>  	fi
>  	cat > "${build_rules}" <<- _EOF_ || die
> -		SET (CMAKE_AR $(type -P $(tc-getAR)) CACHE FILEPATH "Archive manager" FORCE)
>  		SET (CMAKE_ASM_COMPILE_OBJECT "<CMAKE_C_COMPILER> <DEFINES> ${includes} ${CFLAGS} <FLAGS> -o <OBJECT> -c <SOURCE>" CACHE STRING "ASM compile command" FORCE)
>  		SET (CMAKE_C_COMPILE_OBJECT "<CMAKE_C_COMPILER> <DEFINES> ${includes} ${CPPFLAGS} <FLAGS> -o <OBJECT> -c <SOURCE>" CACHE STRING "C compile command" FORCE)
>  		SET (CMAKE_CXX_COMPILE_OBJECT "<CMAKE_CXX_COMPILER> <DEFINES> ${includes} ${CPPFLAGS} <FLAGS> -o <OBJECT> -c <SOURCE>" CACHE STRING "C++ compile command" FORCE)
>  		SET (CMAKE_Fortran_COMPILE_OBJECT "<CMAKE_Fortran_COMPILER> <DEFINES> ${includes} ${FCFLAGS} <FLAGS> -o <OBJECT> -c <SOURCE>" CACHE STRING "Fortran compile command" FORCE)
> -		SET (CMAKE_RANLIB $(type -P $(tc-getRANLIB)) CACHE FILEPATH "Archive index generator" FORCE)
> -		SET (PKG_CONFIG_EXECUTABLE $(type -P $(tc-getPKG_CONFIG)) CACHE FILEPATH "pkg-config executable" FORCE)
>  	_EOF_
>  
>  	local toolchain_file=${BUILD_DIR}/gentoo_toolchain.cmake
> @@ -531,6 +528,8 @@ enable_cmake-utils_src_configure() {
>  		SET (CMAKE_C_COMPILER $(tc-getCC))
>  		SET (CMAKE_CXX_COMPILER $(tc-getCXX))
>  		SET (CMAKE_Fortran_COMPILER $(tc-getFC))
> +		SET (CMAKE_AR $(type -P $(tc-getAR)) CACHE FILEPATH "Archive manager" FORCE)
> +		SET (CMAKE_RANLIB $(type -P $(tc-getRANLIB)) CACHE FILEPATH "Archive index generator" FORCE)
>  	_EOF_
>  
>  	if tc-is-cross-compiler; then
> @@ -571,32 +570,29 @@ enable_cmake-utils_src_configure() {
>  			# in Prefix we need rpath and must ensure cmake gets our default linker path
>  			# right ... except for Darwin hosts
>  			IF (NOT APPLE)
> -			SET (CMAKE_SKIP_RPATH OFF CACHE BOOL "" FORCE)
> -			SET (CMAKE_PLATFORM_REQUIRED_RUNTIME_PATH "${EPREFIX}/usr/${CHOST}/lib/gcc;${EPREFIX}/usr/${CHOST}/lib;${EPREFIX}/usr/$(get_libdir);${EPREFIX}/$(get_libdir)"
> -			CACHE STRING "" FORCE)
> -
> +				SET (CMAKE_SKIP_RPATH OFF CACHE BOOL "" FORCE)
> +				SET (CMAKE_PLATFORM_REQUIRED_RUNTIME_PATH "${EPREFIX}/usr/${CHOST}/lib/gcc;${EPREFIX}/usr/${CHOST}/lib;${EPREFIX}/usr/$(get_libdir);${EPREFIX}/$(get_libdir)" CACHE STRING "" FORCE)
>  			ELSE ()
> -
> -			SET(CMAKE_PREFIX_PATH "${EPREFIX}${PREFIX}" CACHE STRING "" FORCE)
> -			SET(CMAKE_SKIP_BUILD_RPATH OFF CACHE BOOL "" FORCE)
> -			SET(CMAKE_SKIP_RPATH OFF CACHE BOOL "" FORCE)
> -			SET(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE CACHE BOOL "")
> -			SET(CMAKE_INSTALL_RPATH "${EPREFIX}${PREFIX}/lib;${EPREFIX}/usr/${CHOST}/lib/gcc;${EPREFIX}/usr/${CHOST}/lib;${EPREFIX}/usr/$(get_libdir);${EPREFIX}/$(get_libdir)" CACHE STRING "" FORCE)
> -			SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE CACHE BOOL "" FORCE)
> -			SET(CMAKE_INSTALL_NAME_DIR "${EPREFIX}${PREFIX}/lib" CACHE STRING "" FORCE)
> -
> +				SET(CMAKE_PREFIX_PATH "${EPREFIX}${PREFIX}" CACHE STRING "" FORCE)
> +				SET(CMAKE_SKIP_BUILD_RPATH OFF CACHE BOOL "" FORCE)
> +				SET(CMAKE_SKIP_RPATH OFF CACHE BOOL "" FORCE)
> +				SET(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE CACHE BOOL "")
> +				SET(CMAKE_INSTALL_RPATH "${EPREFIX}${PREFIX}/lib;${EPREFIX}/usr/${CHOST}/lib/gcc;${EPREFIX}/usr/${CHOST}/lib;${EPREFIX}/usr/$(get_libdir);${EPREFIX}/$(get_libdir)" CACHE STRING "" FORCE)
> +				SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE CACHE BOOL "" FORCE)
> +				SET(CMAKE_INSTALL_NAME_DIR "${EPREFIX}${PREFIX}/lib" CACHE STRING "" FORCE)
>  			ENDIF (NOT APPLE)
>  		_EOF_
>  	fi
>  
>  	# Common configure parameters (invariants)
> -	local common_config=${BUILD_DIR}/gentoo_common_config.cmake
>  	local libdir=$(get_libdir)
> -	cat > "${common_config}" <<- _EOF_ || die
> -		SET (LIB_SUFFIX ${libdir/lib} CACHE STRING "library path suffix" FORCE)
> -		SET (CMAKE_INSTALL_LIBDIR ${libdir} CACHE PATH "Output directory for libraries")
> -	_EOF_
> -	[[ "${NOCOLOR}" = true || "${NOCOLOR}" = yes ]] && echo 'SET (CMAKE_COLOR_MAKEFILE OFF CACHE BOOL "pretty colors during make" FORCE)' >> "${common_config}"
> +	local cmakeargs=(
> +		-DLIB_SUFFIX="${libdir/lib}"
> +		-DCMAKE_INSTALL_LIBDIR="${libdir}"
> +		-DPKG_CONFIG_EXECUTABLE="$(type -P $(tc-getPKG_CONFIG))"
> +		-DCMAKE_USER_MAKE_RULES_OVERRIDE="${build_rules}"
> +		-DCMAKE_TOOLCHAIN_FILE="${toolchain_file}"
> +	)

Wasn't the point of using a config file to avoid warnings when the
variables aren't used?

>  
>  	# Convert mycmakeargs to an array, for backwards compatibility
>  	# Make the array a local variable since <=portage-2.1.6.x does not
> @@ -615,25 +611,17 @@ enable_cmake-utils_src_configure() {
>  		local mycmakeargs_local=("${mycmakeargs[@]}")
>  	fi
>  
> -	if [[ ${CMAKE_WARN_UNUSED_CLI} == no ]] ; then
> -		local warn_unused_cli="--no-warn-unused-cli"
> -	else
> -		local warn_unused_cli=""
> -	fi
> -
>  	# Common configure parameters (overridable)
>  	# NOTE CMAKE_BUILD_TYPE can be only overriden via CMAKE_BUILD_TYPE eclass variable
>  	# No -DCMAKE_BUILD_TYPE=xxx definitions will be in effect.
> -	local cmakeargs=(
> -		${warn_unused_cli}
> -		-C "${common_config}"
> +	cmakeargs+=(
> +		$([[ ${CMAKE_WARN_UNUSED_CLI} == no ]] && echo --no-warn-unused-cli)
> +		$([[ "${NOCOLOR}" = true || "${NOCOLOR}" = yes ]] && echo -DCMAKE_COLOR_MAKEFILE=OFF)
>  		-G "$(_cmake_generator_to_use)"
>  		-DCMAKE_INSTALL_PREFIX="${EPREFIX}${PREFIX}"
>  		"${mycmakeargs_local[@]}"
>  		-DCMAKE_BUILD_TYPE="${CMAKE_BUILD_TYPE}"
>  		$([[ ${EAPI} == [2345] ]] && echo -DCMAKE_INSTALL_DO_STRIP=OFF)
> -		-DCMAKE_USER_MAKE_RULES_OVERRIDE="${build_rules}"
> -		-DCMAKE_TOOLCHAIN_FILE="${toolchain_file}"
>  		"${MYCMAKEARGS}"
>  	)
>  



-- 
Best regards,
Michał Górny
<http://dev.gentoo.org/~mgorny/>

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 931 bytes --]

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [gentoo-dev] [PATCH 1/2] cmake-utils.eclass: CMake argument passing rework - clean build_rules and toolchain_file files from unrelated stuff (pass to CMake directly) - move some invariant CMake options actually to invariants parts - eliminate common_config (pass to CMake directly) for better transparency
  2016-11-03  6:31   ` Michał Górny
@ 2016-11-04  0:55     ` Maciej Mrozowski
  2016-11-04 16:19       ` [gentoo-dev] " Michael Palimaka
  0 siblings, 1 reply; 11+ messages in thread
From: Maciej Mrozowski @ 2016-11-04  0:55 UTC (permalink / raw
  To: gentoo-dev

[-- Attachment #1: Type: text/plain, Size: 6118 bytes --]

On czwartek, 3 listopada 2016 07:31:10 CET Michał Górny wrote:
> On Thu,  3 Nov 2016 00:52:16 +0100
> 
> Maciej Mrozowski <reavertm@gmail.com> wrote:
> > From: Maciej Mrozowski <reavertm@gentoo.org>
> > 
> > ---
> > 
> >  eclass/cmake-utils.eclass | 54
> >  ++++++++++++++++++----------------------------- 1 file changed, 21
> >  insertions(+), 33 deletions(-)
> > 
> > diff --git a/eclass/cmake-utils.eclass b/eclass/cmake-utils.eclass
> > index 393ee28..88d2163 100644
> > --- a/eclass/cmake-utils.eclass
> > +++ b/eclass/cmake-utils.eclass
> > @@ -517,13 +517,10 @@ enable_cmake-utils_src_configure() {
> > 
> >  		includes="<INCLUDES>"
> >  	
> >  	fi
> >  	cat > "${build_rules}" <<- _EOF_ || die
> > 
> > -		SET (CMAKE_AR $(type -P $(tc-getAR)) CACHE FILEPATH "Archive 
manager"
> > FORCE)> 
> >  		SET (CMAKE_ASM_COMPILE_OBJECT "<CMAKE_C_COMPILER> <DEFINES> $
{includes}
> >  		${CFLAGS} <FLAGS> -o <OBJECT> -c <SOURCE>" CACHE STRING "ASM 
compile
> >  		command" FORCE) SET (CMAKE_C_COMPILE_OBJECT "<CMAKE_C_COMPILER>
> >  		<DEFINES> ${includes} ${CPPFLAGS} <FLAGS> -o <OBJECT> -c 
<SOURCE>"
> >  		CACHE STRING "C compile command" FORCE) SET 
(CMAKE_CXX_COMPILE_OBJECT
> >  		"<CMAKE_CXX_COMPILER> <DEFINES> ${includes} ${CPPFLAGS} <FLAGS> 
-o
> >  		<OBJECT> -c <SOURCE>" CACHE STRING "C++ compile command" FORCE) 
SET
> >  		(CMAKE_Fortran_COMPILE_OBJECT "<CMAKE_Fortran_COMPILER> 
<DEFINES>
> >  		${includes} ${FCFLAGS} <FLAGS> -o <OBJECT> -c <SOURCE>" CACHE 
STRING
> >  		"Fortran compile command" FORCE)> 
> > -		SET (CMAKE_RANLIB $(type -P $(tc-getRANLIB)) CACHE FILEPATH 
"Archive
> > index generator" FORCE) -		SET (PKG_CONFIG_EXECUTABLE $(type -P
> > $(tc-getPKG_CONFIG)) CACHE FILEPATH "pkg-config executable" FORCE)> 
> >  	_EOF_
> >  	
> >  	local toolchain_file=${BUILD_DIR}/gentoo_toolchain.cmake
> > 
> > @@ -531,6 +528,8 @@ enable_cmake-utils_src_configure() {
> > 
> >  		SET (CMAKE_C_COMPILER $(tc-getCC))
> >  		SET (CMAKE_CXX_COMPILER $(tc-getCXX))
> >  		SET (CMAKE_Fortran_COMPILER $(tc-getFC))
> > 
> > +		SET (CMAKE_AR $(type -P $(tc-getAR)) CACHE FILEPATH "Archive 
manager"
> > FORCE) +		SET (CMAKE_RANLIB $(type -P $(tc-getRANLIB)) CACHE FILEPATH
> > "Archive index generator" FORCE)> 
> >  	_EOF_
> >  	
> >  	if tc-is-cross-compiler; then
> > 
> > @@ -571,32 +570,29 @@ enable_cmake-utils_src_configure() {
> > 
> >  			# in Prefix we need rpath and must ensure cmake gets our 
default
> >  			linker path # right ... except for Darwin hosts
> >  			IF (NOT APPLE)
> > 
> > -			SET (CMAKE_SKIP_RPATH OFF CACHE BOOL "" FORCE)
> > -			SET (CMAKE_PLATFORM_REQUIRED_RUNTIME_PATH
> > "${EPREFIX}/usr/${CHOST}/lib/gcc;${EPREFIX}/usr/${CHOST}/lib;${EPREFIX}/u
> > sr/$(get_libdir);${EPREFIX}/$(get_libdir)" -			CACHE STRING "" 
FORCE)
> > -
> > +				SET (CMAKE_SKIP_RPATH OFF CACHE BOOL "" FORCE)
> > +				SET (CMAKE_PLATFORM_REQUIRED_RUNTIME_PATH
> > "${EPREFIX}/usr/${CHOST}/lib/gcc;${EPREFIX}/usr/${CHOST}/lib;${EPREFIX}/u
> > sr/$(get_libdir);${EPREFIX}/$(get_libdir)" CACHE STRING "" FORCE)> 
> >  			ELSE ()
> > 
> > -
> > -			SET(CMAKE_PREFIX_PATH "${EPREFIX}${PREFIX}" CACHE STRING "" 
FORCE)
> > -			SET(CMAKE_SKIP_BUILD_RPATH OFF CACHE BOOL "" FORCE)
> > -			SET(CMAKE_SKIP_RPATH OFF CACHE BOOL "" FORCE)
> > -			SET(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE CACHE BOOL "")
> > -			SET(CMAKE_INSTALL_RPATH
> > "${EPREFIX}${PREFIX}/lib;${EPREFIX}/usr/${CHOST}/lib/gcc;${EPREFIX}/usr/$
> > {CHOST}/lib;${EPREFIX}/usr/$(get_libdir);${EPREFIX}/$(get_libdir)" CACHE
> > STRING "" FORCE) -			SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH 
TRUE CACHE
> > BOOL "" FORCE) -			SET(CMAKE_INSTALL_NAME_DIR "${EPREFIX}$
{PREFIX}/lib"
> > CACHE STRING "" FORCE) -
> > +				SET(CMAKE_PREFIX_PATH "${EPREFIX}${PREFIX}" CACHE 
STRING "" FORCE)
> > +				SET(CMAKE_SKIP_BUILD_RPATH OFF CACHE BOOL "" FORCE)
> > +				SET(CMAKE_SKIP_RPATH OFF CACHE BOOL "" FORCE)
> > +				SET(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE CACHE BOOL "")
> > +				SET(CMAKE_INSTALL_RPATH
> > "${EPREFIX}${PREFIX}/lib;${EPREFIX}/usr/${CHOST}/lib/gcc;${EPREFIX}/usr/$
> > {CHOST}/lib;${EPREFIX}/usr/$(get_libdir);${EPREFIX}/$(get_libdir)" CACHE
> > STRING "" FORCE) +				SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH 
TRUE CACHE
> > BOOL "" FORCE) +				SET(CMAKE_INSTALL_NAME_DIR "${EPREFIX}$
{PREFIX}/lib"
> > CACHE STRING "" FORCE)> 
> >  			ENDIF (NOT APPLE)
> >  		
> >  		_EOF_
> >  	
> >  	fi
> >  	
> >  	# Common configure parameters (invariants)
> > 
> > -	local common_config=${BUILD_DIR}/gentoo_common_config.cmake
> > 
> >  	local libdir=$(get_libdir)
> > 
> > -	cat > "${common_config}" <<- _EOF_ || die
> > -		SET (LIB_SUFFIX ${libdir/lib} CACHE STRING "library path suffix" 
FORCE)
> > -		SET (CMAKE_INSTALL_LIBDIR ${libdir} CACHE PATH "Output directory 
for
> > libraries") -	_EOF_
> > -	[[ "${NOCOLOR}" = true || "${NOCOLOR}" = yes ]] && echo 'SET
> > (CMAKE_COLOR_MAKEFILE OFF CACHE BOOL "pretty colors during make" FORCE)'
> > >> "${common_config}" +	local cmakeargs=(
> > +		-DLIB_SUFFIX="${libdir/lib}"
> > +		-DCMAKE_INSTALL_LIBDIR="${libdir}"
> > +		-DPKG_CONFIG_EXECUTABLE="$(type -P $(tc-getPKG_CONFIG))"
> > +		-DCMAKE_USER_MAKE_RULES_OVERRIDE="${build_rules}"
> > +		-DCMAKE_TOOLCHAIN_FILE="${toolchain_file}"
> > +	)
> 
> Wasn't the point of using a config file to avoid warnings when the
> variables aren't used?

Nah, config file was there even before CMake supported warning about unused 
variables (or at least definitely long before we enabled it in eclass).
The problem _I_ have with config file is that its contents is not visible in 
build log.
Though I admit extra warnings are not nice.
-D PKG_CONFIG_EXECUTABLE could be replaced with PKG_CONFIG env var.
But LIB_SUFFIX is some KDE early invention, populated in kde-related projects 
(otherwise GNUInstallDirs should be used or manually setting 
CMAKE_INSTALL_LIBDIR).
Not sure whether config file is worth having to eliminate one or two CMake 
warnings, let's see what others think.

-- 
regards
MM

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 163 bytes --]

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [gentoo-dev] [PATCH 2/2] cmake-utils.eclass: export compilers to environment instead of setting in toolchain file, bug 542530
  2016-11-02 23:52 ` [gentoo-dev] [PATCH 2/2] cmake-utils.eclass: export compilers to environment instead of setting in toolchain file, bug 542530 Maciej Mrozowski
@ 2016-11-04 12:20   ` Alexis Ballier
  2016-11-04 12:33     ` James Le Cuirot
  0 siblings, 1 reply; 11+ messages in thread
From: Alexis Ballier @ 2016-11-04 12:20 UTC (permalink / raw
  To: gentoo-dev

On Thu,  3 Nov 2016 00:52:17 +0100
Maciej Mrozowski <reavertm@gmail.com> wrote:

> From: Maciej Mrozowski <reavertm@gentoo.org>
> 
> ---
>  eclass/cmake-utils.eclass | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/eclass/cmake-utils.eclass b/eclass/cmake-utils.eclass
> index 88d2163..23cc094 100644
> --- a/eclass/cmake-utils.eclass
> +++ b/eclass/cmake-utils.eclass
> @@ -525,13 +525,13 @@ enable_cmake-utils_src_configure() {
>  
>  	local toolchain_file=${BUILD_DIR}/gentoo_toolchain.cmake
>  	cat > ${toolchain_file} <<- _EOF_ || die
> -		SET (CMAKE_C_COMPILER $(tc-getCC))
> -		SET (CMAKE_CXX_COMPILER $(tc-getCXX))
> -		SET (CMAKE_Fortran_COMPILER $(tc-getFC))
>  		SET (CMAKE_AR $(type -P $(tc-getAR)) CACHE FILEPATH


Have you tested cross compiling ?
IIRC toolchain file is used *before* getting those vars from env and is
used to determine system & compiler type. Without this you get bugs like
#503216


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [gentoo-dev] [PATCH 2/2] cmake-utils.eclass: export compilers to environment instead of setting in toolchain file, bug 542530
  2016-11-04 12:20   ` Alexis Ballier
@ 2016-11-04 12:33     ` James Le Cuirot
  2016-11-04 12:37       ` Alexis Ballier
  0 siblings, 1 reply; 11+ messages in thread
From: James Le Cuirot @ 2016-11-04 12:33 UTC (permalink / raw
  To: gentoo-dev

On Fri, 4 Nov 2016 13:20:16 +0100
Alexis Ballier <aballier@gentoo.org> wrote:

> On Thu,  3 Nov 2016 00:52:17 +0100
> Maciej Mrozowski <reavertm@gmail.com> wrote:
> 
> > From: Maciej Mrozowski <reavertm@gentoo.org>
> > 
> > ---
> >  eclass/cmake-utils.eclass | 6 +++---
> >  1 file changed, 3 insertions(+), 3 deletions(-)
> > 
> > diff --git a/eclass/cmake-utils.eclass b/eclass/cmake-utils.eclass
> > index 88d2163..23cc094 100644
> > --- a/eclass/cmake-utils.eclass
> > +++ b/eclass/cmake-utils.eclass
> > @@ -525,13 +525,13 @@ enable_cmake-utils_src_configure() {
> >  
> >  	local toolchain_file=${BUILD_DIR}/gentoo_toolchain.cmake
> >  	cat > ${toolchain_file} <<- _EOF_ || die
> > -		SET (CMAKE_C_COMPILER $(tc-getCC))
> > -		SET (CMAKE_CXX_COMPILER $(tc-getCXX))
> > -		SET (CMAKE_Fortran_COMPILER $(tc-getFC))
> >  		SET (CMAKE_AR $(type -P $(tc-getAR)) CACHE
> > FILEPATH  
> 
> 
> Have you tested cross compiling ?
> IIRC toolchain file is used *before* getting those vars from env and
> is used to determine system & compiler type. Without this you get
> bugs like #503216

I was dubious (since I filed that bug) but I briefly tested by
cross-compiling media-libs/openal and it worked. I didn't think to try
older CMake versions though. The behaviour might have changed.

-- 
James Le Cuirot (chewi)
Gentoo Linux Developer


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [gentoo-dev] [PATCH 2/2] cmake-utils.eclass: export compilers to environment instead of setting in toolchain file, bug 542530
  2016-11-04 12:33     ` James Le Cuirot
@ 2016-11-04 12:37       ` Alexis Ballier
  2016-11-04 20:58         ` James Le Cuirot
  0 siblings, 1 reply; 11+ messages in thread
From: Alexis Ballier @ 2016-11-04 12:37 UTC (permalink / raw
  To: gentoo-dev

On Fri, 4 Nov 2016 12:33:37 +0000
James Le Cuirot <chewi@gentoo.org> wrote:

> On Fri, 4 Nov 2016 13:20:16 +0100
> Alexis Ballier <aballier@gentoo.org> wrote:
> 
> > On Thu,  3 Nov 2016 00:52:17 +0100
> > Maciej Mrozowski <reavertm@gmail.com> wrote:
> >   
> > > From: Maciej Mrozowski <reavertm@gentoo.org>
> > > 
> > > ---
> > >  eclass/cmake-utils.eclass | 6 +++---
> > >  1 file changed, 3 insertions(+), 3 deletions(-)
> > > 
> > > diff --git a/eclass/cmake-utils.eclass b/eclass/cmake-utils.eclass
> > > index 88d2163..23cc094 100644
> > > --- a/eclass/cmake-utils.eclass
> > > +++ b/eclass/cmake-utils.eclass
> > > @@ -525,13 +525,13 @@ enable_cmake-utils_src_configure() {
> > >  
> > >  	local toolchain_file=${BUILD_DIR}/gentoo_toolchain.cmake
> > >  	cat > ${toolchain_file} <<- _EOF_ || die
> > > -		SET (CMAKE_C_COMPILER $(tc-getCC))
> > > -		SET (CMAKE_CXX_COMPILER $(tc-getCXX))
> > > -		SET (CMAKE_Fortran_COMPILER $(tc-getFC))
> > >  		SET (CMAKE_AR $(type -P $(tc-getAR)) CACHE
> > > FILEPATH    
> > 
> > 
> > Have you tested cross compiling ?
> > IIRC toolchain file is used *before* getting those vars from env and
> > is used to determine system & compiler type. Without this you get
> > bugs like #503216  
> 
> I was dubious (since I filed that bug) but I briefly tested by
> cross-compiling media-libs/openal and it worked. I didn't think to try
> older CMake versions though. The behaviour might have changed.
> 

could you please send me (in private) build logs with & without the
changes please ?

(dont have easy access to a x compile setup atm)


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [gentoo-dev] Re: [PATCH 1/2] cmake-utils.eclass: CMake argument passing rework - clean build_rules and toolchain_file files from unrelated stuff (pass to CMake directly) - move some invariant CMake options actually to invariants parts - eliminate common_config (pass to CMake directly) for better transparency
  2016-11-04  0:55     ` Maciej Mrozowski
@ 2016-11-04 16:19       ` Michael Palimaka
  0 siblings, 0 replies; 11+ messages in thread
From: Michael Palimaka @ 2016-11-04 16:19 UTC (permalink / raw
  To: gentoo-dev

On 04/11/16 11:55, Maciej Mrozowski wrote:
> On czwartek, 3 listopada 2016 07:31:10 CET Michał Górny wrote:
>> On Thu,  3 Nov 2016 00:52:16 +0100
>>
>> Maciej Mrozowski <reavertm@gmail.com> wrote:
>>> From: Maciej Mrozowski <reavertm@gentoo.org>
>>>
>>> ---
>>>
>>>  eclass/cmake-utils.eclass | 54
>>>  ++++++++++++++++++----------------------------- 1 file changed, 21
>>>  insertions(+), 33 deletions(-)
>>>
>>> diff --git a/eclass/cmake-utils.eclass b/eclass/cmake-utils.eclass
>>> index 393ee28..88d2163 100644
>>> --- a/eclass/cmake-utils.eclass
>>> +++ b/eclass/cmake-utils.eclass
>>> @@ -517,13 +517,10 @@ enable_cmake-utils_src_configure() {
>>>
>>>  		includes="<INCLUDES>"
>>>  	
>>>  	fi
>>>  	cat > "${build_rules}" <<- _EOF_ || die
>>>
>>> -		SET (CMAKE_AR $(type -P $(tc-getAR)) CACHE FILEPATH "Archive 
> manager"
>>> FORCE)> 
>>>  		SET (CMAKE_ASM_COMPILE_OBJECT "<CMAKE_C_COMPILER> <DEFINES> $
> {includes}
>>>  		${CFLAGS} <FLAGS> -o <OBJECT> -c <SOURCE>" CACHE STRING "ASM 
> compile
>>>  		command" FORCE) SET (CMAKE_C_COMPILE_OBJECT "<CMAKE_C_COMPILER>
>>>  		<DEFINES> ${includes} ${CPPFLAGS} <FLAGS> -o <OBJECT> -c 
> <SOURCE>"
>>>  		CACHE STRING "C compile command" FORCE) SET 
> (CMAKE_CXX_COMPILE_OBJECT
>>>  		"<CMAKE_CXX_COMPILER> <DEFINES> ${includes} ${CPPFLAGS} <FLAGS> 
> -o
>>>  		<OBJECT> -c <SOURCE>" CACHE STRING "C++ compile command" FORCE) 
> SET
>>>  		(CMAKE_Fortran_COMPILE_OBJECT "<CMAKE_Fortran_COMPILER> 
> <DEFINES>
>>>  		${includes} ${FCFLAGS} <FLAGS> -o <OBJECT> -c <SOURCE>" CACHE 
> STRING
>>>  		"Fortran compile command" FORCE)> 
>>> -		SET (CMAKE_RANLIB $(type -P $(tc-getRANLIB)) CACHE FILEPATH 
> "Archive
>>> index generator" FORCE) -		SET (PKG_CONFIG_EXECUTABLE $(type -P
>>> $(tc-getPKG_CONFIG)) CACHE FILEPATH "pkg-config executable" FORCE)> 
>>>  	_EOF_
>>>  	
>>>  	local toolchain_file=${BUILD_DIR}/gentoo_toolchain.cmake
>>>
>>> @@ -531,6 +528,8 @@ enable_cmake-utils_src_configure() {
>>>
>>>  		SET (CMAKE_C_COMPILER $(tc-getCC))
>>>  		SET (CMAKE_CXX_COMPILER $(tc-getCXX))
>>>  		SET (CMAKE_Fortran_COMPILER $(tc-getFC))
>>>
>>> +		SET (CMAKE_AR $(type -P $(tc-getAR)) CACHE FILEPATH "Archive 
> manager"
>>> FORCE) +		SET (CMAKE_RANLIB $(type -P $(tc-getRANLIB)) CACHE FILEPATH
>>> "Archive index generator" FORCE)> 
>>>  	_EOF_
>>>  	
>>>  	if tc-is-cross-compiler; then
>>>
>>> @@ -571,32 +570,29 @@ enable_cmake-utils_src_configure() {
>>>
>>>  			# in Prefix we need rpath and must ensure cmake gets our 
> default
>>>  			linker path # right ... except for Darwin hosts
>>>  			IF (NOT APPLE)
>>>
>>> -			SET (CMAKE_SKIP_RPATH OFF CACHE BOOL "" FORCE)
>>> -			SET (CMAKE_PLATFORM_REQUIRED_RUNTIME_PATH
>>> "${EPREFIX}/usr/${CHOST}/lib/gcc;${EPREFIX}/usr/${CHOST}/lib;${EPREFIX}/u
>>> sr/$(get_libdir);${EPREFIX}/$(get_libdir)" -			CACHE STRING "" 
> FORCE)
>>> -
>>> +				SET (CMAKE_SKIP_RPATH OFF CACHE BOOL "" FORCE)
>>> +				SET (CMAKE_PLATFORM_REQUIRED_RUNTIME_PATH
>>> "${EPREFIX}/usr/${CHOST}/lib/gcc;${EPREFIX}/usr/${CHOST}/lib;${EPREFIX}/u
>>> sr/$(get_libdir);${EPREFIX}/$(get_libdir)" CACHE STRING "" FORCE)> 
>>>  			ELSE ()
>>>
>>> -
>>> -			SET(CMAKE_PREFIX_PATH "${EPREFIX}${PREFIX}" CACHE STRING "" 
> FORCE)
>>> -			SET(CMAKE_SKIP_BUILD_RPATH OFF CACHE BOOL "" FORCE)
>>> -			SET(CMAKE_SKIP_RPATH OFF CACHE BOOL "" FORCE)
>>> -			SET(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE CACHE BOOL "")
>>> -			SET(CMAKE_INSTALL_RPATH
>>> "${EPREFIX}${PREFIX}/lib;${EPREFIX}/usr/${CHOST}/lib/gcc;${EPREFIX}/usr/$
>>> {CHOST}/lib;${EPREFIX}/usr/$(get_libdir);${EPREFIX}/$(get_libdir)" CACHE
>>> STRING "" FORCE) -			SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH 
> TRUE CACHE
>>> BOOL "" FORCE) -			SET(CMAKE_INSTALL_NAME_DIR "${EPREFIX}$
> {PREFIX}/lib"
>>> CACHE STRING "" FORCE) -
>>> +				SET(CMAKE_PREFIX_PATH "${EPREFIX}${PREFIX}" CACHE 
> STRING "" FORCE)
>>> +				SET(CMAKE_SKIP_BUILD_RPATH OFF CACHE BOOL "" FORCE)
>>> +				SET(CMAKE_SKIP_RPATH OFF CACHE BOOL "" FORCE)
>>> +				SET(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE CACHE BOOL "")
>>> +				SET(CMAKE_INSTALL_RPATH
>>> "${EPREFIX}${PREFIX}/lib;${EPREFIX}/usr/${CHOST}/lib/gcc;${EPREFIX}/usr/$
>>> {CHOST}/lib;${EPREFIX}/usr/$(get_libdir);${EPREFIX}/$(get_libdir)" CACHE
>>> STRING "" FORCE) +				SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH 
> TRUE CACHE
>>> BOOL "" FORCE) +				SET(CMAKE_INSTALL_NAME_DIR "${EPREFIX}$
> {PREFIX}/lib"
>>> CACHE STRING "" FORCE)> 
>>>  			ENDIF (NOT APPLE)
>>>  		
>>>  		_EOF_
>>>  	
>>>  	fi
>>>  	
>>>  	# Common configure parameters (invariants)
>>>
>>> -	local common_config=${BUILD_DIR}/gentoo_common_config.cmake
>>>
>>>  	local libdir=$(get_libdir)
>>>
>>> -	cat > "${common_config}" <<- _EOF_ || die
>>> -		SET (LIB_SUFFIX ${libdir/lib} CACHE STRING "library path suffix" 
> FORCE)
>>> -		SET (CMAKE_INSTALL_LIBDIR ${libdir} CACHE PATH "Output directory 
> for
>>> libraries") -	_EOF_
>>> -	[[ "${NOCOLOR}" = true || "${NOCOLOR}" = yes ]] && echo 'SET
>>> (CMAKE_COLOR_MAKEFILE OFF CACHE BOOL "pretty colors during make" FORCE)'
>>>>> "${common_config}" +	local cmakeargs=(
>>> +		-DLIB_SUFFIX="${libdir/lib}"
>>> +		-DCMAKE_INSTALL_LIBDIR="${libdir}"
>>> +		-DPKG_CONFIG_EXECUTABLE="$(type -P $(tc-getPKG_CONFIG))"
>>> +		-DCMAKE_USER_MAKE_RULES_OVERRIDE="${build_rules}"
>>> +		-DCMAKE_TOOLCHAIN_FILE="${toolchain_file}"
>>> +	)
>>
>> Wasn't the point of using a config file to avoid warnings when the
>> variables aren't used?
> 
> Nah, config file was there even before CMake supported warning about unused 
> variables (or at least definitely long before we enabled it in eclass).
> The problem _I_ have with config file is that its contents is not visible in 
> build log.
> Though I admit extra warnings are not nice.
> -D PKG_CONFIG_EXECUTABLE could be replaced with PKG_CONFIG env var.
> But LIB_SUFFIX is some KDE early invention, populated in kde-related projects 
> (otherwise GNUInstallDirs should be used or manually setting 
> CMAKE_INSTALL_LIBDIR).
> Not sure whether config file is worth having to eliminate one or two CMake 
> warnings, let's see what others think.
> 

Unless there's a plan to eventually stop passing them unconditionally, I
would prefer not to introduce unused variable warnings everywhere.

If you're concerned about these not being visible in the build log, we
could extend the existing "Gentoo configuration" message appended to
every package to include the missing values.



^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [gentoo-dev] [PATCH 2/2] cmake-utils.eclass: export compilers to environment instead of setting in toolchain file, bug 542530
  2016-11-04 12:37       ` Alexis Ballier
@ 2016-11-04 20:58         ` James Le Cuirot
  2016-11-04 21:34           ` Maciej Mrozowski
  0 siblings, 1 reply; 11+ messages in thread
From: James Le Cuirot @ 2016-11-04 20:58 UTC (permalink / raw
  To: gentoo-dev

[-- Attachment #1: Type: text/plain, Size: 2229 bytes --]

On Fri, 4 Nov 2016 13:37:42 +0100
Alexis Ballier <aballier@gentoo.org> wrote:

> On Fri, 4 Nov 2016 12:33:37 +0000
> James Le Cuirot <chewi@gentoo.org> wrote:
> 
> > On Fri, 4 Nov 2016 13:20:16 +0100
> > Alexis Ballier <aballier@gentoo.org> wrote:
> >   
> > > On Thu,  3 Nov 2016 00:52:17 +0100
> > > Maciej Mrozowski <reavertm@gmail.com> wrote:
> > >     
> > > > From: Maciej Mrozowski <reavertm@gentoo.org>
> > > > 
> > > > ---
> > > >  eclass/cmake-utils.eclass | 6 +++---
> > > >  1 file changed, 3 insertions(+), 3 deletions(-)
> > > > 
> > > > diff --git a/eclass/cmake-utils.eclass b/eclass/cmake-utils.eclass
> > > > index 88d2163..23cc094 100644
> > > > --- a/eclass/cmake-utils.eclass
> > > > +++ b/eclass/cmake-utils.eclass
> > > > @@ -525,13 +525,13 @@ enable_cmake-utils_src_configure() {
> > > >  
> > > >  	local toolchain_file=${BUILD_DIR}/gentoo_toolchain.cmake
> > > >  	cat > ${toolchain_file} <<- _EOF_ || die
> > > > -		SET (CMAKE_C_COMPILER $(tc-getCC))
> > > > -		SET (CMAKE_CXX_COMPILER $(tc-getCXX))
> > > > -		SET (CMAKE_Fortran_COMPILER $(tc-getFC))
> > > >  		SET (CMAKE_AR $(type -P $(tc-getAR)) CACHE
> > > > FILEPATH      
> > > 
> > > 
> > > Have you tested cross compiling ?
> > > IIRC toolchain file is used *before* getting those vars from env and
> > > is used to determine system & compiler type. Without this you get
> > > bugs like #503216    
> > 
> > I was dubious (since I filed that bug) but I briefly tested by
> > cross-compiling media-libs/openal and it worked. I didn't think to
> > try older CMake versions though. The behaviour might have changed.
> >   
> 
> could you please send me (in private) build logs with & without the
> changes please ?
> 
> (dont have easy access to a x compile setup atm)

I diff'd the logs (needed MAKEOPTS="-j1") and they were practically
identical, save for the expected change in configure arguments. I also
tested with CMake 2.8 and that worked too. To further convince myself,
I took the current eclass and loosely reversed the change we made for
bug #503216. It failed with CMake 3.6 in exactly the same way it failed
back then. I am therefore happy for this to proceed. Would you agree?

[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 949 bytes --]

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [gentoo-dev] [PATCH 2/2] cmake-utils.eclass: export compilers to environment instead of setting in toolchain file, bug 542530
  2016-11-04 20:58         ` James Le Cuirot
@ 2016-11-04 21:34           ` Maciej Mrozowski
  0 siblings, 0 replies; 11+ messages in thread
From: Maciej Mrozowski @ 2016-11-04 21:34 UTC (permalink / raw
  To: gentoo-dev

[-- Attachment #1: Type: text/plain, Size: 2760 bytes --]

On piątek, 4 listopada 2016 20:58:23 CET James Le Cuirot wrote:
> On Fri, 4 Nov 2016 13:37:42 +0100
> 
> Alexis Ballier <aballier@gentoo.org> wrote:
> > On Fri, 4 Nov 2016 12:33:37 +0000
> > 
> > James Le Cuirot <chewi@gentoo.org> wrote:
> > > On Fri, 4 Nov 2016 13:20:16 +0100
> > > 
> > > Alexis Ballier <aballier@gentoo.org> wrote:
> > > > On Thu,  3 Nov 2016 00:52:17 +0100
> > > > 
> > > > Maciej Mrozowski <reavertm@gmail.com> wrote:
> > > > > From: Maciej Mrozowski <reavertm@gentoo.org>
> > > > > 
> > > > > ---
> > > > > 
> > > > >  eclass/cmake-utils.eclass | 6 +++---
> > > > >  1 file changed, 3 insertions(+), 3 deletions(-)
> > > > > 
> > > > > diff --git a/eclass/cmake-utils.eclass b/eclass/cmake-utils.eclass
> > > > > index 88d2163..23cc094 100644
> > > > > --- a/eclass/cmake-utils.eclass
> > > > > +++ b/eclass/cmake-utils.eclass
> > > > > @@ -525,13 +525,13 @@ enable_cmake-utils_src_configure() {
> > > > > 
> > > > >  	local toolchain_file=${BUILD_DIR}/gentoo_toolchain.cmake
> > > > >  	cat > ${toolchain_file} <<- _EOF_ || die
> > > > > 
> > > > > -		SET (CMAKE_C_COMPILER $(tc-getCC))
> > > > > -		SET (CMAKE_CXX_COMPILER $(tc-getCXX))
> > > > > -		SET (CMAKE_Fortran_COMPILER $(tc-getFC))
> > > > > 
> > > > >  		SET (CMAKE_AR $(type -P $(tc-getAR)) CACHE
> > > > > 
> > > > > FILEPATH
> > > > 
> > > > Have you tested cross compiling ?
> > > > IIRC toolchain file is used *before* getting those vars from env and
> > > > is used to determine system & compiler type. Without this you get
> > > > bugs like #503216
> > > 
> > > I was dubious (since I filed that bug) but I briefly tested by
> > > cross-compiling media-libs/openal and it worked. I didn't think to
> > > try older CMake versions though. The behaviour might have changed.
> > 
> > could you please send me (in private) build logs with & without the
> > changes please ?
> > 
> > (dont have easy access to a x compile setup atm)
> 
> I diff'd the logs (needed MAKEOPTS="-j1") and they were practically
> identical, save for the expected change in configure arguments. I also
> tested with CMake 2.8 and that worked too. To further convince myself,
> I took the current eclass and loosely reversed the change we made for
> bug #503216. It failed with CMake 3.6 in exactly the same way it failed
> back then. I am therefore happy for this to proceed. Would you agree?

Env way w/ CMake is used (without toolchain file) where I work for a couple of 
years with quite a bunch of exotic cross-compilers so I never doubted it would 
work (with toolchain file lacking CMAKE_<lang>_COMPILER variable).
The only thing surprised me here was CMake handling CC/CXX var multi-param 
abuse acceptably.

-- 
regards
MM

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 163 bytes --]

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2016-11-04 21:34 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-11-02 23:52 [gentoo-dev] [PATCH 0/2] cmake-utils small rework + bug 542530 Maciej Mrozowski
2016-11-02 23:52 ` [gentoo-dev] [PATCH 1/2] cmake-utils.eclass: CMake argument passing rework - clean build_rules and toolchain_file files from unrelated stuff (pass to CMake directly) - move some invariant CMake options actually to invariants parts - eliminate common_config (pass to CMake directly) for better transparency Maciej Mrozowski
2016-11-03  6:31   ` Michał Górny
2016-11-04  0:55     ` Maciej Mrozowski
2016-11-04 16:19       ` [gentoo-dev] " Michael Palimaka
2016-11-02 23:52 ` [gentoo-dev] [PATCH 2/2] cmake-utils.eclass: export compilers to environment instead of setting in toolchain file, bug 542530 Maciej Mrozowski
2016-11-04 12:20   ` Alexis Ballier
2016-11-04 12:33     ` James Le Cuirot
2016-11-04 12:37       ` Alexis Ballier
2016-11-04 20:58         ` James Le Cuirot
2016-11-04 21:34           ` Maciej Mrozowski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox