-# Copyright 1999-2015 Gentoo Foundation
+# Copyright 2013-2020 Gentoo Authors
# Distributed under the terms of the GNU General Public License v2
-# $Id$
# @ECLASS: multilib-build.eclass
# @MAINTAINER:
# gx86-multilib team <multilib@gentoo.org>
# @AUTHOR:
# Author: Michał Górny <mgorny@gentoo.org>
+# @SUPPORTED_EAPIS: 4 5 6 7
# @BLURB: flags and utility functions for building multilib packages
# @DESCRIPTION:
# The multilib-build.eclass exports USE flags and utility functions
# EAPI=4 is required for meaningful MULTILIB_USEDEP.
case ${EAPI:-0} in
- 4|5) ;;
+ 4|5|6|7) ;;
*) die "EAPI=${EAPI} is not supported" ;;
esac
+[[ ${EAPI} == [45] ]] && inherit eutils
inherit multibuild multilib
# @ECLASS-VARIABLE: _MULTILIB_FLAGS
# Please contact multilib before modifying this list. This way we can
# ensure that every *preliminary* work is done and the multilib can be
# extended safely.
-declare -g -r _MULTILIB_FLAGS=(
+_MULTILIB_FLAGS=(
abi_x86_32:x86,x86_fbsd,x86_freebsd,x86_linux,x86_macos,x86_solaris
abi_x86_64:amd64,amd64_fbsd,x64_freebsd,amd64_linux,x64_macos,x64_solaris
abi_x86_x32:x32
abi_mips_n32:n32
abi_mips_n64:n64
abi_mips_o32:o32
- abi_ppc_32:ppc,ppc_aix,ppc_macos
- abi_ppc_64:ppc64
+# abi_ppc_32:ppc,ppc_aix,ppc_macos
+# abi_ppc_64:ppc64
+ abi_riscv_lp64d:lp64d
+ abi_riscv_lp64:lp64
abi_s390_32:s390
abi_s390_64:s390x
)
+readonly _MULTILIB_FLAGS
# @ECLASS-VARIABLE: MULTILIB_COMPAT
# @DEFAULT_UNSET
local usedeps=${flags[@]/%/(-)?}
IUSE=${flags[*]}
- declare -g -r MULTILIB_USEDEP=${usedeps// /,}
+ MULTILIB_USEDEP=${usedeps// /,}
+ readonly MULTILIB_USEDEP
}
_multilib_build_set_globals
+unset -f _multilib_build_set_globals
# @FUNCTION: multilib_get_enabled_abis
# @DESCRIPTION:
multilib_for_best_abi() {
debug-print-function ${FUNCNAME} "${@}"
+ [[ ${EAPI} == [45] ]] || die "${FUNCNAME} is banned in EAPI ${EAPI}, use multilib_is_native_abi() instead"
+
eqawarn "QA warning: multilib_for_best_abi() function is deprecated and should"
eqawarn "not be used. The multilib_is_native_abi() check may be used instead."
_multilib_header_cksum() {
set -o pipefail
- if [[ -d ${ED}usr/include ]]; then
- find "${ED}"usr/include -type f \
+ if [[ -d ${ED%/}/usr/include ]]; then
+ find "${ED%/}"/usr/include -type f \
-exec cksum {} + | sort -k2
fi
}
local cksum cksum_prev
local cksum_file=${T}/.multilib_header_cksum
cksum=$(_multilib_header_cksum) || die
+ unset -f _multilib_header_cksum
if [[ -f ${cksum_file} ]]; then
cksum_prev=$(< "${cksum_file}") || die
# MULTILIB_CHOST_TOOLS=(
# /usr/bin/foo-config
# )
-
# @CODE
+
# @FUNCTION: multilib_prepare_wrappers
# @USAGE: [<install-root>]
# @DESCRIPTION:
[[ ${#} -le 1 ]] || die "${FUNCNAME}: too many arguments"
- local root=${1:-${ED}}
+ local root=${1:-${ED%/}}
local f
if [[ ${COMPLETE_MULTILIB} == yes ]]; then
# Some ABIs may have install less files than others.
if [[ -f ${root}/usr/include${f} ]]; then
- local wrapper=${ED}/tmp/multilib-include${f}
+ local wrapper=${ED%/}/tmp/multilib-include${f}
- if [[ ! -f ${ED}/tmp/multilib-include${f} ]]; then
+ if [[ ! -f ${ED%/}/tmp/multilib-include${f} ]]; then
dodir "/tmp/multilib-include${dir}"
# a generic template
cat > "${wrapper}" <<_EOF_ || die
#elif defined(__i386__) /* plain x86 */
# error "abi_x86_32 not supported by the package."
#elif defined(__mips__)
-# if(_MIPS_SIM == _ABIN32) /* n32 */
-# error "abi_mips_n32 not supported by the package."
-# elif(_MIPS_SIM == _ABI64) /* n64 */
-# error "abi_mips_n64 not supported by the package."
-# elif(_MIPS_SIM == _ABIO32) /* o32 */
-# error "abi_mips_o32 not supported by the package."
-# endif
+# if(_MIPS_SIM == _ABIN32) /* n32 */
+# error "abi_mips_n32 not supported by the package."
+# elif(_MIPS_SIM == _ABI64) /* n64 */
+# error "abi_mips_n64 not supported by the package."
+# elif(_MIPS_SIM == _ABIO32) /* o32 */
+# error "abi_mips_o32 not supported by the package."
+# endif
+#elif defined(__riscv)
+# if defined(__riscv_float_abi_double)
+# error "abi_riscv_lp64d not supported by the package."
+# elif defined(__riscv_float_abi_single)
+# error "abi_riscv_lp64f not supported by the package."
+# else
+# error "abi_riscv_lp64 not supported by the package."
+# endif
#elif defined(__sparc__)
# if defined(__arch64__)
-# error "abi_sparc_64 not supported by the package."
+# error "abi_sparc_64 not supported by the package."
# else
-# error "abi_sparc_32 not supported by the package."
+# error "abi_sparc_32 not supported by the package."
# endif
#elif defined(__s390__)
# if defined(__s390x__)
-# error "abi_s390_64 not supported by the package."
+# error "abi_s390_64 not supported by the package."
# else
-# error "abi_s390_32 not supported by the package."
+# error "abi_s390_32 not supported by the package."
# endif
-#elif defined(__powerpc__)
-# if defined(__powerpc64__)
-# error "abi_ppc_64 not supported by the package."
+#elif defined(__powerpc__) || defined(__ppc__)
+# if defined(__powerpc64__) || defined(__ppc64__)
+# error "abi_ppc_64 not supported by the package."
# else
-# error "abi_ppc_32 not supported by the package."
+# error "abi_ppc_32 not supported by the package."
# endif
#elif defined(SWIG) /* https://sourceforge.net/p/swig/bugs/799/ */
# error "Native ABI not supported by the package."
# $CHOST shall be set by multilib_toolchain_setup
dodir "/tmp/multilib-include/${CHOST}${dir}"
- mv "${root}/usr/include${f}" "${ED}/tmp/multilib-include/${CHOST}${dir}/" || die
+ mv "${root}/usr/include${f}" "${ED%/}/tmp/multilib-include/${CHOST}${dir}/" || die
# Note: match a space afterwards to avoid collision potential.
sed -e "/${MULTILIB_ABI_FLAG} /s&error.*&include <${CHOST}${f}>&" \
local root=${1:-${ED}}
- if [[ -d "${ED}"/tmp/multilib-include ]]; then
+ if [[ -d ${ED%/}/tmp/multilib-include ]]; then
multibuild_merge_root \
- "${ED}"/tmp/multilib-include "${root}"/usr/include
+ "${ED%/}"/tmp/multilib-include "${root}"/usr/include
# it can fail if something else uses /tmp
- rmdir "${ED}"/tmp &>/dev/null
+ rmdir "${ED%/}"/tmp &>/dev/null
fi
}
multilib_build_binaries() {
debug-print-function ${FUNCNAME} "${@}"
+ [[ ${EAPI} == [45] ]] || die "${FUNCNAME} is banned in EAPI ${EAPI}, use multilib_is_native_abi() instead"
+
eqawarn "QA warning: multilib_build_binaries is deprecated. Please use the equivalent"
eqawarn "multilib_is_native_abi function instead."