aboutsummaryrefslogtreecommitdiff
path: root/eclass
diff options
context:
space:
mode:
authorGregory M. Tuner <gmt@be-evil.net>2014-01-06 09:55:45 -0800
committerGregory M. Tuner <gmt@be-evil.net>2014-01-06 09:55:45 -0800
commitb8f4a890660d6def816d9abcc5b02a6defb435f7 (patch)
tree025f071a7f3618bf48f19ab1b831a946b33aa88a /eclass
parentsys-apps/util-linux: gen_usr_ldscript suppression (diff)
downloadgmt-b8f4a890660d6def816d9abcc5b02a6defb435f7.tar.gz
gmt-b8f4a890660d6def816d9abcc5b02a6defb435f7.tar.bz2
gmt-b8f4a890660d6def816d9abcc5b02a6defb435f7.zip
eclass/multlib-build: drop no-longer-pertinent comment verbiage
Signed-off-by: Gregory M. Tuner <gmt@be-evil.net>
Diffstat (limited to 'eclass')
-rw-r--r--eclass/multilib-build.eclass162
-rw-r--r--eclass/multilib.eclass15
2 files changed, 129 insertions, 48 deletions
diff --git a/eclass/multilib-build.eclass b/eclass/multilib-build.eclass
index 0c61075..cdd650e 100644
--- a/eclass/multilib-build.eclass
+++ b/eclass/multilib-build.eclass
@@ -46,42 +46,43 @@ _MULTILIB_FLAGS=(
# Sanity checking variable enumerating known ABI values. A way to discover
# situations where this eclass and PORTDIR have fallen out-of-sync. To update/check, use:
# find /usr/portage/profiles -type f | xargs grep '^\(DEFAULT_\)ABI\{0,1\}='
+#
+# Note that despite the name, these are not required to be multilib ABI's -- the complete list of ABI's
+# supported by the gentoo repository is supposed to go here.
+#
+# TODO: add prefix ABI's here!
_MULTILIB_ABI_WHITELIST=( x86 amd64 x32 n32 n64 o32 s390 s390x sparc32 sparc64 ppc ppc64 amd64_fbsd x86_fbsd )
# @FUNCTION: get_multilib_build_abis
+# @USAGE: [--dependmode]
# @DESCRIPTION:
# Returns a list of abis with multiple-abi multilib-build support
# This is a global list of all ABI values which have corresponding
# flags in the global hard-coded database of multibuild-compatible ABI's
-# (_MULTILIB_FLAGS). As of this writing, it returns:
+# (_MULTILIB_FLAGS). As of this writing, it returns at least these:
#
# "x86 x86_fbsd amd64 amd64_fbsd x32 n32 n64 o32"
#
-# Results go to standard output.
+# Results go to standard output. If the current DEFAULT_ABI is
+# not present in the list, it will be appended; otherwise,
+# it will be placed at the end of the list -- therefore,
+# the standard result is not a suitable basis for the generation of
+# package-manager-cached metadata.
+#
+# However, if the --dependmode argument is supplied, then this
+# API will act as though the default ABI was "default" and therefore
+# act in a completely deterministic manner suitable for this purpose.
get_multilib_build_abis() {
+ [[ $# -gt 1 ]] && die "${FUNCNAME} takes at most one argument"
local rslt=${_MULTILIB_FLAGS[*]##*:}
- echo "${rslt//,/ }"
-}
-
-# @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// /,}
+ rslt=" ${rslt//,/ } "
+ if [[ ${1} == --dependmode ]] ; then
+ rslt=$(echo ${rslt} default)
+ else
+ rslt=$(echo ${rslt/ ${DEFAULT_ABI:-default} / } ${DEFAULT_ABI:-default})
+ fi
+ echo ${rslt}
}
-_multilib_build_set_globals
# @FUNCTION: multilib_abi_flag
# @USAGE: <abi>
@@ -109,9 +110,56 @@ multilib_abi_flag() {
done
debug-print "${FUNCNAME}: No multilib abi \"${abi}\" found, returning nothing"
- return 0
+ return 1
}
+# @FUNCTION: multilib_flag_abi
+# @USAGE: <flag>
+# @DESCRIPTION:
+# Returns, when applicable, any active multilib ABI corresponding
+# to the provided abi_<arch> USE_EXPAND USE-flag, by way of
+# output to standard output.
+#
+# Due to the recycling of use-flags in the multilib-build
+# framework between ABIs, this API cannot return purely
+# functional package-manager-independant information
+# suitable for cacheable ebuild settings, such as those
+# in generated USE dependencies.
+#
+# However, for many other purposes it is quite practical to
+# want to map back freely from flag to ABI values. This tries.
+#
+# If no such mapping is to be found, this does not fall back to
+# the default ABI. It instead will silently return a nonzero
+# failure code.
+multilib_flag_abi() {
+ debug-print-function ${FUNCNAME} "${@}"
+
+ local i req_flag=${1} test_flag test_abis test_abi enabled_abi
+ for i in "${_MULTILIB_FLAGS[@]}"; do
+ test_flag=${i%:*}
+ [[ ${test_flag} == ${req_flag} ]] || continue
+ test_abis=${i#*:}
+ for test_abi in ${test_abis//,/ }; do
+ for enabled_abi in $(get_all_abis); do
+ if [[ ${enabled_abi} == ${test_abi} ]] ; then
+ # a match! return it.
+ echo "${test_abi}"
+ return 0
+ fi
+ done
+ done
+ done
+ return 1
+}
+
+# @ECLASS-VARIABLE: _MULTILIB_BUILD_CACHED_ENABLED_ABIS
+# @INTERNAL
+# @DEFAULT-UNSET
+# @DESCRIPTION:
+# Set to the result of multilib_get_enabled_abis after
+# that function is invoked the first time.
+
# @FUNCTION: multilib_get_enabled_abis
# @DESCRIPTION:
# Return the ordered list of enabled ABIs if multilib builds
@@ -122,6 +170,12 @@ multilib_abi_flag() {
multilib_get_enabled_abis() {
debug-print-function ${FUNCNAME} "${@}"
+ if [[ ${_MULTILIB_BUILD_CACHED_ENABLED_ABIS} ]]; then
+ echo "${_MULTILIB_BUILD_CACHED_ENABLED_ABIS}"
+ debug-print "${FUNCNAME} result (cached): \"${_MULTILIB_BUILD_CACHED_ENABLED_ABIS}\""
+ return 0
+ fi
+
local abis=( $(get_all_abis) )
local abi i found
@@ -135,7 +189,7 @@ multilib_get_enabled_abis() {
# for the split is more complex than cheating like this
for m_abi in ${m_abis//,/ }; do
if [[ ${m_abi} == ${abi} ]] && use "${m_flag}"; then
- echo "${abi}"
+ _MULTILIB_BUILD_CACHED_ENABLED_ABIS+="${_MULTILIB_BUILD_CACHED_ENABLED_ABIS:+ }${abi}"
found=1
break 2
fi
@@ -146,14 +200,44 @@ multilib_get_enabled_abis() {
if [[ ! ${found} ]]; then
# ${ABI} can be used to override the fallback (multilib-portage),
# ${DEFAULT_ABI} is the safe fallback.
- local abi=${ABI:-${DEFAULT_ABI}}
+ abi=${ABI:-${DEFAULT_ABI:-default}}
debug-print "${FUNCNAME}: no ABIs enabled, fallback to ${abi}"
debug-print "${FUNCNAME}: ABI=${ABI}, DEFAULT_ABI=${DEFAULT_ABI}"
- echo ${abi}
+ _MULTILIB_BUILD_CACHED_ENABLED_ABIS=${abi}
fi
+ echo "${_MULTILIB_BUILD_CACHED_ENABLED_ABIS}"
+ debug-print "${FUNCNAME}: result (calculated): \"${_MULTILIB_BUILD_CACHED_ENABLED_ABIS}\""
}
+# @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// /,}
+
+ # since it tends always to be run in a subshell,
+ # multilib_get_enabled_abis may fail to generate
+ # the cache; run it once, here, in ${PID}. But, if
+ # we are in the depend phase, folks really
+ # ought not to be using it, anyhow, and it will
+ # waste time. So don't do it, in that case.
+ [[ ${EBUILD_PHASE} != depend ]] && multilib_get_enabled_abis > /dev/null
+}
+_multilib_build_set_globals
+
# @FUNCTION: _multilib_multibuild_wrapper
# @USAGE: <argv>...
# @INTERNAL
@@ -611,21 +695,21 @@ _EOF_
ewarn "Name collision wrapping multilib executable \"${f}\"."
ewarn "Destination \"${root}${f}-${ABI}\" will be over-written."
ewarn
- rm -fv "${root}${f}-${ABI}" || die
+ rm -f "${root}${f}-${ABI}" || die
fi
if [[ ${generate_wrapper} == yes ]] ; then
- cp -vT "${root}${f}" "${root}${f}-${ABI}" || die
+ cp -T "${root}${f}" "${root}${f}-${ABI}" || die
# make wrapper like original
- chown -cv --reference="${root}${f}" "${root}${f}-${ABI}" || die "Cant chown \"${root}${f}-${ABI}\""
- chmod -cv --reference="${root}${f}" "${root}${f}-${ABI}" || die "Cant chmod \"${root}${f}-${ABI}\""
+ chown -c --reference="${root}${f}" "${root}${f}-${ABI}" || die "Cant chown \"${root}${f}-${ABI}\""
+ chmod -c --reference="${root}${f}" "${root}${f}-${ABI}" || die "Cant chmod \"${root}${f}-${ABI}\""
touch --reference="${root}${f}" "${root}${f}-${ABI}" || die "Cant touch \"${root}${f}-${ABI}\""
- rm -vf "${root}${f}"
+ rm -f "${root}${f}"
else
- ln -vT "${root}${f}" "${root}${f}-${ABI}" || die
+ ln -T "${root}${f}" "${root}${f}-${ABI}" || die
# make wrapper like original
- chown -cv --reference="${root}${f}" "${root}${f}-${ABI}" || die "Cant chown \"${root}${f}-${ABI}\""
- chmod -cv --reference="${root}${f}" "${root}${f}-${ABI}" || die "Cant chmod \"${root}${f}-${ABI}\""
+ chown -c --reference="${root}${f}" "${root}${f}-${ABI}" || die "Cant chown \"${root}${f}-${ABI}\""
+ chmod -c --reference="${root}${f}" "${root}${f}-${ABI}" || die "Cant chmod \"${root}${f}-${ABI}\""
touch --reference="${root}${f}" "${root}${f}-${ABI}" || die "Cant touch \"${root}${f}-${ABI}\""
fi
@@ -738,15 +822,15 @@ _EOF_
{ eend $? ; die "executable wrapper linking failed for ${f_c%.c}.o in \"${fwrap_dir}\"" ; }
einfo "Deploying compiled wrapper to staging area in \"/tmp/multilib-bin-wrappers/${dir}\"."
mkdir -p "${ED}tmp/multilib-bin-wrappers/${dir}" || die
- cp -v "${f_c%.c}" "${ED}tmp/multilib-bin-wrappers/${f}" || die
+ cp "${f_c%.c}" "${ED}tmp/multilib-bin-wrappers/${f}" || die
eend $?
popd > /dev/null || die
}
multilib_for_best_abi do_executable_wrapper_compile
# make wrapper-executable like -ABI wrapped executable
- chown -cv --reference="${root}${f}-${ABI}" "${ED}tmp/multilib-bin-wrappers/${f}" || \
+ chown -c --reference="${root}${f}-${ABI}" "${ED}tmp/multilib-bin-wrappers/${f}" || \
die "Cant chown \"${ED}tmp/multilib-bin-wrappers/${f}\""
- chmod -cv --reference="${root}${f}-${ABI}" "${ED}tmp/multilib-bin-wrappers/${f}" || \
+ chmod -c --reference="${root}${f}-${ABI}" "${ED}tmp/multilib-bin-wrappers/${f}" || \
die "Cant chmod \"${ED}tmp/multilib-bin-wrappers/${f}\""
touch --reference="${root}${f}-${ABI}" "${ED}tmp/multilib-bin-wrappers/${f}" || \
die "Cant touch \"${ED}tmp/multilib-bin-wrappers/${f}\""
@@ -861,6 +945,8 @@ multilib_get_best_abi() {
# the pseudo-flag argument is preceeded by an exclamation point) would
# be immediately returned, regardless of any underlying "truth" pertaining
# to the multilib_build framework.
+#
+# TODO: handle prefix ABI's
abi_arch_use() {
debug-print-function ${FUNCNAME} "$@"
diff --git a/eclass/multilib.eclass b/eclass/multilib.eclass
index aad705b..bf59bb4 100644
--- a/eclass/multilib.eclass
+++ b/eclass/multilib.eclass
@@ -469,17 +469,12 @@ multilib_toolchain_setup() {
# I find this pretty confusing. I don't think we want to let tc-getPKG_CONFIG
# look up our pkg-config for us once we change CHOST -- that is now going to
# pick up the <abi-tuple>-pkg-config executable which could come from crossdev
- # or god-knows where... so basically unless we are doing a compile for crossdev, we want
+ # or god-knows where... unless we are doing a compile for crossdev, we want
# to treat all multi-abi pkg-configs the same, /except/ for the two variables
- # above... I guess? Who fucking knows, this will probably break something somewhere
- # but I am inclined to think that such breakage might indicate a bug in the
- # consuming ebuild instead of here. It's a fucking text-file processor, after all,
- # like "sed". Who cares if we run our own so long as we give it the right environment
- # variables? An alternative idea would be to always rely on tc-get-BUILD_PKG_CONFIG
- # in preference to tc-getPKG_CONFIG. Although the names are confusing, I think
- # the results of using that in preference to tc-getPKG_CONFIG would actually fix
- # a lot of portage problems. A third alternative would be to special-case tc-getPKG_CONFIG
- # to return results from the build machine....
+ # above.
+ #
+ # pkg-config is a text-file processor, after all, like "sed". Who cares if we
+ # run our own so long as we give it the right environment variables?
#
# Not sure I'm happy with any of these solutions or the one below. If anyone
# has a crystal-clear idea of the full semantic import of this... drop me a line!