From 8c6b9a513101ed62c8cff682f35b1cf752a69818 Mon Sep 17 00:00:00 2001 From: P. J. McDermott Date: Thu, 08 Nov 2012 13:58:47 -0500 Subject: Try to detect a suitable build system host arch. --- (limited to 'lib') diff --git a/lib/buildsystem.sh b/lib/buildsystem.sh index 5c9579a..37f6ac1 100644 --- a/lib/buildsystem.sh +++ b/lib/buildsystem.sh @@ -81,10 +81,11 @@ oh_set_buildsystem_option() oh_buildsystem_do() { - _oh_local _ohbsd_step _ohbsd_bs + _oh_local _ohbsd_test_step _ohbsd_step _ohbsd_bs if [ ${#} -ge 1 ]; then - _ohbsd_step="${1}" + _ohbsd_test_step="${1%%:*}" + _ohbsd_step="${1#*:}" shift 1 else _oh_return 125 @@ -92,14 +93,14 @@ oh_buildsystem_do() fi if [ -n "${_OH_BUILDSYSTEM_SYSTEM}" ]; then - if "_oh_${_OH_BUILDSYSTEM_SYSTEM}_can_${_ohbsd_step}"; then + if "_oh_${_OH_BUILDSYSTEM_SYSTEM}_can_${_ohbsd_test_step}"; then "_oh_${_OH_BUILDSYSTEM_SYSTEM}_${_ohbsd_step}" "${@}" _oh_return ${?} return ${?} fi else for _ohbsd_bs in ${_OH_BUILDSYSTEMS}; do - if "_oh_${_ohbsd_bs}_can_${_ohbsd_step}"; then + if "_oh_${_ohbsd_bs}_can_${_ohbsd_test_step}"; then "_oh_${_ohbsd_bs}_${_ohbsd_step}" "${@}" _oh_return ${?} return ${?} @@ -114,15 +115,25 @@ oh_buildsystem_do() oh_buildsystem_arch() { - _oh_local _ohbsa_arch _ohbsa_system + _oh_local _ohbsa_arch _ohbsa_bs_arch - if [ ${#} -eq 2 ]; then + if [ ${#} -eq 1 ]; then _ohbsa_arch="${1}" - _ohbsa_system="${2}" else _oh_return 125 return ${?} fi - cat '@@ARCHTAB@@/'"${_ohbsa_arch}/${_ohbsa_system}" + # Try to find a suitable build system host arch. + for _ohbsa_bs_arch in $(cat '@@ARCHTAB@@/'"${_ohbsa_arch}/${_ohbsa_system}") + do + if ob_buildsystem_do 'configure:testarch'; then + _oh_return 0 + return ${?} + fi + done + + ob_warn "$(ob_get_msg 'no_capable_host_arch')" + _oh_return 1 + return ${?} } diff --git a/lib/buildsystem/autoconf.sh b/lib/buildsystem/autoconf.sh index 9e76c1c..446e017 100644 --- a/lib/buildsystem/autoconf.sh +++ b/lib/buildsystem/autoconf.sh @@ -33,17 +33,17 @@ _oh_autoconf_configure() cd "${_OH_BUILDSYSTEM_BUILD_DIR}" _ohbsbac_arch_opts=" - --build='$(oh_buildsystem_arch "${OPK_BUILD_ARCH}" 'autoconf')' + --build='$(oh_buildsystem_arch "${OPK_BUILD_ARCH}")' " if [ "${OPK_BUILD_ARCH}" != "${OPK_HOST_ARCH}" ]; then _ohbsbac_arch_opts="${_ohbsbac_arch_opts} --host='$(oh_buildsystem_arch \ - "${OPK_HOST_ARCH}" 'autoconf')'" + "${OPK_HOST_ARCH}")'" fi if [ -n "${_OH_BUILDSYSTEM_TARGET_ARCH}" ]; then _ohbsbac_arch_opts="${_ohbsbac_arch_opts} --target='$(oh_buildsystem_arch \ - "${_OH_BUILDSYSTEM_TARGET_ARCH}" 'autoconf')'" + "${_OH_BUILDSYSTEM_TARGET_ARCH}")'" fi if [ '@@MULTIARCH_LIBDIR@@' = 'true' ]; then -- cgit v0.9.1