Blob Blame History Raw
#
# Copyright (c) 2016, 2017, 2018, 2019, 2020, 2021, 2022, 2023 LucĂ­a Andrea Illanes Albornoz <lucia@luciaillanes.de>
# set +o errexit -o noglob -o nounset is assumed.
#

pkgp_install_files() {
	if [ "${PKG_INSTALL_FILES:+1}" = 1 ]; then
		if ! rtl_install -v "${PKG_DESTDIR}" ${PKG_INSTALL_FILES}; then
			return 1;
		fi;
	fi;
	return 0;
};

pkgp_install_files_v2() {
	local _ppifv2_status="" _ppifv2_vflag="";

	if [ "${PKG_INSTALL_FILES_V2:+1}" = 1 ]; then
		if rtl_lmatch \$ARG_VERBOSE_TAGS "install" ","; then
			_ppifv2_vflag="-v";
		fi;
		if ! rtl_install_v2							\
				\$_ppifv2_status					\
				-p "_builddir=${PKG_BUILD_DIR}"				\
				-p "_destdir=${PKG_BASE_DIR}/${PKG_DESTDIR}"		\
				-p "_destdir_host=${PKG_BASE_DIR}/${PKG_DESTDIR_HOST}"	\
				-p "_files=${MIDIPIX_BUILD_PWD}/files/${PKG_NAME}"	\
				-p "_name=${PKG_NAME}"					\
				-p "_prefix=${PKG_PREFIX}"				\
				-p "_prefix_host=${PREFIX}"				\
				-p "_prefix_native=${PREFIX_NATIVE}"			\
				-p "_subdir=${PKG_BASE_DIR}/${PKG_SUBDIR}"		\
				-p "_target=${PKG_TARGET}"				\
				-p "_version=${PKG_VERSION:-}"				\
				-p "_workdir=${BUILD_WORKDIR}"				\
				${_ppifv2_vflag} -- "${PKG_DESTDIR}"			\
				"${PKG_INSTALL_FILES_V2}";
		then
			return 1;
		fi;
	fi;
};

pkgp_install_files_libraries() {
	if [ "${PKG_BUILD_TYPE}" != "host" ]; then
		ex_rtl_install_library_archives "${PKG_DESTDIR}" "${PKG_TARGET}-mdso" || return 1;
	fi;
	ex_rtl_purge_la_files "${PKG_DESTDIR}" || return 1;
	return 0;
};

pkgp_install_files_perms() {
	rtl_set_perms_treeV		\
		0755 0755 0644		\
		"${PKG_DESTDIR}"	\
		"${PKG_DESTDIR_HOST}";
	return "${?}";
};

pkgp_install_files_strip() {
	local _ppifs_pkg_minipixfl=0 _ppifs_rc=0;

	rtl_match "${PKG_NAME}" "*_minipix"; _ppifs_pkg_minipixfl="${?}";
	if [ \( "${_ppifs_pkg_minipixfl}" -eq 0 \) -a \( "${ARG_DEBUG_MINIPIX:-0}" -eq 0 \) ]\
	|| [ \( "${BUILD_KIND}" = release \) -a \( "${PKG_BUILD_TYPE}" = native \) ]; then
		ex_rtl_strip_files		\
			"${PKG_TARGET}-strip"	\
			"${PKG_DESTDIR}"	\
			--			\
			rtl_log_msgV "pkg_strip" "${MSG_pkg_strip}";
		_ppifs_rc="${?}";
	fi;

	return "${_ppifs_rc}";
};

pkg_install_files() {
	local _pif_group_name="${1}" _pif_pkg_name="${2}" _pif_restart_at="${3}";

	if ! pkgp_install_files\
	|| ! pkgp_install_files_v2\
	|| ! pkgp_install_files_perms\
	|| ! ex_rtl_fixup_pkgconfig_paths "${PKG_DESTDIR}"\
	|| ! pkgp_install_files_strip\
	|| ! pkgp_install_files_libraries;
	then
		return 1;
	fi;
	return 0;
};

# vim:filetype=sh textwidth=0