aboutsummaryrefslogtreecommitdiff
path: root/eclass
diff options
context:
space:
mode:
authorGregory M. Tuner <gmt@be-evil.net>2014-06-01 15:10:57 -0700
committerGregory M. Tuner <gmt@be-evil.net>2014-06-01 15:10:57 -0700
commit85644c62947f9d7b671afd8afc7d56792ca45ad0 (patch)
tree7c24ad3be977175f246aff6f77d9db0ec69339b9 /eclass
parentdev-libs/gobject-introspection: avoid multilib_for_best_abi (diff)
downloadgmt-85644c62947f9d7b671afd8afc7d56792ca45ad0.tar.gz
gmt-85644c62947f9d7b671afd8afc7d56792ca45ad0.tar.bz2
gmt-85644c62947f9d7b671afd8afc7d56792ca45ad0.zip
eclass/multilib-build: kill multilib_for_native_abi
This function is incredibly difficult to implement correctly. For all intents and purposes, without employing extremely aggressive hacks, it simply is not possible to nest multilib abi iterations in gentoo. Anyhow, my only remaining use of it was pretty stupid anyhow, and causing bugs too -- the creation of the multilib executable wrappers for @wrapped executables. Instead of the fairly insane approach of nested iteration, I now simply build the wrapper during native abi subphase execution. Signed-off-by: Gregory M. Tuner <gmt@be-evil.net>
Diffstat (limited to 'eclass')
-rw-r--r--eclass/multilib-build.eclass106
1 files changed, 38 insertions, 68 deletions
diff --git a/eclass/multilib-build.eclass b/eclass/multilib-build.eclass
index a2decd9..2cdfc7f 100644
--- a/eclass/multilib-build.eclass
+++ b/eclass/multilib-build.eclass
@@ -402,48 +402,13 @@ multilib_parallel_foreach_abi() {
multibuild_parallel_foreach_variant _multilib_multibuild_wrapper "${@}"
}
-# @FUNCTION: multilib_for_best_abi
-# @USAGE: <argv>...
-# @DESCRIPTION:
-# Runs the given command with setup for the 'best' (usually native) ABI.
-multilib_for_best_abi() {
- debug-print-function ${FUNCNAME} "${@}"
-
- eqawarn "QA warning: multilib_for_best_abi() function is deprecated and should"
- eqawarn "not be used. Use multilib_for_native_abi instead"
-
- multilib_for_native_abi "${@}"
-}
-
-# @FUNCTION: multilib_for_native_abi
-# @USAGE: <argv>....
-# @DESCRIPTION:
-# While iterating through ABIs, allows one to temporarily assume the context of
-# the native ABI, and then resume iterating where one left off. If called outside
-# of multilib ABI iteration, this acts as a noop-wrapper, simply invoking its
-# arguments and returning the result.
-multilib_for_native_abi() {
- debug-print-function ${FUNCNAME} "${@}"
-
- if multilib_is_native_abi; then
- "${@}"
- else
- do_if_is_native_multilib_variant() {
- [[ ${MULTIBUILD_VARIANT#*.} == ${DEFAULT_ABI:-default} ]] ||
- return 0
- _multilib_multibuild_wrapper "${@}"
- }
- multibuild_foreach_variant do_if_is_native_multilib_variant "${@}"
- fi
-}
-
# @ECLASS-VARIABLE: MULTILIB_UNCHECKED_HEADERS
# @DESCRIPTION:
# A list of header files to ignore when checking for header conflicts.
# If an ebuild or eclass author has implemented their own solution
# to a possible header conflict, (if appropriate, that solution may
# simply be to ignore it, which would typically result in the
-# native ABI's header being installed (see: multilib_for_native_abi)
+# native ABI's header being installed.
#
# This variable has to be a bash array. Paths shall be relative to
# installation root (${ED}), and name regular files.
@@ -836,7 +801,21 @@ _EOF_
:
fi
touch --reference="${root}${f}" "${root}${f}-${ABI}" || die "Cant touch \"${root}${f}-${ABI}\""
- rm -f "${root}${f}"
+
+ # if the file is redundantly in MULTILIB_CHOST_TOOLS, we mustn't remove it.
+ local remove_it=yes
+ for f1 in "${MULTILIB_CHOST_TOOLS[@]}" ; do
+ # strip leading slashes
+ f1="${f1#/}"
+ [[ ${f1} =~ ^/+ ]] && f1="${f1#${BASH_REMATCH[0]}}"
+ # and then usr/include
+ f1="${f1#usr/include}"
+ if [[ ${f} == ${f1} ]] ; then
+ remove_it=no
+ break
+ fi
+ done
+ [[ ${remove_it} == yes ]] && { rm -f "${root}${f}" || die ; }
else
ln -T "${root}${f}" "${root}${f}-${ABI}" || die
# make wrapper like original
@@ -849,7 +828,8 @@ _EOF_
touch --reference="${root}${f}" "${root}${f}-${ABI}" || die "Cant touch \"${root}${f}-${ABI}\""
fi
- if [[ ${generate_wrapper} == yes && ! -f "${ED}tmp/multilib-bin-wrappers/${f}" ]]; then
+ if multilib_is_native_abi && \
+ [[ ${generate_wrapper} == yes && ! -f "${ED}tmp/multilib-bin-wrappers/${f}" ]]; then
# we need to get the enabled abis in case somehow we are invoked by an inner layer of multi-ness
local max_abi_len=0 a enabled_abis=( $(multilib_get_enabled_abis) )
for a in "${enabled_abis[@]}" ; do
@@ -943,26 +923,20 @@ _EOF_
}
_EOF_
- do_executable_wrapper_compile() {
- einfo "Performing wrapper compilation in \"${fwrap_dir}\"."
- pushd "${fwrap_dir}" > /dev/null || die
- # we can just do normal tc-getCC here and it will almost always work;
- # however, technically, the best ABI doesn't have to be the same as
- # the native ABI -- therefore we follow the standard recipe:
- local cc=${CC:-$(tc-getCC)}
- ebegin "Compiling wrapper: ${cc} ${CFLAGS} ${f_c} -c -o ${f_c%.c}.o"
- "${cc}" ${CFLAGS} "${f_c}" -c -o "${f_c%.c}.o" || \
- { eend $? ; die "executable wrapper compilation failed for ${f_c} in \"${fwrap_dir}\"" ; }
- einfo "Linking wrapper: ${cc} ${LDFLAGS} ${f_c%.c}.o -o ${f_c%.c}"
- "${cc}" ${LDFLAGS} "${f_c%.c}.o" -o "${f_c%.c}" || \
- { 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 "${f_c%.c}" "${ED}tmp/multilib-bin-wrappers/${f}" || die
- eend $?
- popd > /dev/null || die
- }
- multilib_for_native_abi do_executable_wrapper_compile
+ einfo "Performing wrapper compilation in \"${fwrap_dir}\"."
+ pushd "${fwrap_dir}" > /dev/null || die
+ local cc=${CC:-$(tc-getCC)}
+ ebegin "Compiling wrapper: ${cc} ${CFLAGS} ${f_c} -c -o ${f_c%.c}.o"
+ ${cc} ${CFLAGS} "${f_c}" -c -o "${f_c%.c}.o" || \
+ { eend $? ; die "executable wrapper compilation failed for ${f_c} in \"${fwrap_dir}\"" ; }
+ einfo "Linking wrapper: ${cc} ${LDFLAGS} ${f_c%.c}.o -o ${f_c%.c}"
+ ${cc} ${LDFLAGS} "${f_c%.c}.o" -o "${f_c%.c}" || \
+ { eend $? ; die "executable wrapper linking failed for ${f_c%.c}.o in \"${fwrap_dir}\"" ; }
+ einfo "Deploying compiled wrapper to staging area."
+ mkdir -p "${ED}tmp/multilib-bin-wrappers/${dir}" || die
+ cp "${f_c%.c}" "${ED}tmp/multilib-bin-wrappers/${f}" || die
+ eend $?
+ popd > /dev/null || die
# make wrapper-executable like -ABI wrapped executable
chown -c --reference="${root}${f}-${ABI}" "${ED}tmp/multilib-bin-wrappers/${f}" || \
die "Cant chown \"${ED}tmp/multilib-bin-wrappers/${f}\""
@@ -1043,17 +1017,13 @@ _EOF_
die "\"${root}${f}\" seems 'semantically oversaturated'; giving up the ghost."
fi
- # always copy whatever it is to the ${CHOST}-prefixed name
- cp "${root}${f}" "${root}${dir}/${CHOST}-${fn}" || die
+ # move whatever it is to the ${CHOST}-prefixed name
+ mv "${root}${f}" "${root}${dir}/${CHOST}-${fn}" || die
- # symlink the native one back (unless it's redundantly @wrapped -- in that case, leave it be)
- if multilib_is_native_abi; then
- if [[ ${dosymlink} == yes ]]; then
- rm "${root}${f}" || die
- ln -s "${CHOST}-${fn}" "${root}${f}" || die
- fi
- else
- rm "${root}${f}" || die
+ # symlink the native one back (unless it's redundantly @wrapped)
+ if multilib_is_native_abi && [[ ${dosymlink} == yes ]]; then
+ ln -s "${CHOST}-${fn}" "${root}${f}" || die
+ einfo "MULTILIB_CHOST_TOOLS: re-created \"${root}${f}\" as a symlink to \"${CHOST}-${fn}\"."
fi
done
}