summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorP. J. McDermott <pjm@nac.net>2012-11-08 13:58:47 (EST)
committer P. J. McDermott <pjm@nac.net>2012-11-08 13:58:47 (EST)
commit8c6b9a513101ed62c8cff682f35b1cf752a69818 (patch)
treef1b2d5ea5d9e18b5495c1284fa3aac552766c676
parent11d3d0e4a22a657b709dbdc2dae832a5e38d1278 (diff)
Try to detect a suitable build system host arch.
-rw-r--r--lib/buildsystem.sh27
-rw-r--r--lib/buildsystem/autoconf.sh6
-rw-r--r--locale/en_US/opkhelper.sh1
3 files changed, 23 insertions, 11 deletions
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
diff --git a/locale/en_US/opkhelper.sh b/locale/en_US/opkhelper.sh
index 9007eca..9a791f2 100644
--- a/locale/en_US/opkhelper.sh
+++ b/locale/en_US/opkhelper.sh
@@ -29,3 +29,4 @@ msg_opkhelper_chmod_include='Setting mode of header files...'
msg_opkhelper_chmod_man='Setting mode of manual files...'
msg_opkhelper_chmod_bin='Setting mode of program files in "%s"...'
msg_opkhelper_no_capable_build_sys='No capable build system found'
+msg_opkhelper_no_capable_host_arch='No capable build system host architecture found'