Conan_Kudo / build / midipix_build

Forked from build/midipix_build 4 years ago
Clone

Blame subr/pkg_install_files.subr

Lucio Andrés Illanes Albornoz (arab, vxp) c27bea
#
Lucio Andrés Illanes Albornoz e1d469
# set +o errexit -o noglob -o nounset is assumed.
Lucio Andrés Illanes Albornoz (arab, vxp) c27bea
#
Lucio Andrés Illanes Albornoz (arab, vxp) c27bea
Lucio Andrés Illanes Albornoz 2b85d0
pkgp_install_files() {
Lucio Andrés Illanes Albornoz e1d469
	if [ -n "${PKG_INSTALL_FILES:-}" ]; then
Lucio Andrés Illanes Albornoz bf9edf
		if ! rtl_install -v "${PKG_DESTDIR}" ${PKG_INSTALL_FILES}; then
Lucio Andrés Illanes Albornoz bf9edf
			return 1;
Lucio Andrés Illanes Albornoz bf9edf
		fi;
Lucio Andrés Illanes Albornoz 2b85d0
	fi;
Lucio Andrés Illanes Albornoz 2b85d0
};
Lucio Andrés Illanes Albornoz 2b85d0
Lucio Andrés Illanes Albornoz 8e39bd
pkgp_install_files_perms() {
Lucio Andrés Illanes Albornoz 8e39bd
	local _destdir="" _fname="" IFS;
Lucio Andrés Illanes Albornoz 8e39bd
	for _destdir in "${PKG_DESTDIR}" "${PKG_DESTDIR_HOST}"; do
Lucio Andrés Illanes Albornoz 8e39bd
		if [ -e "${_destdir}" ]; then
Lucio Andrés Illanes Albornoz 8e39bd
			rtl_set_IFS_nl;
Lucio Andrés Illanes Albornoz 8e39bd
			for _fname in $(find "${_destdir}" -type d); do
Lucio Andrés Illanes Albornoz 8e39bd
				if ! rtl_fileop chmod 0755 "${_fname}"; then
Lucio Andrés Illanes Albornoz 8e39bd
					return 1;
Lucio Andrés Illanes Albornoz 8e39bd
				fi;
Lucio Andrés Illanes Albornoz 8e39bd
			done;
Lucio Andrés Illanes Albornoz 8e39bd
			for _fname in $(find "${_destdir}" \( -not -perm /0111 \) -type f); do
Lucio Andrés Illanes Albornoz 8e39bd
				if ! rtl_fileop chmod 0644 "${_fname}"; then
Lucio Andrés Illanes Albornoz 8e39bd
					return 1;
Lucio Andrés Illanes Albornoz 8e39bd
				fi;
Lucio Andrés Illanes Albornoz 8e39bd
			done;
Lucio Andrés Illanes Albornoz 8e39bd
			for _fname in $(find "${_destdir}" -perm /0111 -type f); do
Lucio Andrés Illanes Albornoz 8e39bd
				if ! rtl_fileop chmod 0755 "${_fname}"; then
Lucio Andrés Illanes Albornoz 8e39bd
					return 1;
Lucio Andrés Illanes Albornoz 8e39bd
				fi;
Lucio Andrés Illanes Albornoz 8e39bd
			done;
Lucio Andrés Illanes Albornoz 8e39bd
		fi;
Lucio Andrés Illanes Albornoz 8e39bd
	done;
Lucio Andrés Illanes Albornoz 8e39bd
};
Lucio Andrés Illanes Albornoz 8e39bd
Lucio Andrés Illanes Albornoz 2b85d0
pkgp_install_files_pkgconfig() {
Lucio Andrés Illanes Albornoz 2b85d0
	local _pc_path="";
Lucio Andrés Illanes Albornoz 2b85d0
	for _pc_path in $(find "${PKG_DESTDIR}" -name \*.pc); do
Lucio Andrés Illanes Albornoz 0d1c4f
		if [ -n "$(sed -ne '/^libdir=[^$]*$/p' "${_pc_path}")" ]			\
Lucio Andrés Illanes Albornoz 0d1c4f
		&& ! sed -i""	-e '/^libdir=[^$]*$/s/^libdir=\(.*\)$/libdir=${exec_prefix}\1/'	\
Lucio Andrés Illanes Albornoz 0d1c4f
				-e '/^exec_prefix=$/s/^.*$/exec_prefix=${prefix}/'		\
Lucio Andrés Illanes Albornoz bf9edf
				"${_pc_path}"; then
Lucio Andrés Illanes Albornoz bf9edf
			return 1;
Lucio Andrés Illanes Albornoz 2b85d0
		fi;
Lucio Andrés Illanes Albornoz 2b85d0
	done;
Lucio Andrés Illanes Albornoz 2b85d0
};
Lucio Andrés Illanes Albornoz 2b85d0
Lucio Andrés Illanes Albornoz 2b85d0
pkgp_install_files_strip() {
Lucio Andrés Illanes Albornoz 00ef8a
	local _bin_path="" _stripfl=0 _tree_root="${PKG_DESTDIR}";
Lucio Andrés Illanes Albornoz 00ef8a
	if [ -e "${_tree_root}" ]; then
Lucio Andrés Illanes Albornoz 00ef8a
		if rtl_match "${PKG_NAME}" "*_minipix"; then
Lucio Andrés Illanes Albornoz 00ef8a
			: $((_stripfl=(${ARG_DEBUG_MINIPIX:-0} ? 0 : 1)));
Lucio Andrés Illanes Albornoz 00ef8a
		elif [ "${BUILD_KIND}" = release ]\
Lucio Andrés Illanes Albornoz 00ef8a
		&&   [ "${PKG_BUILD_TYPE}" = native ]; then
Lucio Andrés Illanes Albornoz 00ef8a
			_stripfl=1;
Lucio Andrés Illanes Albornoz 00ef8a
		else
Lucio Andrés Illanes Albornoz 00ef8a
			_stripfl=0;
Lucio Andrés Illanes Albornoz 2b85d0
		fi;
Lucio Andrés Illanes Albornoz 00ef8a
		if [ "${_stripfl:-0}" -eq 1 ]; then
Lucio Andrés Illanes Albornoz 00ef8a
			for _bin_path in $(find "${_tree_root}" -perm /a=x -type f); do
Lucio Andrés Illanes Albornoz 00ef8a
				if objdump -sj .debug_frame -j .debug_info "${_bin_path}" >/dev/null 2>&1; then
Lucio Andrés Illanes Albornoz 00ef8a
					rtl_log_msg info "Stripping %s..." "${_bin_path}";
Lucio Andrés Illanes Albornoz 00ef8a
					if ! "${PKG_TARGET}-strip" "${_bin_path}"; then
Lucio Andrés Illanes Albornoz 00ef8a
						return 1;
Lucio Andrés Illanes Albornoz 00ef8a
					fi;
Lucio Andrés Illanes Albornoz bf9edf
				fi;
Lucio Andrés Illanes Albornoz 00ef8a
			done;
Lucio Andrés Illanes Albornoz 00ef8a
		fi;
Lucio Andrés Illanes Albornoz 2b85d0
	fi;
Lucio Andrés Illanes Albornoz 2b85d0
};
Lucio Andrés Illanes Albornoz 2b85d0
Lucio Andrés Illanes Albornoz 2b85d0
pkg_install_files() {
Lucio Andrés Illanes Albornoz 2b85d0
	if ! pkgp_install_files\
Lucio Andrés Illanes Albornoz 8e39bd
	|| ! pkgp_install_files_perms\
Lucio Andrés Illanes Albornoz 2b85d0
	|| ! pkgp_install_files_pkgconfig\
Lucio Andrés Illanes Albornoz 2b85d0
	|| ! pkgp_install_files_strip; then
Lucio Andrés Illanes Albornoz bf9edf
		return 1;
Lucio Andrés Illanes Albornoz (arab, vxp) c27bea
	fi;
Lucio Andrés Illanes Albornoz (arab, vxp) c27bea
};
Lucio Andrés Illanes Albornoz (arab, vxp) c27bea
Lucio Andrés Illanes Albornoz (arab, vxp) c27bea
# vim:filetype=sh