summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--NEWS1
-rw-r--r--src/cmd/build.sh26
2 files changed, 26 insertions, 1 deletions
diff --git a/NEWS b/NEWS
index ca1b39d..a90add1 100644
--- a/NEWS
+++ b/NEWS
@@ -23,6 +23,7 @@ New features:
field.
* "prokit installer-pc" now supports foreign installations using an
"-F" option.
+ * "prokit build" now saves logs of builds.
Error handling and bug fixes:
diff --git a/src/cmd/build.sh b/src/cmd/build.sh
index 021c4aa..733817e 100644
--- a/src/cmd/build.sh
+++ b/src/cmd/build.sh
@@ -110,6 +110,10 @@ cmd_build_main()
local host_plat=
local first_arg=
local arg=
+ local source=
+ local version=
+ local log=
+ local tmp_fd=
local es=
if [ ${#} -lt 2 ]; then
@@ -176,8 +180,28 @@ cmd_build_main()
return 2
fi
+ read -r source version <<-EOF
+ $(package_get_name_and_version)
+ EOF
+ log="${_cmd_build_pkg_dir}/../$(: \
+ )${source}_${version}_${host_arch}_${host_plat}.log"
+
+ fdalloc
+ tmp_fd=${FD}
es=0
- _cmd_build_build "${host_arch}" "${host_plat}" "${@}" || es=${?}
+ {
+ {
+ {
+ set +e
+ _cmd_build_build "${host_arch}" "${host_plat}" \
+ "${@}" 2>&1
+ printf '%d' ${?} 1>&${tmp_fd}
+ } | tee "${log}" 1>&2
+ } ${tmp_fd}>&1 | {
+ read es
+ exit ${es}
+ }
+ } 2>&1 || es=${?}
session_end