summaryrefslogtreecommitdiffstats
path: root/lib/buildsystem.sh
diff options
context:
space:
mode:
authorP. J. McDermott <pjm@nac.net>2012-11-08 23:18:43 (EST)
committer P. J. McDermott <pjm@nac.net>2012-11-08 23:45:18 (EST)
commite1f1b3a7e9e0afbc640dede5d2ce1910767927fb (patch)
treed35463507dbdacd8a82b12fb525c0ddfbcffd2a6 /lib/buildsystem.sh
parent8c6b9a513101ed62c8cff682f35b1cf752a69818 (diff)
Split oh_buildsystem_do() & oh_buildsystem_find().
Diffstat (limited to 'lib/buildsystem.sh')
-rw-r--r--lib/buildsystem.sh54
1 files changed, 39 insertions, 15 deletions
diff --git a/lib/buildsystem.sh b/lib/buildsystem.sh
index 37f6ac1..8ea4fdf 100644
--- a/lib/buildsystem.sh
+++ b/lib/buildsystem.sh
@@ -79,30 +79,28 @@ oh_set_buildsystem_option()
esac
}
-oh_buildsystem_do()
+oh_buildsystem_find()
{
- _oh_local _ohbsd_test_step _ohbsd_step _ohbsd_bs
+ _oh_local _ohbsf_test_step _ohbsf_bs
- if [ ${#} -ge 1 ]; then
- _ohbsd_test_step="${1%%:*}"
- _ohbsd_step="${1#*:}"
- shift 1
+ if [ ${#} -eq 1 ]; then
+ _ohbsf_test_step="${1}"
else
_oh_return 125
return ${?}
fi
if [ -n "${_OH_BUILDSYSTEM_SYSTEM}" ]; then
- if "_oh_${_OH_BUILDSYSTEM_SYSTEM}_can_${_ohbsd_test_step}"; then
- "_oh_${_OH_BUILDSYSTEM_SYSTEM}_${_ohbsd_step}" "${@}"
- _oh_return ${?}
+ if "_oh_${_OH_BUILDSYSTEM_SYSTEM}_can_${_ohbsf_test_step}"; then
+ printf '%s\n' "${_OH_BUILDSYSTEM_SYSTEM}"
+ _oh_return 0
return ${?}
fi
else
- for _ohbsd_bs in ${_OH_BUILDSYSTEMS}; do
- if "_oh_${_ohbsd_bs}_can_${_ohbsd_test_step}"; then
- "_oh_${_ohbsd_bs}_${_ohbsd_step}" "${@}"
- _oh_return ${?}
+ for _ohbsf_bs in ${_OH_BUILDSYSTEMS}; do
+ if "_oh_${_ohbsf_bs}_can_${_ohbsf_test_step}"; then
+ printf '%s\n' "${_ohbsf_bs}"
+ _oh_return 0
return ${?}
fi
done
@@ -113,9 +111,28 @@ oh_buildsystem_do()
return ${?}
}
+oh_buildsystem_do()
+{
+ _oh_local _ohbsd_step _ohbsd_system
+
+ if [ ${#} -ge 2 ]; then
+ _ohbsd_step="${1}"
+ _ohbsd_system="${2}"
+ shift 2
+ else
+ _oh_return 125
+ return ${?}
+ fi
+
+ "_oh_${_ohbsd_system}_${_ohbsd_step}" "${@}"
+
+ _oh_return ${?}
+ return ${?}
+}
+
oh_buildsystem_arch()
{
- _oh_local _ohbsa_arch _ohbsa_bs_arch
+ _oh_local _ohbsa_arch _ohbsa_bs_arch _ohbsa_system
if [ ${#} -eq 1 ]; then
_ohbsa_arch="${1}"
@@ -124,10 +141,17 @@ oh_buildsystem_arch()
return ${?}
fi
+ _ohbsa_system="$(oh_buildsystem_find 'configure')"
+ if [ ${?} -ne 0 ]; then
+ _oh_return 1
+ return ${?}
+ fi
+
# 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
+ if oh_buildsystem_do 'testarch' "${_ohbsa_system}"; then
+ printf '%s\n' "${_ohbsa_bs_arch}"
_oh_return 0
return ${?}
fi