From 08baca17388dcd5d85d8fbb257daa0d85c94344b Mon Sep 17 00:00:00 2001 From: Christian Wiese Date: Sat, 9 Feb 2008 19:17:48 +0200 Subject: [PATCH] Added multilib parse-config which will handle packages flagged with MULTILIB Improved multilib parse-config first to cleanup and then injecting architecture specific compiler flags Note: Currently only x86-64 is implemented but others will be added as soon as they are tested properly! Improved readability of multilib parse-config replacing 'expr' and backtick notation multilib: fixed parse-config to backup arch_target and restore it after compiling --- lib/multilib/parse-config | 55 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 lib/multilib/parse-config diff --git a/lib/multilib/parse-config b/lib/multilib/parse-config new file mode 100644 index 0000000..e327baf --- /dev/null +++ b/lib/multilib/parse-config @@ -0,0 +1,55 @@ +# --- SDE-COPYRIGHT-NOTE-BEGIN --- +# This copyright note is auto-generated by ./scripts/Create-CopyPatch. +# +# Filename: lib/multilib/parse-config +# Copyright (C) 2008 - 2011 The OpenSDE Project +# +# More information can be found in the files COPYING and README. +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; version 2 of the License. A copy of the +# GNU General Public License can be found in the file COPYING. +# --- SDE-COPYRIGHT-NOTE-END --- + +# Multilib helper functions +# +# arch_abis A list of ABIs generated by architecture/$arch/parse-config +# with the default ABI as first element + +# function to set the abi taking buildloop as argument +multilib_abi_loop() { + abi=$( echo "$arch_abis" | cut -d ' ' "-f$1" ) + echo_status "Building multilib $pkg for $abi ABI" + + # cleanup architecture specific compiler flags + var_remove_regex CC_WRAPPER_INSERT ' ' '\-m.*' + var_remove_regex CXX_WRAPPER_INSERT ' ' '\-m.*' + + # inject architecture specific compiler flags + case "$arch" in + x86-64) + var_insert CC_WRAPPER_INSERT ' ' "-m$abi" + var_insert CXX_WRAPPER_INSERT ' ' "-m$abi" + ;; + esac + + # alter arch_target if we build 32bit + if [ "$abi" = "32" ]; then + # backup arch_target and restore it after compiling + hook_add postmake 9 "arch_target=$arch_target" + arch_target="$( echo $arch_target | arch2arch32 )" + echo_status "Setting arch_target to $arch_target" + fi + + # set a proper arch_suffix for pkggetdir to set the right libdir + arch_suffix=$abi + set_confopt +} + +if [ "$SDECFG_MULTILIB" == "1" ] && hasflag MULTILIB && ! atstage toolchain; then + echo_status "Enabling Multilib Support (selected ABIs: $arch_abis) (default: $SDECFG_ABI_DEFAULT)" + + multilib_buildloops="$( echo $arch_abis | wc -w )" + buildloops="$multilib_buildloops" +fi