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 | |
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.
-rwxr-xr-x | build.sh | 2 | ||||
-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 | ||||
-rw-r--r-- | vars/build.vars | 9 | ||||
-rw-r--r-- | vars/install_strip_host.vars | 16 |
6 files changed, 75 insertions, 31 deletions
@@ -132,7 +132,7 @@ for BUILD_TARGET_LC in $(subst_tgts invariants ${BUILD_TARGETS_META:-world}); do fi; done; if [ "${BUILD_SCRIPT_RC:-0}" -eq 0 ]; then - post_copy_etc; post_strip; post_sha256sums; post_tarballs; + post_copy_etc; post_sha256sums; post_tarballs; fi; post_build_files; log_msg info "${BUILD_NFINI} finished, ${BUILD_NSKIP} skipped, and ${BUILD_NFAIL} failed builds in ${BUILD_NBUILT} build script(s)."; 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 diff --git a/vars/build.vars b/vars/build.vars index 94541b25..152fbd51 100644 --- a/vars/build.vars +++ b/vars/build.vars @@ -42,13 +42,13 @@ fi; : ${BUILD_LOG_FNAME:=${PREFIX}/build.log}; : ${BUILD_LOG_LAST_FNAME:=${PREFIX}/build.log.last}; : ${BUILD_STATUS_IN_PROGRESS_FNAME:=${PREFIX}/BUILD_IN_PROGRESS}; -: ${BUILD_STEPS:="setup_env:always all:abstract disabled:always fetch:main extract:main patch_pre:main distclean:main build_dir:always autoconf:main patch:main configure:main clean:optional build:main install:main finish:always"}; +: ${BUILD_STEPS:="setup_env:always all:abstract disabled:always fetch:main extract:main patch_pre:main distclean:main build_dir:always autoconf:main patch:main configure:main clean:optional build:main install_pre:main install:main strip:main finish:always"}; : ${CHECK_PREREQ_CMDS:="aclocal autoconf autopoint awk basename bunzip2 find flex gcc git groff gunzip install ld libtool lzma make makeinfo msgfmt nl nroff openssl paste patch python sed sha256sum sort tar tee tic tr uname wget xz"}; : ${CHECK_PREREQ_FILES:="/usr/include/gmpxx.h /usr/include/mpc.h /usr/include/mpfr.h"}; : ${CHECK_PREREQ_FILES_DYNAMIC:='/usr/share/groff/$(groff -v 2>/dev/null | awk '\''/^GNU groff version /{print $NF}'\'')/tmac/e.tmac'}; : ${CHECK_PREREQ_PERL_MODULES:="autodie ExtUtils::MakeMaker"}; : ${CHECK_PATH_VARS:="PREFIX PREFIX_NATIVE PREFIX_CROSS DLCACHEDIR WORKDIR"}; -: ${CHECK_UPDATES_SKIP:="gmp mpfr mpc binutils binutils_host pkgconf_host psxtypes pemagine dalist ntcon ntapi psxscl psxscl_strace ntctty ptycon pkgconf libevent libressl"}; +: ${CHECK_UPDATES_SKIP:="gmp mpfr mpc binutils binutils_host install_strip_host pkgconf_host psxtypes pemagine dalist ntcon ntapi psxscl psxscl_strace ntctty ptycon pkgconf libevent libressl"}; : ${CHECK_UPDATES_SHOW_NEW:=6}; : ${CLEAR_ENV_VARS_EXCEPT:="ARG_VERBOSE HOME PATH SHELL TERM USER"}; : ${CLEAR_PREFIX_DIRS:="bin i686-nt32-midipix include lib lib64 libexec minipix native share tmp x86_64-nt64-midipix"}; @@ -90,7 +90,7 @@ INVARIANTS_PACKAGES="chainport"; HOST_TOOLCHAIN_BUILD_TYPE="host"; HOST_TOOLCHAIN_CFLAGS_CONFIGURE="${HOST_TOOLCHAIN_CFLAGS_CONFIGURE_DEFAULT}"; HOST_TOOLCHAIN_CONFIGURE_ARGS="-C --disable-nls --host=${TARGET} --prefix= --target=${TARGET}"; -HOST_TOOLCHAIN_PACKAGES="slibtool_host perk_host binutils_host binutils_host_x86_64_w64_mingw32 gcc_stage1_cross_x86_64_w64_mingw32 gcc_stage1 psxstub musl_no_complex gcc_runtime musl_full gcc_libstdcpp_v3 gcc_full file_host mdso_host pkgconf_host"; +HOST_TOOLCHAIN_PACKAGES="slibtool_host perk_host binutils_host binutils_host_x86_64_w64_mingw32 gcc_stage1_cross_x86_64_w64_mingw32 gcc_stage1 psxstub musl_no_complex gcc_runtime musl_full gcc_libstdcpp_v3 gcc_full file_host install_strip_host mdso_host pkgconf_host"; HOST_TOOLCHAIN_PREFIX="${PREFIX_CROSS}"; : ${PKG_SLIBTOOL_HOST_URLS_GIT:="slibtool=${GITROOT}/slibtool"}; : ${PKG_SLIBTOOL_HOST_CONFIGURE_ARGS:=--host= --prefix=}; @@ -128,6 +128,8 @@ HOST_TOOLCHAIN_PREFIX="${PREFIX_CROSS}"; : ${PKG_FILE_HOST_VERSION:=5.29}; : ${PKG_FILE_HOST_URL:=ftp://ftp.astron.com/pub/file/file-${PKG_FILE_HOST_VERSION}.tar.gz}; : ${PKG_FILE_HOST_CONFIGURE_ARGS:="-C --prefix=${PREFIX}"}; +: ${PKG_INSTALL_STRIP_HOST_BUILD_STEPS:="setup_env:always install:main"}; +: ${PKG_INSTALL_STRIP_HOST_URL:=none}; : ${PKG_MDSO_HOST_URLS_GIT:="mdso=${GITROOT}/mdso"}; : ${PKG_MDSO_HOST_CONFIGURE_ARGS:="--prefix=/usr"}; : ${PKG_MDSO_HOST_INSTALL_FILES:="@mdso=bin/${TARGET}-mdso"}; @@ -946,6 +948,7 @@ MINIPIX_PREFIX="${PREFIX_MINIPIX}"; : ${PKG_COREUTILS_FLAVOUR_MINIPIX_LDFLAGS_BUILD_EXTRA:="-static"}; : ${PKG_COREUTILS_FLAVOUR_MINIPIX_MAKEFLAGS_BUILD_EXTRA:="SHARED=0"}; : ${PKG_COREUTILS_FLAVOUR_MINIPIX_INSTALL_TARGET:=install-binPROGRAMS}; +: ${PKG_COREUTILS_FLAVOUR_MINIPIX_MAKEFLAGS_INSTALL_EXTRA:=INSTALL_PROGRAM=${TARGET}-install-strip}; : ${PKG_TAR_FLAVOUR_MINIPIX_LDFLAGS_BUILD_EXTRA:="-static"}; : ${PKG_TAR_FLAVOUR_MINIPIX_MAKEFLAGS_BUILD_EXTRA:="SHARED=0"}; : ${PKG_TAR_FLAVOUR_MINIPIX_MAKEFLAGS_INSTALL:="-C src install-binPROGRAMS DESTDIR=${PREFIX_MINIPIX}"}; diff --git a/vars/install_strip_host.vars b/vars/install_strip_host.vars new file mode 100644 index 00000000..f8d6ca8e --- /dev/null +++ b/vars/install_strip_host.vars @@ -0,0 +1,16 @@ +# +# set -o errexit -o noglob are assumed. +# + +pkg_install_strip_host_install() { + if [ -e "${PREFIX}/bin/${TARGET}-install-strip" ]; then + build_fileop rm "${PREFIX}/bin/${TARGET}-install-strip"; + fi; + cat > "${PREFIX}/bin/${TARGET}-install-strip" <<EOF +#!/bin/sh +install -s "\${@}"; +EOF + chmod +x "${PREFIX}/bin/${TARGET}-install-strip"; +}; + +# vim:filetype=sh |