diff options
author | Michał Górny <mgorny@gentoo.org> | 2013-02-01 21:39:50 +0000 |
---|---|---|
committer | Michał Górny <mgorny@gentoo.org> | 2013-02-01 21:39:50 +0000 |
commit | 7d6a76918772397ef3a9cede481fbd6679a3dc19 (patch) | |
tree | bc59b7e3843cd1fb39a7971203ed5aa88515a09a /eclass | |
parent | Remove old. (diff) | |
download | historical-7d6a76918772397ef3a9cede481fbd6679a3dc19.tar.gz historical-7d6a76918772397ef3a9cede481fbd6679a3dc19.tar.bz2 historical-7d6a76918772397ef3a9cede481fbd6679a3dc19.zip |
Introduce a common multilib-build eclass to help building packages for multilib, and use the new ABI_X86 flags in it.
Diffstat (limited to 'eclass')
-rw-r--r-- | eclass/ChangeLog | 7 | ||||
-rw-r--r-- | eclass/autotools-multilib.eclass | 120 | ||||
-rw-r--r-- | eclass/multilib-build.eclass | 141 |
3 files changed, 187 insertions, 81 deletions
diff --git a/eclass/ChangeLog b/eclass/ChangeLog index 59f179103938..5d672dc0083a 100644 --- a/eclass/ChangeLog +++ b/eclass/ChangeLog @@ -1,6 +1,11 @@ # ChangeLog for eclass directory # Copyright 1999-2013 Gentoo Foundation; Distributed under the GPL v2 -# $Header: /var/cvsroot/gentoo-x86/eclass/ChangeLog,v 1.657 2013/01/31 19:59:54 eva Exp $ +# $Header: /var/cvsroot/gentoo-x86/eclass/ChangeLog,v 1.658 2013/02/01 21:39:50 mgorny Exp $ + + 01 Feb 2013; Michał Górny <mgorny@gentoo.org> autotools-multilib.eclass, + +multilib-build.eclass: + Introduce a common multilib-build eclass to help building packages for + multilib, and use the new ABI_X86 flags in it. 31 Jan 2013; Gilles Dartiguelongue <eva@gentoo.org> gst-plugins10.eclass: Allow build of multiple plugins in different directories. Make variables more diff --git a/eclass/autotools-multilib.eclass b/eclass/autotools-multilib.eclass index 90f7beee840d..97abfe65e0ed 100644 --- a/eclass/autotools-multilib.eclass +++ b/eclass/autotools-multilib.eclass @@ -1,6 +1,6 @@ # Copyright 1999-2013 Gentoo Foundation # Distributed under the terms of the GNU General Public License v2 -# $Header: /var/cvsroot/gentoo-x86/eclass/autotools-multilib.eclass,v 1.7 2013/01/26 11:39:41 mgorny Exp $ +# $Header: /var/cvsroot/gentoo-x86/eclass/autotools-multilib.eclass,v 1.8 2013/02/01 21:39:50 mgorny Exp $ # @ECLASS: autotools-multilib.eclass # @MAINTAINER: @@ -29,96 +29,56 @@ if [[ ${AUTOTOOLS_IN_SOURCE_BUILD} ]]; then die "${ECLASS}: multilib support requires out-of-source builds." fi -inherit autotools-utils multilib multiprocessing +inherit autotools-utils multilib-build EXPORT_FUNCTIONS src_configure src_compile src_test src_install -IUSE=multilib - -# @ECLASS-VARIABLE: MULTILIB_USEDEP -# @DESCRIPTION: -# The USE-dependency to be used on dependencies (libraries) needing -# to support multilib as well. -# -# Example use: -# @CODE -# RDEPEND="dev-libs/libfoo[${MULTILIB_USEDEP}] -# net-libs/libbar[ssl,${MULTILIB_USEDEP}]" -# @CODE -MULTILIB_USEDEP='multilib(-)?' - -# @FUNCTION: autotools-multilib_foreach_abi -# @USAGE: argv... -# @DESCRIPTION: -# If multilib support is enabled, sets the toolchain up for each -# supported ABI along with the ABI variable and correct BUILD_DIR, -# and runs the given commands with them. -# -# If multilib support is disabled, it just runs the commands. No setup -# is done. -autotools-multilib_foreach_abi() { - local initial_dir=${BUILD_DIR:-${S}} - - if use multilib; then - local ABI - for ABI in $(get_all_abis); do - multilib_toolchain_setup "${ABI}" - BUILD_DIR=${initial_dir%%/}-${ABI} "${@}" - done - else - "${@}" - fi -} - -# @FUNCTION: autotools-multilib_parallel_foreach_abi -# @USAGE: argv... -# @DESCRIPTION: -# If multilib support is enabled, sets the toolchain up for each -# supported ABI along with the ABI variable and correct BUILD_DIR, -# and runs the given commands with them. The commands are run -# in parallel with number of jobs being determined from MAKEOPTS. -# -# If multilib support is disabled, it just runs the commands. No setup -# is done. -# -# Useful for running configure scripts. -autotools-multilib_parallel_foreach_abi() { - local initial_dir=${BUILD_DIR:-${S}} - - if use multilib; then - multijob_init - - local ABI - for ABI in $(get_all_abis); do - ( - multijob_child_init - - multilib_toolchain_setup "${ABI}" - BUILD_DIR=${initial_dir%%/}-${ABI} - "${@}" - ) & - - multijob_post_fork - done - - multijob_finish - else - "${@}" - fi -} - autotools-multilib_src_configure() { - autotools-multilib_parallel_foreach_abi autotools-utils_src_configure + multilib_parallel_foreach_abi autotools-utils_src_configure } autotools-multilib_src_compile() { - autotools-multilib_foreach_abi autotools-utils_src_compile + multilib_foreach_abi autotools-utils_src_compile } autotools-multilib_src_test() { - autotools-multilib_foreach_abi autotools-utils_src_test + multilib_foreach_abi autotools-utils_src_test } autotools-multilib_src_install() { - autotools-multilib_foreach_abi autotools-utils_src_install + autotools-multilib_secure_install() { + autotools-utils_src_install + + # Make sure all headers are the same for each ABI. + autotools-multilib_cksum() { + find "${ED}"usr/include -type f \ + -exec cksum {} + | sort -k2 + } + + local cksum=$(autotools-multilib_cksum) + local cksum_file=${T}/.autotools-multilib_cksum + + if [[ -f ${cksum_file} ]]; then + local cksum_prev=$(< "${cksum_file}") + + if [[ ${cksum} != ${cksum_prev} ]]; then + echo "${cksum}" > "${cksum_file}.new" + + eerror "Header files have changed between ABIs." + + if type -p diff &>/dev/null; then + eerror "$(diff -du "${cksum_file}" "${cksum_file}.new")" + else + eerror "Old checksums in: ${cksum_file}" + eerror "New checksums in: ${cksum_file}.new" + fi + + die "Header checksum mismatch, aborting." + fi + else + echo "${cksum}" > "${cksum_file}" + fi + } + + multilib_foreach_abi autotools-multilib_secure_install } diff --git a/eclass/multilib-build.eclass b/eclass/multilib-build.eclass new file mode 100644 index 000000000000..4298a541b7bc --- /dev/null +++ b/eclass/multilib-build.eclass @@ -0,0 +1,141 @@ +# Copyright 1999-2013 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /var/cvsroot/gentoo-x86/eclass/multilib-build.eclass,v 1.1 2013/02/01 21:39:50 mgorny Exp $ + +# @ECLASS: multilib-build.eclass +# @MAINTAINER: +# Michał Górny <mgorny@gentoo.org> +# @BLURB: flags and utility functions for building multilib packages +# @DESCRIPTION: +# The multilib-build.eclass exports USE flags and utility functions +# necessary to build packages for multilib in a clean and uniform +# manner. +# +# Please note that dependency specifications for multilib-capable +# dependencies shall use the USE dependency string in ${MULTILIB_USEDEP} +# to properly request multilib enabled. + +if [[ ! ${_MULTILIB_BUILD} ]]; then + +# EAPI=5 is required for meaningful MULTILIB_USEDEP. +case ${EAPI:-0} in + 5) ;; + *) die "EAPI=${EAPI} is not supported" ;; +esac + +inherit multilib multiprocessing + +# @ECLASS-VARIABLE: _MULTILIB_FLAGS +# @INTERNAL +# @DESCRIPTION: +# The list of multilib flags and corresponding ABI values. +_MULTILIB_FLAGS=( + abi_x86_32:x86 + abi_x86_64:amd64 +) + +# @ECLASS-VARIABLE: MULTILIB_USEDEP +# @DESCRIPTION: +# The USE-dependency to be used on dependencies (libraries) needing +# to support multilib as well. +# +# Example use: +# @CODE +# RDEPEND="dev-libs/libfoo[${MULTILIB_USEDEP}] +# net-libs/libbar[ssl,${MULTILIB_USEDEP}]" +# @CODE + +_multilib_build_set_globals() { + local flags=( "${_MULTILIB_FLAGS[@]%:*}" ) + local usedeps=${flags[@]/%/(-)?} + + IUSE=${flags[*]} + MULTILIB_USEDEP=${usedeps// /,} +} +_multilib_build_set_globals + +# @FUNCTION: multilib_get_enabled_abis +# @DESCRIPTION: +# Return the ordered list of enabled ABIs if multilib builds +# are enabled. The best (most preferred) ABI will come last. +# +# If multilib is disabled, the default ABI will be returned +# in order to enforce consistent testing with multilib code. +multilib_get_enabled_abis() { + debug-print-function ${FUNCNAME} "${@}" + + local abis=( $(get_all_abis) ) + + local abi i found + for abi in "${abis[@]}"; do + for i in "${_MULTILIB_FLAGS[@]}"; do + local m_abi=${i#*:} + local m_flag=${i%:*} + + if [[ ${m_abi} == ${abi} ]] && use "${m_flag}"; then + echo "${abi}" + found=1 + fi + done + done + + if [[ ! ${found} ]]; then + debug-print "${FUNCNAME}: no ABIs enabled, fallback to ${DEFAULT_ABI}" + echo ${DEFAULT_ABI} + fi +} + +# @FUNCTION: multilib_foreach_abi +# @USAGE: <argv>... +# @DESCRIPTION: +# If multilib support is enabled, sets the toolchain up for each +# supported ABI along with the ABI variable and correct BUILD_DIR, +# and runs the given commands with them. +# +# If multilib support is disabled, it just runs the commands. No setup +# is done. +multilib_foreach_abi() { + local initial_dir=${BUILD_DIR:-${S}} + + local ABI + for ABI in $(multilib_get_enabled_abis); do + multilib_toolchain_setup "${ABI}" + BUILD_DIR=${initial_dir%%/}-${ABI} "${@}" + done +} + +# @FUNCTION: multilib_parallel_foreach_abi +# @USAGE: <argv>... +# @DESCRIPTION: +# If multilib support is enabled, sets the toolchain up for each +# supported ABI along with the ABI variable and correct BUILD_DIR, +# and runs the given commands with them. The commands are run +# in parallel with number of jobs being determined from MAKEOPTS. +# +# If multilib support is disabled, it just runs the commands. No setup +# is done. +# +# Useful for running configure scripts. +multilib_parallel_foreach_abi() { + local initial_dir=${BUILD_DIR:-${S}} + + multijob_init + + local ABI + for ABI in $(multilib_get_enabled_abis); do + ( + multijob_child_init + + multilib_toolchain_setup "${ABI}" + BUILD_DIR=${initial_dir%%/}-${ABI} + "${@}" + ) & + + multijob_post_fork + done + + multijob_finish +} + +_MULTILIB_BUILD=1 +fi |