summaryrefslogtreecommitdiffstats
path: root/src/opkbuild.sh
diff options
context:
space:
mode:
Diffstat (limited to 'src/opkbuild.sh')
-rw-r--r--src/opkbuild.sh104
1 files changed, 67 insertions, 37 deletions
diff --git a/src/opkbuild.sh b/src/opkbuild.sh
index d854128..3ef7149 100644
--- a/src/opkbuild.sh
+++ b/src/opkbuild.sh
@@ -64,48 +64,22 @@ main()
test_uid0_cmd
- ob_info "$(ob_get_msg 'setup_arch_plat')"
setup_arch_plat
- ob_info "$(ob_get_msg 'make_work_area')"
- mkdir -p 'tmp'
- cd 'tmp'
-
- ob_info "$(ob_get_msg 'parse_package_metadata')"
- ob_init_package '..'
- ob_parse_package_metadata -c '.opkbuild.cache'
- OB_SOURCE="$(ob_get_source_parameter 'Source')"
- OB_SOURCE_VERSION="$(ob_get_source_parameter 'Version')"
- ob_parse_version -u 'OB_SOURCE_VERSION_UPSTREAM' "${OB_SOURCE_VERSION}"
- OB_BINARY_VERSION="$(ob_get_source_parameter 'Version')"
-
- ob_info "$(ob_get_msg 'build_source')"
- build_source
-
- ob-checkbuilddeps
+ make_work_area
- pkgs="$(ob_get_binary_packages -a "${OB_HOST_ARCH}")"
+ setup_package
- eval "$(ob-buildenv | sed 's/^/export /')"
-
- print_arch_stats
-
- ob-unpacksource
- ob-applypatches
- ob-installplatconf
-
- ../build build
- ${opt_uid0_cmd} ../build install
-
- ob-installdocs
- ob-gencontrol
- ob-buildopk
-
- ob-genchanges
+ if [ "${opt_build}" = 'source' -o "${opt_build}" = 'full' ]; then
+ build_source
+ fi
- if "${opt_clean}"; then
- cd ..
- rm -Rf 'tmp'
+ if [ "${opt_build}" != 'source' ]; then
+ print_arch_stats
+ "${opt_check_build_deps}" && ob-checkbuilddeps
+ setup_build
+ build
+ clean
fi
}
@@ -234,6 +208,8 @@ test_uid0_cmd()
setup_arch_plat()
{
+ ob_info "$(ob_get_msg 'setup_arch_plat')"
+
OB_BUILD_ARCH="$(ob_get_system_arch)"
OB_BUILD_PLATFORM="$(ob_get_system_plat)"
@@ -257,8 +233,31 @@ ${OB_HOST_ARCH}
EOF
}
+make_work_area()
+{
+ ob_info "$(ob_get_msg 'make_work_area')"
+
+ mkdir -p 'tmp'
+ cd 'tmp'
+}
+
+setup_package()
+{
+ ob_info "$(ob_get_msg 'parse_package_metadata')"
+
+ ob_init_package '..'
+ ob_parse_package_metadata -c '.opkbuild.cache'
+
+ OB_SOURCE="$(ob_get_source_parameter 'Source')"
+ OB_SOURCE_VERSION="$(ob_get_source_parameter 'Version')"
+ ob_parse_version -u 'OB_SOURCE_VERSION_UPSTREAM' "${OB_SOURCE_VERSION}"
+ OB_BINARY_VERSION="$(ob_get_source_parameter 'Version')"
+}
+
build_source()
{
+ ob_info "$(ob_get_msg 'build_source')"
+
src="$(ob_get_source_parameter 'Source')"
ver="$(ob_get_source_parameter 'Version')"
src_pkg_data_base="src:${src}.data$(ob_get_system_path 'package-source' \
@@ -295,4 +294,35 @@ print_arch_stats()
ob_info "$(ob_get_msg 'arch_stat_plat')" "${OB_HOST_PLATFORM}"
}
+setup_build()
+{
+ pkgs="$(ob_get_binary_packages -a "${OB_HOST_ARCH}")"
+
+ eval "$(ob-buildenv | sed 's/^/export /')"
+
+ ob-unpacksource
+ ob-applypatches
+ ob-installplatconf
+}
+
+build()
+{
+ ../build build
+ ${opt_uid0_cmd} ../build install
+
+ ob-installdocs
+ ob-gencontrol
+ ob-buildopk
+
+ ob-genchanges
+}
+
+clean()
+{
+ if "${opt_clean}"; then
+ cd ..
+ rm -Rf 'tmp'
+ fi
+}
+
main "${@}"