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
user/amery/multilib
@ -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 |
||||