summaryrefslogtreecommitdiffhomepage
path: root/subr/pkg_install_strip.subr
blob: e91e6eaf7bcf6c2fcdbece568cf38581ac200de2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#
# set -o errexit -o noglob are assumed.
#

pkgp_strip_tree() {
	local _tree_root="${1}" _bin_path;
	if [ ! -e "${_tree_root}" ]; then
		return;
	fi;
	for _bin_path in $(find "${_tree_root}" -perm /a=x	\
			\( -type f -or -type l \)); do
		set +o errexit;
		if objdump -sj .debug_info "${_bin_path}" >/dev/null 2>&1; then
			ex_log_msg info "Stripping ${_bin_path}...";
			ex_log_msg vnfo "${TARGET}-strip ${_bin_path}";
			${TARGET}-strip ${_bin_path};
		fi;
		set -o errexit;
	done;
};

pkg_strip() {
	if [ "${PKG_NAME%flavour_minipix}" != "${PKG_NAME}" ]	\
	&& [ ${ARG_DEBUG_MINIPIX:-0} -eq 0 ]; then
		pkgp_strip_tree "${PKG_DESTDIR}";
	elif [ "${BUILD}" = release ]; then
		pkgp_strip_tree "${PKG_DESTDIR}/bin";
	fi;
};

# vim:filetype=sh