aboutsummaryrefslogtreecommitdiff
path: root/eclass
diff options
context:
space:
mode:
authorGregory M. Tuner <gmt@be-evil.net>2014-06-02 18:25:52 -0700
committerGregory M. Tuner <gmt@be-evil.net>2014-06-02 18:25:52 -0700
commit0d3cfa8d0f043965f8000213ee8d0df3ecc403e5 (patch)
tree27b5da3e433600c1903621d6cd340b74eab1bb2d /eclass
parentdev-lang/python-2.7.6-r2: revbump/merge (also best->native migration) (diff)
downloadgmt-0d3cfa8d0f043965f8000213ee8d0df3ecc403e5.tar.gz
gmt-0d3cfa8d0f043965f8000213ee8d0df3ecc403e5.tar.bz2
gmt-0d3cfa8d0f043965f8000213ee8d0df3ecc403e5.zip
eclass/multilib-build: misc. bugfixes/ehancements
A few mistakes spotted in multilib-build.eclass are fixed here: Use the wrapper variable more Add comments to the very long if/else/for/etc clauses in multilib_prepare_wrappers which are starting to get pretty hard to read. Fix a thinko in multilib_prepare_wrappers which broke ^wrapped headers. Add the missing multilib_get_native_abi which was referred to but never actually implemented as a replacement for the old multilib_get_best_abi function. Signed-off-by: Gregory M. Tuner <gmt@be-evil.net>
Diffstat (limited to 'eclass')
-rw-r--r--eclass/multilib-build.eclass77
1 files changed, 43 insertions, 34 deletions
diff --git a/eclass/multilib-build.eclass b/eclass/multilib-build.eclass
index 2cdfc7f..3c9454f 100644
--- a/eclass/multilib-build.eclass
+++ b/eclass/multilib-build.eclass
@@ -677,7 +677,7 @@ multilib_prepare_wrappers() {
# Some ABIs may have install less files than others.
if [[ ${generate_wrapper} == yes && -f ${root}usr/include${f} ]]; then
local wrapper=${ED}tmp/multilib-include${f}
- if [[ ! -f ${ED}/tmp/multilib-include${f} ]]; then
+ if [[ ! -f "${wrapper}" ]]; then
einfo "generating multilib wrapper for header ${f}"
dodir "/tmp/multilib-include${dir}"
# a generic template
@@ -725,33 +725,34 @@ multilib_prepare_wrappers() {
# error "No ABI matched, please report a bug to bugs.gentoo.org"
#endif
_EOF_
- fi
-
+ fi # [[ ! -f "${wrapper}" ]]
if ! grep -q "${MULTILIB_ABI_FLAG} " "${wrapper}"
then
die "Flag ${MULTILIB_ABI_FLAG} not listed in wrapper template. Please report a bug to https://bugs.gentoo.org."
- fi
-
- # $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
- if [[ ${generate_wrapper} == yes ]] ; then
- # Note: match a space afterwards to avoid collision potential.
- sed -e "/${MULTILIB_ABI_FLAG} /s&error.*&include <${CHOST}${f}>&" \
+ fi # ! grep -q "${MULTILIB_ABI_FLAG} " "${wrapper}"
+ fi # [[ ${generate_wrapper} == yes && -f ${root}usr/include${f} ]]
+
+ # move the header whether ^wrapped or not
+ # $CHOST will have been set by multilib_toolchain_setup
+ dodir "/tmp/multilib-include/${CHOST}${dir}"
+ mv "${root}usr/include${f}" "${ED}tmp/multilib-include/${CHOST}${dir}/" || die
+
+ if [[ ${generate_wrapper} == yes ]] ; then
+ # Note: match a space afterwards to avoid collision potential.
+ sed -e "/${MULTILIB_ABI_FLAG} /s&error.*&include <${CHOST}${f}>&" \
+ -i "${wrapper}" || die
+
+ # Hack for emul-linux-x86 compatibility.
+ # It assumes amd64 will come after x86, and will use amd64
+ # headers if no specific x86 headers were installed.
+ if [[ ${ABI} == amd64 ]]; then
+ sed -e "/abi_x86_32 /s&error.*&include <${CHOST}${f}>&" \
-i "${wrapper}" || die
-
- # Hack for emul-linux-x86 compatibility.
- # It assumes amd64 will come after x86, and will use amd64
- # headers if no specific x86 headers were installed.
- if [[ ${ABI} == amd64 ]]; then
- sed -e "/abi_x86_32 /s&error.*&include <${CHOST}${f}>&" \
- -i "${wrapper}" || die
- fi
fi
- fi
- done
- fi
- fi
+ fi # [[ ${generate_wrapper} == yes ]]
+ done # for f in "${MULTILIB_WRAPPED_HEADERS[@]}"
+ fi # [[ ${MULTILIB_ABI_FLAG} ]]
+ fi # [[ ${MULTILIB_WRAPPED_HEADERS[@]} ]]
for f in "${MULTILIB_WRAPPED_EXECUTABLES[@]}" ; do
generate_wrapper=no
[[ ${f:0:1} == @ ]] && generate_wrapper=yes
@@ -789,7 +790,7 @@ _EOF_
ewarn "Destination \"${root}${f}-${ABI}\" will be over-written."
ewarn
rm -f "${root}${f}-${ABI}" || die
- fi
+ fi # [[ -f "${root}${f}-${ABI}" ]]
if [[ ${generate_wrapper} == yes ]] ; then
cp -T "${root}${f}" "${root}${f}-${ABI}" || die
@@ -814,9 +815,9 @@ _EOF_
remove_it=no
break
fi
- done
+ done # for f1 in "${MULTILIB_CHOST_TOOLS[@]}
[[ ${remove_it} == yes ]] && { rm -f "${root}${f}" || die ; }
- else
+ else # [[ ${generate_wrapper} == yes ]]
ln -T "${root}${f}" "${root}${f}-${ABI}" || die
# make wrapper like original
chown -c --reference="${root}${f}" "${root}${f}-${ABI}" || die "Cant chown \"${root}${f}-${ABI}\""
@@ -826,7 +827,7 @@ _EOF_
:
fi
touch --reference="${root}${f}" "${root}${f}-${ABI}" || die "Cant touch \"${root}${f}-${ABI}\""
- fi
+ fi # [[ ${generate_wrapper} != yes ]]
if multilib_is_native_abi && \
[[ ${generate_wrapper} == yes && ! -f "${ED}tmp/multilib-bin-wrappers/${f}" ]]; then
@@ -948,8 +949,8 @@ _EOF_
fi
touch --reference="${root}${f}-${ABI}" "${ED}tmp/multilib-bin-wrappers/${f}" || \
die "Cant touch \"${ED}tmp/multilib-bin-wrappers/${f}\""
- fi
- done
+ fi # multilib_is_native_abi && [[ ${generate_wrapper} == yes && ! -f "${ED}tmp/multilib-bin-wrappers/${f}" ]]
+ done # for f in "${MULTILIB_WRAPPED_EXECUTABLES[@]}"
# we put these last to ensure they peaceful coexistence with MULTILIB_WRAPPED_EXECUTABLES
# until MULTILIB_WRAPPED_EXECUTABLES can be merged into MULTILIB_CHOST_TOOLS.
@@ -968,7 +969,7 @@ _EOF_
done
return
- fi
+ fi # [[ ${COMPLETE_MULTILIB} == yes ]]
for f in "${MULTILIB_CHOST_TOOLS[@]}"; do
# drop leading slash if it's there
@@ -993,7 +994,7 @@ _EOF_
dosymlink=no
break
fi
- done
+ done # for f1 in "${MULTILIB_WRAPPED_EXECUTABLES[@]}"
# don't rewrite symlink targets if we are relying on redundant @wrapping!
# that would be bad (even if it worked it'd be awfully confusing)
@@ -1008,14 +1009,14 @@ _EOF_
rm "${root}${f}" || die
ln -f -s "${target_dir+${target_dir}/}${CHOST}-${target_fn}" \
"${root}${f}" || die
- elif [[ -L "${root}${f}" ]]; then
+ elif [[ -L "${root}${f}" ]]; then # [[ ${dosymlink} == yes && -L "${root}${f}" ]]
ewarn "============ hell no ==============="
ewarn "\"${root}${f}\" is installed as a symlink by upstream or ebuild code; meanwhile,"
ewarn "it is both @wrapped in MULTILIB_WRAPPED_EXECUTABLES and present in MULTILIB_CHOST_TOOLS."
ewarn "If that makes perfect sense to you, you're smarter than me."
ewarn "===================================="
die "\"${root}${f}\" seems 'semantically oversaturated'; giving up the ghost."
- fi
+ fi # [[ ( ${dosymlink} != yes || -L "${root}${f}" ) && -L "${root}${f}"
# move whatever it is to the ${CHOST}-prefixed name
mv "${root}${f}" "${root}${dir}/${CHOST}-${fn}" || die
@@ -1025,7 +1026,7 @@ _EOF_
ln -s "${CHOST}-${fn}" "${root}${f}" || die
einfo "MULTILIB_CHOST_TOOLS: re-created \"${root}${f}\" as a symlink to \"${CHOST}-${fn}\"."
fi
- done
+ done # for f in "${MULTILIB_CHOST_TOOLS[@]}"
}
# @FUNCTION: multilib_install_wrappers
@@ -1113,6 +1114,14 @@ multilib_get_best_abi() {
# yes, the >&2 may actually do something... see isolated-functions.sh
eqawarn "QA warning: multilib_is_best_abi is deprecated. Please use the equivalent" >&2
eqawarn "multilib_is_native_abi function instead." >&2
+ multilib_get_native_abi "$@"
+}
+
+# @FUNCTION: multilib_get_native_abi
+# @DESCRIPTION:
+# Depreciated function to return the best ABI. Just returns the native ABI
+# instead. :(
+multilib_get_native_abi() {
echo "${DEFAULT_ABI:-default}"
}