| 1 | # Copyright 1999-2013 Gentoo Foundation |
1 | # Copyright 1999-2013 Gentoo Foundation |
| 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 | # $Header: /var/cvsroot/gentoo-x86/eclass/autotools-multilib.eclass,v 1.8 2013/02/01 21:39:50 mgorny Exp $ |
3 | # $Header: /var/cvsroot/gentoo-x86/eclass/autotools-multilib.eclass,v 1.11 2013/02/27 21:46:31 mgorny Exp $ |
| 4 | |
4 | |
| 5 | # @ECLASS: autotools-multilib.eclass |
5 | # @ECLASS: autotools-multilib.eclass |
| 6 | # @MAINTAINER: |
6 | # @MAINTAINER: |
| 7 | # Michał Górny <mgorny@gentoo.org> |
7 | # Michał Górny <mgorny@gentoo.org> |
| 8 | # @BLURB: autotools-utils wrapper for multilib builds |
8 | # @BLURB: autotools-utils wrapper for multilib builds |
| 9 | # @DESCRIPTION: |
9 | # @DESCRIPTION: |
| 10 | # The autotools-multilib.eclass is an autotools-utils.eclass(5) wrapper |
10 | # The autotools-multilib.eclass is an autotools-utils.eclass(5) wrapper |
| 11 | # introducing support for building for more than one ABI (multilib). |
11 | # introducing support for building for more than one ABI (multilib). |
| 12 | # |
12 | # |
| 13 | # Inheriting this eclass sets IUSE=multilib and exports autotools-utils |
13 | # Inheriting this eclass sets the USE flags and exports autotools-utils |
| 14 | # phase function wrappers which build the package for each supported ABI |
14 | # phase function wrappers which build the package for each supported ABI |
| 15 | # if the flag is enabled. Otherwise, it works like regular |
15 | # when the relevant flag is enabled. Other than that, it works like |
| 16 | # autotools-utils. |
16 | # regular autotools-utils. |
| 17 | # |
17 | # |
| 18 | # Note that the multilib support requires out-of-source builds to be |
18 | # Note that the multilib support requires out-of-source builds to be |
| 19 | # enabled. Thus, it is impossible to use AUTOTOOLS_IN_SOURCE_BUILD with |
19 | # enabled. Thus, it is impossible to use AUTOTOOLS_IN_SOURCE_BUILD with |
| 20 | # it. |
20 | # it. |
| 21 | |
21 | |
| … | |
… | |
| 32 | inherit autotools-utils multilib-build |
32 | inherit autotools-utils multilib-build |
| 33 | |
33 | |
| 34 | EXPORT_FUNCTIONS src_configure src_compile src_test src_install |
34 | EXPORT_FUNCTIONS src_configure src_compile src_test src_install |
| 35 | |
35 | |
| 36 | autotools-multilib_src_configure() { |
36 | autotools-multilib_src_configure() { |
| 37 | multilib_parallel_foreach_abi autotools-utils_src_configure |
37 | multilib_parallel_foreach_abi autotools-utils_src_configure "${@}" |
| 38 | } |
38 | } |
| 39 | |
39 | |
| 40 | autotools-multilib_src_compile() { |
40 | autotools-multilib_src_compile() { |
| 41 | multilib_foreach_abi autotools-utils_src_compile |
41 | multilib_foreach_abi autotools-utils_src_compile "${@}" |
| 42 | } |
42 | } |
| 43 | |
43 | |
| 44 | autotools-multilib_src_test() { |
44 | autotools-multilib_src_test() { |
| 45 | multilib_foreach_abi autotools-utils_src_test |
45 | multilib_foreach_abi autotools-utils_src_test "${@}" |
| 46 | } |
46 | } |
| 47 | |
47 | |
| 48 | autotools-multilib_src_install() { |
48 | autotools-multilib_src_install() { |
| 49 | autotools-multilib_secure_install() { |
49 | autotools-multilib_secure_install() { |
| 50 | autotools-utils_src_install |
50 | autotools-utils_src_install "${@}" |
| 51 | |
51 | |
| 52 | # Make sure all headers are the same for each ABI. |
52 | # Make sure all headers are the same for each ABI. |
| 53 | autotools-multilib_cksum() { |
53 | multilib_check_headers |
| 54 | find "${ED}"usr/include -type f \ |
|
|
| 55 | -exec cksum {} + | sort -k2 |
|
|
| 56 | } |
|
|
| 57 | |
|
|
| 58 | local cksum=$(autotools-multilib_cksum) |
|
|
| 59 | local cksum_file=${T}/.autotools-multilib_cksum |
|
|
| 60 | |
|
|
| 61 | if [[ -f ${cksum_file} ]]; then |
|
|
| 62 | local cksum_prev=$(< "${cksum_file}") |
|
|
| 63 | |
|
|
| 64 | if [[ ${cksum} != ${cksum_prev} ]]; then |
|
|
| 65 | echo "${cksum}" > "${cksum_file}.new" |
|
|
| 66 | |
|
|
| 67 | eerror "Header files have changed between ABIs." |
|
|
| 68 | |
|
|
| 69 | if type -p diff &>/dev/null; then |
|
|
| 70 | eerror "$(diff -du "${cksum_file}" "${cksum_file}.new")" |
|
|
| 71 | else |
|
|
| 72 | eerror "Old checksums in: ${cksum_file}" |
|
|
| 73 | eerror "New checksums in: ${cksum_file}.new" |
|
|
| 74 | fi |
|
|
| 75 | |
|
|
| 76 | die "Header checksum mismatch, aborting." |
|
|
| 77 | fi |
|
|
| 78 | else |
|
|
| 79 | echo "${cksum}" > "${cksum_file}" |
|
|
| 80 | fi |
|
|
| 81 | } |
54 | } |
| 82 | |
55 | |
| 83 | multilib_foreach_abi autotools-multilib_secure_install |
56 | multilib_foreach_abi autotools-multilib_secure_install "${@}" |
| 84 | } |
57 | } |