From 378facbd9fd64c357a7a38c0130893e3b807ff71 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lucio=20Andr=C3=A9s=20Illanes=20Albornoz?= Date: Wed, 6 Sep 2017 16:23:29 +0200 Subject: build.sh, subr/{post_strip,pkg_{install_pre,strip}.subr: strip(1) after install for each package to save disk space. vars/build.vars, vars/install_....vars: install coreutils_flavour_minipix w/ newly added ${TARGET}-install-strip to save disk space. --- subr/pkg_install_pre.subr | 16 ++++++++++++++++ subr/pkg_strip.subr | 36 ++++++++++++++++++++++++++++++++++++ subr/post_strip.subr | 27 --------------------------- 3 files changed, 52 insertions(+), 27 deletions(-) create mode 100644 subr/pkg_install_pre.subr create mode 100644 subr/pkg_strip.subr delete mode 100644 subr/post_strip.subr (limited to 'subr') 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 -- cgit v1.2.3