Blob Blame History Raw
#
# 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}" ]				\
	|| [ ! -e "${_tree_root}" ]; 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