diff options
author | P. 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) |
commit | e1f1b3a7e9e0afbc640dede5d2ce1910767927fb (patch) | |
tree | d35463507dbdacd8a82b12fb525c0ddfbcffd2a6 | |
parent | 8c6b9a513101ed62c8cff682f35b1cf752a69818 (diff) |
Split oh_buildsystem_do() & oh_buildsystem_find().
-rw-r--r-- | lib/buildsystem.sh | 54 | ||||
-rw-r--r-- | lib/buildsystem/autoconf.sh | 7 | ||||
-rw-r--r-- | src/oh-autobuild.sh | 4 | ||||
-rw-r--r-- | src/oh-autoclean.sh | 4 | ||||
-rw-r--r-- | src/oh-autoconfigure.sh | 4 | ||||
-rw-r--r-- | src/oh-autoinstall.sh | 4 | ||||
-rw-r--r-- | src/oh-autotest.sh | 4 |
7 files changed, 61 insertions, 20 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 diff --git a/lib/buildsystem/autoconf.sh b/lib/buildsystem/autoconf.sh index 446e017..b770c7f 100644 --- a/lib/buildsystem/autoconf.sh +++ b/lib/buildsystem/autoconf.sh @@ -94,3 +94,10 @@ _oh_autoconf_can_install() { return 1 } + +_oh_autoconf_testarch() +{ + # TODO: This should call config.sub, which may be in src or src/conftools + # (or elsewhere?). + return 0 +} diff --git a/src/oh-autobuild.sh b/src/oh-autobuild.sh index 1f24d5c..f76858f 100644 --- a/src/oh-autobuild.sh +++ b/src/oh-autobuild.sh @@ -48,7 +48,9 @@ main() oh_buildsystems_init - oh_buildsystem_do 'build' "${@}" + if sys="$(oh_buildsystem_find 'build')"; then + oh_buildsystem_do 'build' "${sys}" "${@}" + fi } main "${@}" diff --git a/src/oh-autoclean.sh b/src/oh-autoclean.sh index e0488bd..e5d1653 100644 --- a/src/oh-autoclean.sh +++ b/src/oh-autoclean.sh @@ -45,7 +45,9 @@ main() oh_buildsystems_init - oh_buildsystem_do 'clean' "${@}" + if sys="$(oh_buildsystem_find 'clean')"; then + oh_buildsystem_do 'clean' "${sys}" "${@}" + fi } main "${@}" diff --git a/src/oh-autoconfigure.sh b/src/oh-autoconfigure.sh index 6c524da..b56ac55 100644 --- a/src/oh-autoconfigure.sh +++ b/src/oh-autoconfigure.sh @@ -48,7 +48,9 @@ main() oh_buildsystems_init - oh_buildsystem_do 'configure' "${@}" + if sys="$(oh_buildsystem_find 'configure')"; then + oh_buildsystem_do 'configure' "${sys}" "${@}" + fi } main "${@}" diff --git a/src/oh-autoinstall.sh b/src/oh-autoinstall.sh index b50174e..6d494bc 100644 --- a/src/oh-autoinstall.sh +++ b/src/oh-autoinstall.sh @@ -48,7 +48,9 @@ main() oh_buildsystems_init - oh_buildsystem_do 'install' "${@}" + if sys="$(oh_buildsystem_find 'install')"; then + oh_buildsystem_do 'install' "${sys}" "${@}" + fi } main "${@}" diff --git a/src/oh-autotest.sh b/src/oh-autotest.sh index 7176c08..db5ffff 100644 --- a/src/oh-autotest.sh +++ b/src/oh-autotest.sh @@ -45,7 +45,9 @@ main() oh_buildsystems_init - oh_buildsystem_do 'test' "${@}" + if sys="$(oh_buildsystem_find 'test')"; then + oh_buildsystem_do 'test' "${sys}" "${@}" + fi } main "${@}" |