toolchain-funcs.eclass: tweak comment
[gentoo.git] / eclass / cmake-multilib.eclass
1 # Copyright 1999-2019 Gentoo Authors
2 # Distributed under the terms of the GNU General Public License v2
3
4 # @ECLASS: cmake-multilib.eclass
5 # @MAINTAINER:
6 # gx86-multilib team <multilib@gentoo.org>
7 # @AUTHOR:
8 # Author: Michał Górny <mgorny@gentoo.org>
9 # @SUPPORTED_EAPIS: 6 7
10 # @BLURB: cmake-utils wrapper for multilib builds
11 # @DESCRIPTION:
12 # The cmake-multilib.eclass provides a glue between cmake-utils.eclass(5)
13 # and multilib-minimal.eclass(5), aiming to provide a convenient way
14 # to build packages using cmake for multiple ABIs.
15 #
16 # Inheriting this eclass sets IUSE and exports default multilib_src_*()
17 # sub-phases that call cmake-utils phase functions for each ABI enabled.
18 # The multilib_src_*() functions can be defined in ebuild just like
19 # in multilib-minimal, yet they ought to call appropriate cmake-utils
20 # phase rather than 'default'.
21
22 # @ECLASS-VARIABLE: CMAKE_ECLASS
23 # @DESCRIPTION:
24 # Default is "cmake-utils" for compatibility. Specify "cmake" for ebuilds
25 # that ported from cmake-utils.eclass to cmake.eclass already.
26 : ${CMAKE_ECLASS:=cmake-utils}
27
28 case ${EAPI:-0} in
29         [67]) ;;
30         *) die "EAPI=${EAPI} is not supported" ;;
31 esac
32
33 if [[ ${CMAKE_IN_SOURCE_BUILD} ]]; then
34         die "${ECLASS}: multilib support requires out-of-source builds."
35 fi
36
37 case ${CMAKE_ECLASS} in
38         cmake-utils|cmake) ;;
39         *)
40                 eerror "Unknown value for \${CMAKE_ECLASS}"
41                 die "Value ${CMAKE_ECLASS} is not supported"
42                 ;;
43 esac
44
45 inherit ${CMAKE_ECLASS} multilib-minimal
46
47 EXPORT_FUNCTIONS src_configure src_compile src_test src_install
48
49 cmake-multilib_src_configure() {
50         local _cmake_args=( "${@}" )
51
52         multilib-minimal_src_configure
53 }
54
55 multilib_src_configure() {
56         ${CMAKE_ECLASS}_src_configure "${_cmake_args[@]}"
57 }
58
59 cmake-multilib_src_compile() {
60         local _cmake_args=( "${@}" )
61
62         multilib-minimal_src_compile
63 }
64
65 multilib_src_compile() {
66         ${CMAKE_ECLASS}_src_compile "${_cmake_args[@]}"
67 }
68
69 cmake-multilib_src_test() {
70         local _cmake_args=( "${@}" )
71
72         multilib-minimal_src_test
73 }
74
75 multilib_src_test() {
76         ${CMAKE_ECLASS}_src_test "${_cmake_args[@]}"
77 }
78
79 cmake-multilib_src_install() {
80         local _cmake_args=( "${@}" )
81
82         multilib-minimal_src_install
83 }
84
85 multilib_src_install() {
86         ${CMAKE_ECLASS}_src_install "${_cmake_args[@]}"
87 }