summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPatrick McDermott <patrick.mcdermott@libiquity.com>2021-01-03 21:39:52 (EST)
committer Patrick McDermott <patrick.mcdermott@libiquity.com>2021-01-03 21:44:09 (EST)
commit89a79ad7217e1d2618a6c247402e2d7b562f3e9d (patch)
tree2ad93f692c580666e028fd35f4d7d73f4285731e
parent2add2fe747ae9fab90a34035fbebc4da7b3b5df4 (diff)
cmd/build: Factor out interesting parts
-rw-r--r--src/cmd/build.sh51
1 files changed, 32 insertions, 19 deletions
diff --git a/src/cmd/build.sh b/src/cmd/build.sh
index feced70..021c4aa 100644
--- a/src/cmd/build.sh
+++ b/src/cmd/build.sh
@@ -68,6 +68,37 @@ _cmd_build_fini()
done
}
+_cmd_build_build()
+{
+ local host_arch="${1}"
+ local host_plat="${2}"
+ shift 2
+ local es=
+
+ es=0
+
+ _cmd_build_build_deps="$(package_get_build_deps \
+ "${host_arch}" "${host_plat}")"
+ if [ "x${_cmd_build_build_deps}" != 'x' ]; then
+ _cmd_build_make_deps_pkg
+ if session_exec opkg -a "${host_arch}" print-architecture \
+ 1>/dev/null 2>&1; then
+ session_exec opkg -a "${host_arch}" \
+ install ../builddeps.opk || es=${?}
+ else
+ session_exec opkg install ../builddeps.opk || es=${?}
+ fi
+ fi
+
+ if [ ${es} -eq 0 ]; then
+ session_exec opkbuild "${@}" || es=${?}
+ fi
+
+ _cmd_build_fini
+
+ return ${es}
+}
+
cmd_build_main()
{
local root=
@@ -146,25 +177,7 @@ cmd_build_main()
fi
es=0
-
- _cmd_build_build_deps="$(package_get_build_deps \
- "${host_arch}" "${host_plat}")"
- if [ "x${_cmd_build_build_deps}" != 'x' ]; then
- _cmd_build_make_deps_pkg
- if session_exec opkg -a "${host_arch}" print-architecture \
- 1>/dev/null 2>&1; then
- session_exec opkg -a "${host_arch}" \
- install ../builddeps.opk || es=${?}
- else
- session_exec opkg install ../builddeps.opk || es=${?}
- fi
- fi
-
- if [ ${es} -eq 0 ]; then
- session_exec opkbuild "${@}" || es=${?}
- fi
-
- _cmd_build_fini
+ _cmd_build_build "${host_arch}" "${host_plat}" "${@}" || es=${?}
session_end