Blame subr.pkg/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() {
e9fa07
	if [ "${PKG_INSTALL_FILES:+1}" = 1 ]; 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;
e9fa07
	return 0;
Lucio Andrés Illanes Albornoz 2b85d0
};
Lucio Andrés Illanes Albornoz 2b85d0
Lucio Andrés Illanes Albornoz 611492
pkgp_install_files_v2() {
e9fa07
	local _ppifv2_status="" _ppifv2_vflag="";
Lucio Andrés Illanes Albornoz 611492
e9fa07
	if [ "${PKG_INSTALL_FILES_V2:+1}" = 1 ]; then
e9fa07
		if rtl_lmatch \$ARG_VERBOSE_TAGS "install" ","; then
e9fa07
			_ppifv2_vflag="-v";
Lucio Andrés Illanes Albornoz 30cdf7
		fi;
Lucio Andrés Illanes Albornoz 611492
		if ! rtl_install_v2							\
e9fa07
				\$_ppifv2_status					\
Lucio Andrés Illanes Albornoz 611492
				-p "_builddir=${PKG_BUILD_DIR}"				\
Lucio Andrés Illanes Albornoz 611492
				-p "_destdir=${PKG_BASE_DIR}/${PKG_DESTDIR}"		\
Lucio Andrés Illanes Albornoz 611492
				-p "_destdir_host=${PKG_BASE_DIR}/${PKG_DESTDIR_HOST}"	\
Lucio Andrés Illanes Albornoz 611492
				-p "_files=${MIDIPIX_BUILD_PWD}/files/${PKG_NAME}"	\
Lucio Andrés Illanes Albornoz 611492
				-p "_name=${PKG_NAME}"					\
Lucio Andrés Illanes Albornoz 611492
				-p "_prefix=${PKG_PREFIX}"				\
Lucio Andrés Illanes Albornoz 611492
				-p "_prefix_host=${PREFIX}"				\
Lucio Andrés Illanes Albornoz 611492
				-p "_prefix_native=${PREFIX_NATIVE}"			\
Lucio Andrés Illanes Albornoz 611492
				-p "_subdir=${PKG_BASE_DIR}/${PKG_SUBDIR}"		\
Lucio Andrés Illanes Albornoz 611492
				-p "_target=${PKG_TARGET}"				\
Lucio Andrés Illanes Albornoz 611492
				-p "_version=${PKG_VERSION:-}"				\
Lucio Andrés Illanes Albornoz 611492
				-p "_workdir=${BUILD_WORKDIR}"				\
e9fa07
				${_ppifv2_vflag} -- "${PKG_DESTDIR}"			\
e9fa07
				"${PKG_INSTALL_FILES_V2}";
e9fa07
		then
Lucio Andrés Illanes Albornoz 611492
			return 1;
Lucio Andrés Illanes Albornoz 611492
		fi;
Lucio Andrés Illanes Albornoz 611492
	fi;
Lucio Andrés Illanes Albornoz 611492
};
Lucio Andrés Illanes Albornoz 611492
Lucio Andrés Illanes Albornoz 8e39bd
pkgp_install_files_perms() {
e9fa07
	local _ppifp_destdir="" _ppifp_fname="" IFS;
e9fa07
e9fa07
	for _ppifp_destdir in "${PKG_DESTDIR}" "${PKG_DESTDIR_HOST}"; do
e9fa07
		if [ -e "${_ppifp_destdir}" ]; then
Lucio Andrés Illanes Albornoz 8e39bd
			rtl_set_IFS_nl;
e9fa07
e9fa07
			for _ppifp_fname in $(find "${_ppifp_destdir}" -type d); do
e9fa07
				if ! rtl_fileop chmod 0755 "${_ppifp_fname}"; then
Lucio Andrés Illanes Albornoz 8e39bd
					return 1;
Lucio Andrés Illanes Albornoz 8e39bd
				fi;
Lucio Andrés Illanes Albornoz 8e39bd
			done;
e9fa07
e9fa07
			for _ppifp_fname in $(find "${_ppifp_destdir}" \( -not -perm /0111 \) -type f); do
e9fa07
				if ! rtl_fileop chmod 0644 "${_ppifp_fname}"; then
Lucio Andrés Illanes Albornoz 8e39bd
					return 1;
Lucio Andrés Illanes Albornoz 8e39bd
				fi;
Lucio Andrés Illanes Albornoz 8e39bd
			done;
e9fa07
e9fa07
			for _ppifp_fname in $(find "${_ppifp_destdir}" -perm /0111 -type f); do
e9fa07
				if ! rtl_fileop chmod 0755 "${_ppifp_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;
e9fa07
	return 0;
Lucio Andrés Illanes Albornoz 8e39bd
};
Lucio Andrés Illanes Albornoz 8e39bd
Lucio Andrés Illanes Albornoz 2b85d0
pkgp_install_files_pkgconfig() {
e9fa07
	local _ppifp2_pc_path="";
e9fa07
e9fa07
	for _ppifp2_pc_path in $(find "${PKG_DESTDIR}" -name \*.pc); do
e9fa07
		if [ -n "$(sed -ne '/^libdir=[^$]*$/p' "${_ppifp2_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}/'		\
e9fa07
				"${_ppifp2_pc_path}"; then
Lucio Andrés Illanes Albornoz bf9edf
			return 1;
Lucio Andrés Illanes Albornoz 2b85d0
		fi;
e9fa07
e9fa07
		if [ -n "$(sed -ne '/^includedir=[^$]*$/p' "${_ppifp2_pc_path}")" ]			\
786c74
		&& ! sed -i""	-e '/^includedir=[^$]*$/s/^includedir=\(.*\)$/includedir=${prefix}\1/'	\
e9fa07
				"${_ppifp2_pc_path}"; then
786c74
			return 1;
786c74
		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() {
e9fa07
	local _ppifs_bin_path="" _ppifs_stripfl=0 _ppifs_tree_root="${PKG_DESTDIR}";
e9fa07
e9fa07
	if [ -e "${_ppifs_tree_root}" ]; then
e9fa07
		if rtl_match "${PKG_NAME}" "*_ppifs_minipix"; then
e9fa07
			: $((_ppifs_stripfl=(${ARG_DEBUG_MINIPIX:-0} ? 0 : 1)));
Lucio Andrés Illanes Albornoz 00ef8a
		elif [ "${BUILD_KIND}" = release ]\
e9fa07
		&&   [ "${PKG_BUILD_TYPE}" = native ];
e9fa07
		then
e9fa07
			_ppifs_stripfl=1;
Lucio Andrés Illanes Albornoz 00ef8a
		else
e9fa07
			_ppifs_stripfl=0;
Lucio Andrés Illanes Albornoz 2b85d0
		fi;
e9fa07
e9fa07
		if [ "${_ppifs_stripfl:-0}" -eq 1 ]; then
e9fa07
			for _ppifs_bin_path in $(find "${_ppifs_tree_root}" -perm /a=x -type f); do
e9fa07
				if objdump -sj .debug_frame -j .debug_info "${_ppifs_bin_path}" >/dev/null 2>&1; then
e9fa07
					rtl_log_msg "pkg_strip" "${MSG_pkg_strip}" "${_ppifs_bin_path}";
e9fa07
					if ! "${PKG_TARGET}-strip" "${_ppifs_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;
e9fa07
	return 0;
Lucio Andrés Illanes Albornoz 2b85d0
};
Lucio Andrés Illanes Albornoz 2b85d0
Lucio Andrés Illanes Albornoz 2b85d0
pkg_install_files() {
e9fa07
	local _pif_group_name="${1}" _pif_pkg_name="${2}" _pif_restart_at="${3}";
e9fa07
Lucio Andrés Illanes Albornoz 2b85d0
	if ! pkgp_install_files\
Lucio Andrés Illanes Albornoz 611492
	|| ! pkgp_install_files_v2\
Lucio Andrés Illanes Albornoz 8e39bd
	|| ! pkgp_install_files_perms\
Lucio Andrés Illanes Albornoz 2b85d0
	|| ! pkgp_install_files_pkgconfig\
e9fa07
	|| ! pkgp_install_files_strip;
e9fa07
	then
Lucio Andrés Illanes Albornoz bf9edf
		return 1;
Lucio Andrés Illanes Albornoz (arab, vxp) c27bea
	fi;
e9fa07
	return 0;
Lucio Andrés Illanes Albornoz (arab, vxp) c27bea
};
Lucio Andrés Illanes Albornoz (arab, vxp) c27bea
64844b
# vim:filetype=sh textwidth=0