summaryrefslogtreecommitdiffhomepage
path: root/subr/pkg_install_files.subr
blob: 19c1a15b23c8078e605c25994b94a7503dd76071 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#
# set +o errexit -o noglob -o nounset is assumed.
#

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

pkgp_install_files_pkgconfig() {
	local _pc_path="";
	for _pc_path in $(find "${PKG_DESTDIR}" -name \*.pc); do
		if [ -n "$(sed -ne '/^libdir=[^$]*$/p' "${_pc_path}")" ]			\
		&& ! sed -i""	-e '/^libdir=[^$]*$/s/^libdir=\(.*\)$/libdir=${exec_prefix}\1/'	\
				-e '/^exec_prefix=$/s/^.*$/exec_prefix=${prefix}/'		\
				"${_pc_path}"; then
			return 1;
		fi;
	done;
};

pkgp_install_files_strip() {
	local _bin_path="" _tree_root="${PKG_DESTDIR}";
	if [ -e "${_tree_root}" ]\
	&& [ "${BUILD_KIND}" = release ]\
	&& [ "${PKG_BUILD_TYPE}" = native ]; then
		if [ "${PKG_NAME%_minipix}" != "${PKG_NAME}" ]\
		&& [ "${ARG_DEBUG_MINIPIX:-0}" -eq 1 ]; then
			return 0;
		fi;
		for _bin_path in $(find "${_tree_root}" -perm /a=x -type f); do
			if objdump -sj .debug_frame -j .debug_info "${_bin_path}" >/dev/null 2>&1; then
				rtl_log_msg info "Stripping %s..." "${_bin_path}";
				if ! "${PKG_TARGET}-strip" "${_bin_path}"; then
					return 1;
				fi;
			fi;
		done;
	fi;
};

pkg_install_files() {
	if ! pkgp_install_files\
	|| ! pkgp_install_files_pkgconfig\
	|| ! pkgp_install_files_strip; then
		return 1;
	fi;
};

# vim:filetype=sh