diff options
author | Lucio Andrés Illanes Albornoz <lucio@lucioillanes.de> | 2017-09-06 16:23:29 +0200 |
---|---|---|
committer | Lucio Andrés Illanes Albornoz <lucio@lucioillanes.de> | 2017-09-06 16:23:29 +0200 |
commit | 378facbd9fd64c357a7a38c0130893e3b807ff71 (patch) | |
tree | ce7289e1b77414dc7dd0c6fca8acdd74694a3122 /subr | |
parent | d080d13396454fe3871f393bf442d3e157c7d2e0 (diff) | |
download | midipix_build-378facbd9fd64c357a7a38c0130893e3b807ff71.tar.bz2 midipix_build-378facbd9fd64c357a7a38c0130893e3b807ff71.tar.xz |
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.
Diffstat (limited to 'subr')
-rw-r--r-- | subr/pkg_install_pre.subr | 16 | ||||
-rw-r--r-- | subr/pkg_strip.subr | 36 | ||||
-rw-r--r-- | subr/post_strip.subr | 27 |
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 |