/[gentoo-x86]/eclass/autotools-multilib.eclass
Gentoo

Diff of /eclass/autotools-multilib.eclass

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1.2 Revision 1.8
1# Copyright 1999-2012 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.2 2012/12/01 16:26:03 mgorny Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/autotools-multilib.eclass,v 1.8 2013/02/01 21:39:50 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
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
22# EAPI=5 is required for meaningful MULTILIB_USEDEP.
22case ${EAPI:-0} in 23case ${EAPI:-0} in
23 2|3|4) ;; 24 5) ;;
24 *) die "EAPI=${EAPI} is not supported" ;; 25 *) die "EAPI=${EAPI} is not supported" ;;
25esac 26esac
26 27
27if [[ ${AUTOTOOLS_IN_SOURCE_BUILD} ]]; then 28if [[ ${AUTOTOOLS_IN_SOURCE_BUILD} ]]; then
28 die "${ECLASS}: multilib support requires out-of-source builds." 29 die "${ECLASS}: multilib support requires out-of-source builds."
29fi 30fi
30 31
31inherit autotools-utils multilib 32inherit autotools-utils multilib-build
32 33
33EXPORT_FUNCTIONS src_configure src_compile src_test src_install 34EXPORT_FUNCTIONS src_configure src_compile src_test src_install
34 35
35IUSE=multilib
36
37# @FUNCTION: autotools-multilib_foreach_abi
38# @USAGE: argv...
39# @DESCRIPTION:
40# If multilib support is enabled, sets the toolchain up for each
41# supported ABI along with the ABI variable and correct BUILD_DIR,
42# and runs the given commands with them.
43#
44# If multilib support is disabled, it just runs the commands. No setup
45# is done.
46autotools-multilib_foreach_abi() {
47 local initial_dir=${BUILD_DIR:-${S}}
48
49 if use multilib; then
50 local ABI
51 for ABI in $(get_all_abis); do
52 multilib_toolchain_setup "${ABI}"
53 BUILD_DIR=${initial_dir%%/}-${ABI} "${@}"
54 done
55 else
56 "${@}"
57 fi
58}
59
60autotools-multilib_src_configure() { 36autotools-multilib_src_configure() {
61 autotools-multilib_foreach_abi autotools-utils_src_configure 37 multilib_parallel_foreach_abi autotools-utils_src_configure
62} 38}
63 39
64autotools-multilib_src_compile() { 40autotools-multilib_src_compile() {
65 autotools-multilib_foreach_abi autotools-utils_src_compile 41 multilib_foreach_abi autotools-utils_src_compile
66} 42}
67 43
68autotools-multilib_src_test() { 44autotools-multilib_src_test() {
69 autotools-multilib_foreach_abi autotools-utils_src_test 45 multilib_foreach_abi autotools-utils_src_test
70} 46}
71 47
72autotools-multilib_src_install() { 48autotools-multilib_src_install() {
49 autotools-multilib_secure_install() {
50 autotools-utils_src_install
51
52 # Make sure all headers are the same for each ABI.
53 autotools-multilib_cksum() {
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 }
82
73 autotools-multilib_foreach_abi autotools-utils_src_install 83 multilib_foreach_abi autotools-multilib_secure_install
74} 84}

Legend:
Removed from v.1.2  
changed lines
  Added in v.1.8

  ViewVC Help
Powered by ViewVC 1.1.20