Gentoo Archives: gentoo-dev

From: "Michał Górny" <mgorny@g.o>
To: gentoo-dev@l.g.o
Cc: multilib@g.o, kde@g.o, "Michał Górny" <mgorny@g.o>
Subject: [gentoo-dev] [PATCH cmake-multilib] Use multilib-minimal phase functions.
Date: Wed, 30 Apr 2014 18:15:13
Message-Id: 1398881675-23426-1-git-send-email-mgorny@gentoo.org
1 The goal is to make overriding parts of build process easy. Before,
2 the eclass called cmake-utils directly via multilib_foreach_abi,
3 therefore user overriding a phase function needed to call
4 multilib_foreach_abi himself, and likely define another function with
5 the details.
6
7 With multilib-minimal around, the eclass just provides a 'default'
8 implementation of particular multilib_src_*() phases. If user needs to
9 override one of them, he can just create his own multilib_src_*()
10 function without worrying about fine details.
11
12 Another advantage is that we get rid of the duplicate wrapper calling
13 code, keeping it all in multilib-minimal.
14
15 The new code should retain compatibility with existing ebuilds. I will
16 do a complete test run before committing.
17 ---
18 eclass/cmake-multilib.eclass | 56 +++++++++++++++++++++++++++-----------------
19 1 file changed, 35 insertions(+), 21 deletions(-)
20
21 diff --git a/eclass/cmake-multilib.eclass b/eclass/cmake-multilib.eclass
22 index e7c9059..8461f42 100644
23 --- a/eclass/cmake-multilib.eclass
24 +++ b/eclass/cmake-multilib.eclass
25 @@ -9,16 +9,15 @@
26 # Author: Michał Górny <mgorny@g.o>
27 # @BLURB: cmake-utils wrapper for multilib builds
28 # @DESCRIPTION:
29 -# The cmake-multilib.eclass is a cmake-utils.eclass(5) wrapper
30 -# introducing support for building for more than one ABI (multilib).
31 +# The cmake-multilib.eclass provides a glue between cmake-utils.eclass(5)
32 +# and multilib-minimal.eclass(5), aiming to provide a convenient way
33 +# to build packages using cmake for multiple ABIs.
34 #
35 -# Inheriting this eclass sets IUSE and exports cmake-utils phase
36 -# function wrappers which build the package for each supported ABI
37 -# if the appropriate flag is enabled.
38 -#
39 -# Note that the multilib support requires out-of-source builds to be
40 -# enabled. Thus, it is impossible to use CMAKE_IN_SOURCE_BUILD with
41 -# it.
42 +# Inheriting this eclass sets IUSE and exports default multilib_src_*()
43 +# sub-phases that call cmake-utils phase functions for each ABI enabled.
44 +# The multilib_src_*() functions can be defined in ebuild just like
45 +# in multilib-minimal, yet they ought to call appropriate cmake-utils
46 +# phase rather than 'default'.
47
48 # EAPI=5 is required for meaningful MULTILIB_USEDEP.
49 case ${EAPI:-0} in
50 @@ -30,31 +29,46 @@ if [[ ${CMAKE_IN_SOURCE_BUILD} ]]; then
51 die "${ECLASS}: multilib support requires out-of-source builds."
52 fi
53
54 -inherit cmake-utils multilib-build
55 +inherit cmake-utils multilib-minimal
56
57 EXPORT_FUNCTIONS src_configure src_compile src_test src_install
58
59 cmake-multilib_src_configure() {
60 - multilib_parallel_foreach_abi cmake-utils_src_configure "${@}"
61 + local _cmake_args=( "${@}" )
62 +
63 + multilib-minimal_src_configure
64 +}
65 +
66 +multilib_src_configure() {
67 + cmake-utils_src_configure "${_cmake_args[@]}"
68 }
69
70 cmake-multilib_src_compile() {
71 - multilib_foreach_abi cmake-utils_src_compile "${@}"
72 + local _cmake_args=( "${@}" )
73 +
74 + multilib-minimal_src_compile
75 +}
76 +
77 +multilib_src_compile() {
78 + cmake-utils_src_compile "${_cmake_args[@]}"
79 }
80
81 cmake-multilib_src_test() {
82 - multilib_foreach_abi cmake-utils_src_test "${@}"
83 + local _cmake_args=( "${@}" )
84 +
85 + multilib-minimal_src_test
86 +}
87 +
88 +multilib_src_test() {
89 + cmake-utils_src_test "${_cmake_args[@]}"
90 }
91
92 cmake-multilib_src_install() {
93 - cmake-multilib_secure_install() {
94 - cmake-utils_src_install "${@}"
95 + local _cmake_args=( "${@}" )
96
97 - multilib_prepare_wrappers
98 - # Make sure all headers are the same for each ABI.
99 - multilib_check_headers
100 - }
101 + multilib-minimal_src_install
102 +}
103
104 - multilib_foreach_abi cmake-multilib_secure_install "${@}"
105 - multilib_install_wrappers
106 +multilib_src_install() {
107 + cmake-utils_src_install "${_cmake_args[@]}"
108 }
109 --
110 1.9.2

Replies