summaryrefslogtreecommitdiffstats
path: root/lib/cmd
diff options
context:
space:
mode:
Diffstat (limited to 'lib/cmd')
-rw-r--r--lib/cmd/build.sh65
1 files changed, 65 insertions, 0 deletions
diff --git a/lib/cmd/build.sh b/lib/cmd/build.sh
index a7af6b9..843e5f2 100644
--- a/lib/cmd/build.sh
+++ b/lib/cmd/build.sh
@@ -23,9 +23,16 @@ use chroot
use rand
use package
+cmd_build_old_opkbuild=
+cmd_build_opkbuild_package=
+cmd_build_opkbuild_version=
+
cmd_build_main()
{
local root=
+ local opkbuild_plat_opt=
+ local arch=
+ local plat=
local first_arg=
local prev_arg=
local arg=
@@ -42,6 +49,30 @@ cmd_build_main()
root="${1}"
shift 1
+ # opkbuild's platform option will be changing from -P to -p. Detect
+ # either, depending on the version of opkbuild installed.
+ cmd_build_old_opkbuild=true
+ parse_control "${root}/var/lib/opkg/status" \
+ cmd_build_opkbuild_field_cb cmd_build_opkbuild_para_cb \
+ 'Package Version'
+ if ${cmd_build_old_opkbuild}; then
+ opkbuild_plat_opt='P'
+ else
+ opkbuild_plat_opt='p'
+ fi
+ arch="$(cat "${root}/etc/proteanos_arch")"
+ plat="$(cat "${root}/etc/proteanos_plat")"
+ while getopts "a:${opkbuild_plat_opt}:" opt 2>/dev/null; do
+ case "${opt}" in
+ a)
+ arch="${OPTARG}"
+ ;;
+ ${opkbuild_plat_opt})
+ plat="${OPTARG}"
+ ;;
+ esac
+ done
+
first_arg=true
prev_arg=
for arg in "${@}"; do
@@ -104,6 +135,40 @@ cmd_build_main()
rmdir "${root}${dir}"
}
+cmd_build_opkbuild_field_cb()
+{
+ local name="${1}"
+ local value="${2}"
+
+ case "${name}" in
+ Package)
+ cmd_build_opkbuild_package="${value}"
+ ;;
+ Version)
+ cmd_build_opkbuild_version="${value}"
+ ;;
+ esac
+
+ return 0
+}
+
+cmd_build_opkbuild_para_cb()
+{
+ if [ "x${cmd_build_opkbuild_package}" = 'xopkbuild' ]; then
+ case "${cmd_build_opkbuild_version}" in
+ 3.0.0~beta[3-5]-*)
+ cmd_build_old_opkbuild=true
+ ;;
+ *)
+ cmd_build_old_opkbuild=false
+ ;;
+ esac
+ return 1
+ fi
+
+ return 0
+}
+
cmd_build_make_deps_pkg()
{
local build_dir="${1}"