summaryrefslogtreecommitdiffhomepage
path: root/subr
diff options
context:
space:
mode:
Diffstat (limited to 'subr')
-rw-r--r--subr/pkg_install_pre.subr16
-rw-r--r--subr/pkg_strip.subr36
-rw-r--r--subr/post_strip.subr27
3 files changed, 52 insertions, 27 deletions
diff --git a/subr/pkg_install_pre.subr b/subr/pkg_install_pre.subr
new file mode 100644
index 00000000..f2273ba4
--- /dev/null
+++ b/subr/pkg_install_pre.subr
@@ -0,0 +1,16 @@
+#
+# set -o errexit -o noglob are assumed.
+#
+
+pkg_install_pre() {
+ if [ "${PKG_NAME%flavour_minipix}" != "${PKG_NAME}" ] \
+ && [ ${ARG_DEBUG_MINIPIX:-0} -eq 0 ]; then
+ find "${PREFIX_MINIPIX}" -perm /a=x \
+ \( -type f -or -type l \) > "${WORKDIR}/.stat_minipix.old";
+ elif [ "${BUILD}" = release ]; then
+ find "${PREFIX_NATIVE}/bin" -perm /a=x \
+ \( -type f -or -type l \) > "${WORKDIR}/.stat_native.old";
+ fi;
+};
+
+# vim:filetype=sh
diff --git a/subr/pkg_strip.subr b/subr/pkg_strip.subr
new file mode 100644
index 00000000..e0b2bf12
--- /dev/null
+++ b/subr/pkg_strip.subr
@@ -0,0 +1,36 @@
+#
+# set -o errexit -o noglob are assumed.
+#
+
+pkgp_strip_tree() {
+ local _tree_old="${1}" _tree_root="${2}";
+ local _tree_new="${_tree_old%.*}.new" _tree_diff="${_tree_old%.*}.diff";
+ if [ ! -e "${_tree_old}" ]; then
+ return;
+ fi;
+ find "${_tree_root}" -perm /a=x \( -type f -or -type l \) > "${_tree_new}";
+ set +o errexit;
+ for _pname in $(diff -u "${_tree_old}" "${_tree_new}" |\
+ sed -n '3,${/^+/s/^+//p}'); do
+ if objdump -sj .debug_info "${_pname}" >/dev/null 2>&1; then
+ log_msg info "Stripping ${_pname}...";
+ log_msg vnfo "${TARGET}-strip ${_pname}";
+ ${TARGET}-strip ${_pname};
+ fi;
+ done;
+ build_fileop rm "${_tree_old}" "${_tree_new}" "${_tree_diff}";
+ set -o errexit;
+};
+
+pkg_strip() {
+ if [ "${PKG_NAME%flavour_minipix}" != "${PKG_NAME}" ] \
+ && [ ${ARG_DEBUG_MINIPIX:-0} -eq 0 ]; then
+ pkgp_strip_tree "${WORKDIR}/.stat_minipix.old" \
+ "${PREFIX_MINIPIX}";
+ elif [ "${BUILD}" = release ]; then
+ pkgp_strip_tree "${WORKDIR}/.stat_native.old" \
+ "${PREFIX_NATIVE}/bin";
+ fi;
+};
+
+# vim:filetype=sh
diff --git a/subr/post_strip.subr b/subr/post_strip.subr
deleted file mode 100644
index b1d5d01b..00000000
--- a/subr/post_strip.subr
+++ /dev/null
@@ -1,27 +0,0 @@
-#
-# set -o errexit -o noglob are assumed.
-#
-
-postp_strip_files() {
- local _pname="${1}";
- for __ in $(find "${_pname}" -perm -0100 \( -type f -or -type l \)); do
- if objdump -sj .debug_info "${__}" >/dev/null 2>&1; then
- log_msg vnfo "${TARGET}-strip ${__}";
- set +o errexit; ${TARGET}-strip ${__}; set -o errexit;
- fi;
- done;
-};
-
-post_strip() {
- local __;
- if [ "${BUILD}" = release ]; then
- log_msg info "Stripping ${PREFIX_NATIVE}/bin...";
- postp_strip_files ${PREFIX_NATIVE}/bin;
- fi;
- if [ ${ARG_DEBUG_MINIPIX:-0} -eq 0 ]; then
- log_msg info "Stripping ${PREFIX_MINIPIX}/bin...";
- postp_strip_files ${PREFIX_MINIPIX}/bin;
- fi;
-};
-
-# vim:filetype=sh