Gentoo Archives: gentoo-dev

From: "Michał Górny" <mgorny@g.o>
To: gentoo-dev@l.g.o
Cc: kde@g.o, "Michał Górny" <mgorny@g.o>
Subject: [gentoo-dev] [PATCH 2/3] Introduce cmake-multilib wrapper for cmake-utils.
Date: Tue, 05 Feb 2013 20:20:53
Message-Id: 1360095564-18154-3-git-send-email-mgorny@gentoo.org
In Reply to: [gentoo-dev] New eclass: cmake-multilib for cmake multilib package builds by "Michał Górny"
1 ---
2 gx86/eclass/cmake-multilib.eclass | 83 +++++++++++++++++++++++++++++++++++++++
3 1 file changed, 83 insertions(+)
4 create mode 100644 gx86/eclass/cmake-multilib.eclass
5
6 diff --git a/gx86/eclass/cmake-multilib.eclass b/gx86/eclass/cmake-multilib.eclass
7 new file mode 100644
8 index 0000000..9f41e5c
9 --- /dev/null
10 +++ b/gx86/eclass/cmake-multilib.eclass
11 @@ -0,0 +1,83 @@
12 +# Copyright 1999-2013 Gentoo Foundation
13 +# Distributed under the terms of the GNU General Public License v2
14 +# $Header: /var/cvsroot/gentoo-x86/eclass/cmake-multilib.eclass,v 1.8 2013/02/01 21:39:50 mgorny Exp $
15 +
16 +# @ECLASS: cmake-multilib.eclass
17 +# @MAINTAINER:
18 +# Michał Górny <mgorny@g.o>
19 +# @BLURB: cmake-utils wrapper for multilib builds
20 +# @DESCRIPTION:
21 +# The cmake-multilib.eclass is a cmake-utils.eclass(5) wrapper
22 +# introducing support for building for more than one ABI (multilib).
23 +#
24 +# Inheriting this eclass sets IUSE and exports cmake-utils phase
25 +# function wrappers which build the package for each supported ABI
26 +# if the appropriate flag is enabled.
27 +#
28 +# Note that the multilib support requires out-of-source builds to be
29 +# enabled. Thus, it is impossible to use CMAKE_IN_SOURCE_BUILD with
30 +# it.
31 +
32 +# EAPI=5 is required for meaningful MULTILIB_USEDEP.
33 +case ${EAPI:-0} in
34 + 5) ;;
35 + *) die "EAPI=${EAPI} is not supported" ;;
36 +esac
37 +
38 +if [[ ${CMAKE_IN_SOURCE_BUILD} ]]; then
39 + die "${ECLASS}: multilib support requires out-of-source builds."
40 +fi
41 +
42 +inherit cmake-utils multilib-build
43 +
44 +EXPORT_FUNCTIONS src_configure src_compile src_test src_install
45 +
46 +cmake-multilib_src_configure() {
47 + multilib_parallel_foreach_abi cmake-utils_src_configure
48 +}
49 +
50 +cmake-multilib_src_compile() {
51 + multilib_foreach_abi cmake-utils_src_compile
52 +}
53 +
54 +cmake-multilib_src_test() {
55 + multilib_foreach_abi cmake-utils_src_test
56 +}
57 +
58 +cmake-multilib_src_install() {
59 + cmake-multilib_secure_install() {
60 + cmake-utils_src_install
61 +
62 + # Make sure all headers are the same for each ABI.
63 + cmake-multilib_cksum() {
64 + find "${ED}"usr/include -type f \
65 + -exec cksum {} + | sort -k2
66 + }
67 +
68 + local cksum=$(cmake-multilib_cksum)
69 + local cksum_file=${T}/.cmake-multilib_cksum
70 +
71 + if [[ -f ${cksum_file} ]]; then
72 + local cksum_prev=$(< "${cksum_file}")
73 +
74 + if [[ ${cksum} != ${cksum_prev} ]]; then
75 + echo "${cksum}" > "${cksum_file}.new"
76 +
77 + eerror "Header files have changed between ABIs."
78 +
79 + if type -p diff &>/dev/null; then
80 + eerror "$(diff -du "${cksum_file}" "${cksum_file}.new")"
81 + else
82 + eerror "Old checksums in: ${cksum_file}"
83 + eerror "New checksums in: ${cksum_file}.new"
84 + fi
85 +
86 + die "Header checksum mismatch, aborting."
87 + fi
88 + else
89 + echo "${cksum}" > "${cksum_file}"
90 + fi
91 + }
92 +
93 + multilib_foreach_abi cmake-multilib_secure_install
94 +}
95 --
96 1.8.1.2

Replies