summaryrefslogtreecommitdiffstats
path: root/lib/cmd/build.sh
diff options
context:
space:
mode:
Diffstat (limited to 'lib/cmd/build.sh')
-rw-r--r--lib/cmd/build.sh43
1 files changed, 11 insertions, 32 deletions
diff --git a/lib/cmd/build.sh b/lib/cmd/build.sh
index 3aa526f..a7af6b9 100644
--- a/lib/cmd/build.sh
+++ b/lib/cmd/build.sh
@@ -21,9 +21,7 @@
use profile
use chroot
use rand
-use control
-
-cmd_build_deps=
+use package
cmd_build_main()
{
@@ -33,6 +31,7 @@ cmd_build_main()
local arg=
local dir=
local uname_s=
+ local build_deps=
local f=
if [ ${#} -lt 2 ]; then
@@ -61,6 +60,7 @@ cmd_build_main()
if ! [ -d "${prev_arg}" ]; then
error 2 "$(get_msg 'cmd_build_not_a_dir')"
fi
+ package_init "${prev_arg}"
rand
dir="/prokit/build.${rand_x}"
@@ -73,18 +73,19 @@ cmd_build_main()
;;
esac
- cmd_build_get_deps "${root}${dir}/pkg"
- if [ "x${cmd_build_deps}" != 'x' ]; then
- cmd_build_make_deps_pkg "${root}${dir}" "${rand_x}"
+ build_deps="$(package_get_build_deps)"
+ if [ "x${build_deps}" != 'x' ]; then
+ cmd_build_make_deps_pkg "${root}${dir}" "${rand_x}" \
+ "${build_deps}"
fi
chroot_exec "${root}" sh <<-EOF
cd '${dir}/pkg'
- if [ 'x${cmd_build_deps}' != 'x' ]; then
+ if [ 'x${build_deps}' != 'x' ]; then
opkg install ../builddeps.opk
fi
opkbuild ${@}
- if [ 'x${cmd_build_deps}' != 'x' ]; then
+ if [ 'x${build_deps}' != 'x' ]; then
opkg --autoremove remove prokit-builddeps-${rand_x}
fi
EOF
@@ -103,33 +104,11 @@ cmd_build_main()
rmdir "${root}${dir}"
}
-cmd_build_get_deps()
-{
- local pkg_dir="${1}"
-
- cmd_build_deps=''
- parse_control "${pkg_dir}/control" cmd_build_deps_field_cb false ''
-}
-
-cmd_build_deps_field_cb()
-{
- local name="${1}"
- local value="${2}"
-
- name="$(printf '%s\n' "${name}" | tr 'A-Z' 'a-z')"
-
- if [ "x${name}" = 'xbuild-depends' ]; then
- cmd_build_deps="${value}"
- return 1
- fi
-
- return 0
-}
-
cmd_build_make_deps_pkg()
{
local build_dir="${1}"
local build_id="${2}"
+ local build_deps="${3}"
printf '2.0\n' >"${build_dir}/builddeps/debian-binary"
cat >"${build_dir}/builddeps/control/control" <<-EOF
@@ -138,7 +117,7 @@ cmd_build_make_deps_pkg()
Version: 1.0
Architecture: all
Platform: all
- Depends: ${cmd_build_deps}
+ Depends: ${build_deps}
Description: Build dependencies metapackage generated by prokit
EOF
(cd "${build_dir}/builddeps/data"; tar -czf ../data.tar.gz .)