Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 704524
Collapse All | Expand All

(-)a/eclass/cmake.eclass (-18 / +17 lines)
Lines 1-4 Link Here
1
# Copyright 1999-2019 Gentoo Authors
1
# Copyright 1999-2020 Gentoo Authors
2
# Distributed under the terms of the GNU General Public License v2
2
# Distributed under the terms of the GNU General Public License v2
3
3
4
# @ECLASS: cmake.eclass
4
# @ECLASS: cmake.eclass
Lines 25-32 _CMAKE_ECLASS=1 Link Here
25
# Build directory where all cmake processed files should be generated.
25
# Build directory where all cmake processed files should be generated.
26
# For in-source build it's fixed to ${CMAKE_USE_DIR}.
26
# For in-source build it's fixed to ${CMAKE_USE_DIR}.
27
# For out-of-source build it can be overridden, by default it uses
27
# For out-of-source build it can be overridden, by default it uses
28
# ${WORKDIR}/${P}_build.
28
# ${CMAKE_USE_DIR}_build.
29
: ${BUILD_DIR:=${WORKDIR}/${P}_build}
30
29
31
# @ECLASS-VARIABLE: CMAKE_BINARY
30
# @ECLASS-VARIABLE: CMAKE_BINARY
32
# @DESCRIPTION:
31
# @DESCRIPTION:
Lines 57-64 _CMAKE_ECLASS=1 Link Here
57
56
58
# @ECLASS-VARIABLE: CMAKE_REMOVE_MODULES_LIST
57
# @ECLASS-VARIABLE: CMAKE_REMOVE_MODULES_LIST
59
# @DESCRIPTION:
58
# @DESCRIPTION:
60
# Array of CMake modules that will be removed in $S during src_prepare,
59
# Array of CMake modules that will be removed in ${CMAKE_USE_DIR} during
61
# in order to force packages to use the system version.
60
# src_prepare, in order to force packages to use the system version.
62
# Set to "none" to disable removing modules entirely.
61
# Set to "none" to disable removing modules entirely.
63
: ${CMAKE_REMOVE_MODULES_LIST:=FindBLAS FindLAPACK}
62
: ${CMAKE_REMOVE_MODULES_LIST:=FindBLAS FindLAPACK}
64
63
Lines 66-72 _CMAKE_ECLASS=1 Link Here
66
# @DESCRIPTION:
65
# @DESCRIPTION:
67
# Sets the directory where we are working with cmake, for example when
66
# Sets the directory where we are working with cmake, for example when
68
# application uses autotools and only one plugin needs to be done by cmake.
67
# application uses autotools and only one plugin needs to be done by cmake.
69
# By default it uses ${S}.
68
# By default it uses current working directory.
70
69
71
# @ECLASS-VARIABLE: CMAKE_VERBOSE
70
# @ECLASS-VARIABLE: CMAKE_VERBOSE
72
# @DESCRIPTION:
71
# @DESCRIPTION:
Lines 90-96 _CMAKE_ECLASS=1 Link Here
90
# @ECLASS-VARIABLE: CMAKE_QA_SRC_DIR_READONLY
89
# @ECLASS-VARIABLE: CMAKE_QA_SRC_DIR_READONLY
91
# @DEFAULT_UNSET
90
# @DEFAULT_UNSET
92
# @DESCRIPTION:
91
# @DESCRIPTION:
93
# After running cmake_src_prepare, sets ${S} to read-only. This is
92
# After running cmake_src_prepare, sets ${CMAKE_USE_DIR} to read-only. This is
94
# a user flag and should under _no circumstances_ be set in the ebuild.
93
# a user flag and should under _no circumstances_ be set in the ebuild.
95
# Helps in improving QA of build systems that write to source tree.
94
# Helps in improving QA of build systems that write to source tree.
96
95
Lines 137-150 _cmake_banned_func() { Link Here
137
136
138
# Determine using IN or OUT source build
137
# Determine using IN or OUT source build
139
_cmake_check_build_dir() {
138
_cmake_check_build_dir() {
140
	: ${CMAKE_USE_DIR:=${S}}
139
	: ${CMAKE_USE_DIR:=$(pwd)}
141
	if [[ -n ${CMAKE_IN_SOURCE_BUILD} ]]; then
140
	if [[ -n ${CMAKE_IN_SOURCE_BUILD} ]]; then
142
		# we build in source dir
141
		# we build in source dir
143
		BUILD_DIR="${CMAKE_USE_DIR}"
142
		BUILD_DIR="${CMAKE_USE_DIR}"
143
	else
144
		: ${BUILD_DIR:=${CMAKE_USE_DIR}_build}
144
	fi
145
	fi
145
146
147
	einfo "Source directory (CMAKE_USE_DIR): \"${CMAKE_USE_DIR}\""
148
	einfo "Build directory  (BUILD_DIR):     \"${BUILD_DIR}\""
149
146
	mkdir -p "${BUILD_DIR}" || die
150
	mkdir -p "${BUILD_DIR}" || die
147
	einfo "Working in BUILD_DIR: \"$BUILD_DIR\""
148
}
151
}
149
152
150
# @FUNCTION: cmake_comment_add_subdirectory
153
# @FUNCTION: cmake_comment_add_subdirectory
Lines 294-303 _cmake_modify-cmakelists() { Link Here
294
cmake_src_prepare() {
297
cmake_src_prepare() {
295
	debug-print-function ${FUNCNAME} "$@"
298
	debug-print-function ${FUNCNAME} "$@"
296
299
297
	pushd "${S}" > /dev/null || die
300
	_cmake_check_build_dir
298
301
299
	default_src_prepare
302
	default_src_prepare
300
	_cmake_check_build_dir
301
303
302
	# check if CMakeLists.txt exist and if no then die
304
	# check if CMakeLists.txt exist and if no then die
303
	if [[ ! -e ${CMAKE_USE_DIR}/CMakeLists.txt ]] ; then
305
	if [[ ! -e ${CMAKE_USE_DIR}/CMakeLists.txt ]] ; then
Lines 323-339 cmake_src_prepare() { Link Here
323
325
324
	local name
326
	local name
325
	for name in "${modules_list[@]}" ; do
327
	for name in "${modules_list[@]}" ; do
326
		find "${S}" -name ${name}.cmake -exec rm -v {} + || die
328
		find -name "${name}.cmake" -exec rm -v {} + || die
327
	done
329
	done
328
330
329
	# Remove dangerous things.
331
	# Remove dangerous things.
330
	_cmake_modify-cmakelists
332
	_cmake_modify-cmakelists
331
333
332
	popd > /dev/null || die
334
	# Make ${CMAKE_USE_DIR} read-only in order to detect broken build systems.
333
334
	# make ${S} read-only in order to detect broken build-systems
335
	if [[ ${CMAKE_QA_SRC_DIR_READONLY} && ! ${CMAKE_IN_SOURCE_BUILD} ]]; then
335
	if [[ ${CMAKE_QA_SRC_DIR_READONLY} && ! ${CMAKE_IN_SOURCE_BUILD} ]]; then
336
		chmod -R a-w "${S}"
336
		chmod -R a-w "${CMAKE_USE_DIR}"
337
	fi
337
	fi
338
338
339
	_CMAKE_SRC_PREPARE_HAS_RUN=1
339
	_CMAKE_SRC_PREPARE_HAS_RUN=1
Lines 634-640 cmake_src_install() { Link Here
634
		die "died running ${CMAKE_MAKEFILE_GENERATOR} install"
634
		die "died running ${CMAKE_MAKEFILE_GENERATOR} install"
635
	popd > /dev/null || die
635
	popd > /dev/null || die
636
636
637
	pushd "${S}" > /dev/null || die
637
	pushd "${CMAKE_USE_DIR}" > /dev/null || die
638
	einstalldocs
638
	einstalldocs
639
	popd > /dev/null || die
639
	popd > /dev/null || die
640
}
640
}
641
- 

Return to bug 704524