Lucio Andrés Illanes Albornoz 378fac
#
Lucio Andrés Illanes Albornoz 378fac
# set -o errexit -o noglob are assumed.
Lucio Andrés Illanes Albornoz 378fac
#
Lucio Andrés Illanes Albornoz 378fac
Lucio Andrés Illanes Albornoz 378fac
pkgp_strip_tree() {
Lucio Andrés Illanes Albornoz 378fac
	local _tree_old="${1}" _tree_root="${2}";
Lucio Andrés Illanes Albornoz 378fac
	local _tree_new="${_tree_old%.*}.new" _tree_diff="${_tree_old%.*}.diff";
Lucio Andrés Illanes Albornoz 90afa2
	if [ ! -e "${_tree_old}" ]				\
Lucio Andrés Illanes Albornoz 90afa2
	|| [ ! -e "${_tree_root}" ]; then
Lucio Andrés Illanes Albornoz 378fac
		return;
Lucio Andrés Illanes Albornoz 378fac
	fi;
Lucio Andrés Illanes Albornoz 378fac
	find "${_tree_root}" -perm /a=x	\( -type f -or -type l \) > "${_tree_new}";
Lucio Andrés Illanes Albornoz 378fac
	set +o errexit;
Lucio Andrés Illanes Albornoz 378fac
	for _pname in $(diff -u "${_tree_old}" "${_tree_new}"	|\
Lucio Andrés Illanes Albornoz 378fac
			sed -n '3,${/^+/s/^+//p}'); do
Lucio Andrés Illanes Albornoz 378fac
		if objdump -sj .debug_info "${_pname}" >/dev/null 2>&1; then
Lucio Andrés Illanes Albornoz 378fac
			log_msg info "Stripping ${_pname}...";
Lucio Andrés Illanes Albornoz 378fac
			log_msg vnfo "${TARGET}-strip ${_pname}";
Lucio Andrés Illanes Albornoz 378fac
			${TARGET}-strip ${_pname};
Lucio Andrés Illanes Albornoz 378fac
		fi;
Lucio Andrés Illanes Albornoz 378fac
	done;
Lucio Andrés Illanes Albornoz 378fac
	build_fileop rm "${_tree_old}" "${_tree_new}" "${_tree_diff}";
Lucio Andrés Illanes Albornoz 378fac
	set -o errexit;
Lucio Andrés Illanes Albornoz 378fac
};
Lucio Andrés Illanes Albornoz 378fac
Lucio Andrés Illanes Albornoz 378fac
pkg_strip() {
Lucio Andrés Illanes Albornoz 378fac
	if [ "${PKG_NAME%flavour_minipix}" != "${PKG_NAME}" ]	\
Lucio Andrés Illanes Albornoz 378fac
	&& [ ${ARG_DEBUG_MINIPIX:-0} -eq 0 ]; then
Lucio Andrés Illanes Albornoz 378fac
		pkgp_strip_tree "${WORKDIR}/.stat_minipix.old"	\
Lucio Andrés Illanes Albornoz 378fac
			"${PREFIX_MINIPIX}";
Lucio Andrés Illanes Albornoz 378fac
	elif [ "${BUILD}" = release ]; then
Lucio Andrés Illanes Albornoz 378fac
		pkgp_strip_tree "${WORKDIR}/.stat_native.old"	\
Lucio Andrés Illanes Albornoz 378fac
			"${PREFIX_NATIVE}/bin";
Lucio Andrés Illanes Albornoz 378fac
	fi;
Lucio Andrés Illanes Albornoz 378fac
};
Lucio Andrés Illanes Albornoz 378fac
Lucio Andrés Illanes Albornoz 378fac
# vim:filetype=sh