summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/buildsystem.sh107
1 files changed, 52 insertions, 55 deletions
diff --git a/lib/buildsystem.sh b/lib/buildsystem.sh
index 314f20d..8e6bf0a 100644
--- a/lib/buildsystem.sh
+++ b/lib/buildsystem.sh
@@ -28,10 +28,10 @@ make
oh_buildsystems_init()
{
- _oh_local _ohbsi_bs
+ local bs=
- for _ohbsi_bs in ${_OH_BUILDSYSTEMS}; do
- oh_use "buildsystem/${_ohbsi_bs}"
+ for bs in ${_OH_BUILDSYSTEMS}; do
+ oh_use "buildsystem/${bs}"
done
_OH_BUILDSYSTEM_WORK_AREA="${PWD}"
@@ -44,130 +44,127 @@ oh_buildsystems_init()
_OH_BUILDSYSTEM_DESTDIR="${PWD}/dest"
[ -z "${_OH_BUILDSYSTEM_SYSTEM}" ] && \
_OH_BUILDSYSTEM_SYSTEM=''
+
+ return 0
}
oh_set_buildsystem_option()
{
- _oh_local _ohsbso_name _obsbso_value
+ local name=
+ local value=
if [ ${#} -eq 2 ]; then
- _ohsbso_name="${1}"
- _ohsbso_value="${2}"
+ name="${1}"
+ value="${2}"
else
- _oh_return 125
- return ${?}
+ return 125
fi
- case "${_ohsbso_name}" in
+ case "${name}" in
'source-dir')
- _OH_BUILDSYSTEM_SOURCE_DIR="$(cd "${_ohsbso_value}" && \
+ _OH_BUILDSYSTEM_SOURCE_DIR="$(cd "${value}" && \
pwd)"
;;
'build-dir')
- _OH_BUILDSYSTEM_BUILD_DIR="${_ohsbso_value}"
+ _OH_BUILDSYSTEM_BUILD_DIR="${value}"
;;
'destdir')
- _OH_BUILDSYSTEM_DESTDIR="$(mkdir -p "${_ohsbso_value}" && \
- cd "${_ohsbso_value}" && pwd)"
+ _OH_BUILDSYSTEM_DESTDIR="$(mkdir -p "${value}" && \
+ cd "${value}" && pwd)"
;;
'build-system')
- _OH_BUILDSYSTEM_SYSTEM="${_ohsbso_value}"
+ _OH_BUILDSYSTEM_SYSTEM="${value}"
;;
'target-arch')
- _OH_BUILDSYSTEM_TARGET_ARCH="${_ohsbso_value}"
+ _OH_BUILDSYSTEM_TARGET_ARCH="${value}"
;;
'build-target')
- _OH_BUILDSYSTEM_BUILD_TARGET="${_ohsbso_value}"
+ _OH_BUILDSYSTEM_BUILD_TARGET="${value}"
;;
*)
- _oh_return 125
- return ${?}
+ return 125
;;
esac
+
+ return 0
}
oh_buildsystem_find()
{
- _oh_local _ohbsf_test_step _ohbsf_bs
+ local test_step=
+ local bs=
if [ ${#} -eq 1 ]; then
- _ohbsf_test_step="${1}"
+ test_step="${1}"
else
- _oh_return 125
- return ${?}
+ return 125
fi
if [ -n "${_OH_BUILDSYSTEM_SYSTEM}" ]; then
- if "_oh_${_OH_BUILDSYSTEM_SYSTEM}_can_${_ohbsf_test_step}"; then
+ if "_oh_${_OH_BUILDSYSTEM_SYSTEM}_can_${test_step}"; then
printf '%s\n' "${_OH_BUILDSYSTEM_SYSTEM}"
- _oh_return 0
- return ${?}
+ return 0
fi
else
- 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 ${?}
+ for bs in ${_OH_BUILDSYSTEMS}; do
+ if "_oh_${bs}_can_${test_step}"; then
+ printf '%s\n' "${bs}"
+ return 0
fi
done
fi
ob_warn "$(ob_get_msg 'no_capable_build_sys')"
- _oh_return 1
- return ${?}
+ return 1
}
oh_buildsystem_do()
{
- _oh_local _ohbsd_step _ohbsd_system
+ local step=
+ local system=
if [ ${#} -ge 2 ]; then
- _ohbsd_step="${1}"
- _ohbsd_system="${2}"
+ step="${1}"
+ system="${2}"
shift 2
else
- _oh_return 125
- return ${?}
+ return 125
fi
- "_oh_${_ohbsd_system}_${_ohbsd_step}" "${@}"
+ "_oh_${system}_${step}" "${@}"
- _oh_return ${?}
return ${?}
}
oh_buildsystem_arch()
{
- _oh_local _ohbsa_arch _ohbsa_bs_arch _ohbsa_system
+ local arch=
+ local bs_arch=
+ local system=
if [ ${#} -eq 1 ]; then
- _ohbsa_arch="${1}"
- _ohbsa_system="$(oh_buildsystem_find 'configure')"
+ arch="${1}"
+ system="$(oh_buildsystem_find 'configure')"
if [ ${?} -ne 0 ]; then
- _oh_return 1
- return ${?}
+ return 1
fi
elif [ ${#} -eq 2 ]; then
- _ohbsa_arch="${1}"
- _ohbsa_system="${2}"
+ arch="${1}"
+ system="${2}"
else
- _oh_return 125
- return ${?}
+ return 125
fi
# Try to find a suitable build system host arch.
- for _ohbsa_bs_arch in $(cat '@@ARCHTABDIR@@/'"${_ohbsa_arch}/${_ohbsa_system}")
+ for bs_arch in $(cat '@@ARCHTABDIR@@/'"${arch}/${system}")
do
- if oh_buildsystem_do 'testarch' "${_ohbsa_system}" "${_ohbsa_bs_arch}"
+ if oh_buildsystem_do 'testarch' "${system}" "${bs_arch}"
then
- printf '%s\n' "${_ohbsa_bs_arch}"
- _oh_return 0
- return ${?}
+ printf '%s\n' "${bs_arch}"
+ return 0
fi
done
ob_warn "$(ob_get_msg 'no_capable_host_arch')"
- _oh_return 1
- return ${?}
+ return 1
}