Conan_Kudo / build / midipix_build

Forked from build/midipix_build 4 years ago
Clone

Blame subr/pkg_install.subr

Lucio Andrés Illanes Albornoz (arab, vxp) 570129
#
Lucio Andrés Illanes Albornoz (arab, vxp) 802215
# set -o errexit -o noglob are assumed.
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
#
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
Lucio Andrés Illanes Albornoz (arab, vxp) f539a4
pkgp_install_clean_lib() {
Lucio Andrés Illanes Albornoz (arab, vxp) 802215
	local __;
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
	if [ -d ${PKG_PREFIX}/lib ]; then
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
		for __ in $(find ${PKG_PREFIX}/lib -type f -name \*.la); do
Lucio Andrés Illanes Albornoz (arab, vxp) bd97b6
			build_fileop rm ${__};
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
		done;
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
	fi;
Lucio Andrés Illanes Albornoz (arab, vxp) f539a4
};
Lucio Andrés Illanes Albornoz (arab, vxp) f539a4
Lucio Andrés Illanes Albornoz (arab, vxp) f539a4
pkgp_install_dlltool() {
Lucio Andrés Illanes Albornoz (arab, vxp) 802215
	local _so_fname _so_name;
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
	if [ "${PKG_BUILD_TYPE}" != "host" ]						\
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
	&& test_cmd perk								\
Lucio Andrés Illanes Albornoz (arab, vxp) 1f97e6
	&& test_cmd ${PKG_TARGET}-mdso; then
Lucio Andrés Illanes Albornoz (arab, vxp) 802215
		for _so_fname in							\
Lucio Andrés Illanes Albornoz (arab, vxp) 1f97e6
			$(find	\(  -name "*.so"					\
Lucio Andrés Illanes Albornoz (arab, vxp) 1f97e6
				-or -name "*.so.*"					\
Lucio Andrés Illanes Albornoz (arab, vxp) 1f97e6
				-or -name "*.so.*.*"					\
Lucio Andrés Illanes Albornoz (arab, vxp) 1f97e6
				-or -name "*.so.*.*.*" \) -printf '%P\n');
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
		do
Lucio Andrés Illanes Albornoz (arab, vxp) 1f97e6
			case "${_so_fname}" in
Lucio Andrés Illanes Albornoz (arab, vxp) 1f97e6
			*.so)		_so_fname_ver=""; ;;
Lucio Andrés Illanes Albornoz (arab, vxp) 1f97e6
			*.so.*)		_so_fname_ver="${_so_fname##*.so.}"; ;;
Lucio Andrés Illanes Albornoz (arab, vxp) 1f97e6
			esac;
Lucio Andrés Illanes Albornoz (arab, vxp) 1f97e6
			_so_name="${_so_fname%%.so*}";
Lucio Andrés Illanes Albornoz (arab, vxp) 1f97e6
			_lib_fname="${_so_name}${_so_fname_ver:+.${_so_fname_ver}}.lib.a";
Lucio Andrés Illanes Albornoz (arab, vxp) 1f97e6
			if [ -e "${_lib_fname}" ]					\
Lucio Andrés Illanes Albornoz (arab, vxp) 1f97e6
			|| [ ! -e "${PKG_PREFIX}/lib/$(basename "${_so_fname}")" ]	\
Lucio Andrés Illanes Albornoz (arab, vxp) 1f97e6
			|| [ "$(readlink -f "${_so_fname}")" = "/dev/null" \) ]; then
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
				continue;
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
			else
Lucio Andrés Illanes Albornoz (arab, vxp) 1f97e6
				echo perk -e "${_so_fname}"				\|\
Lucio Andrés Illanes Albornoz (arab, vxp) 1f97e6
					${PKG_TARGET}-mdso -i ${_lib_fname} -n "${_so_fname}" -
Lucio Andrés Illanes Albornoz (arab, vxp) 1f97e6
				perk -e "${_so_fname}"					|\
Lucio Andrés Illanes Albornoz (arab, vxp) 1f97e6
					${PKG_TARGET}-mdso -i ${_lib_fname} -n "${_so_fname}" -
Lucio Andrés Illanes Albornoz (arab, vxp) 1f97e6
				build_fileop cp "${_lib_fname}" "${PKG_PREFIX}/lib";
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
			fi;
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
		done;
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
	fi;
Lucio Andrés Illanes Albornoz (arab, vxp) f539a4
};
Lucio Andrés Illanes Albornoz (arab, vxp) f539a4
Lucio Andrés Illanes Albornoz (arab, vxp) b47485
pkgp_install_pkgconfig() {
Lucio Andrés Illanes Albornoz (arab, vxp) b47485
	local __;
Lucio Andrés Illanes Albornoz (arab, vxp) b47485
	for __ in $(find "${WORKDIR}/${PKG_BUILD_DIR}" -name \*.pc); do 
Lucio Andrés Illanes Albornoz (arab, vxp) b47485
		if grep -Eq '^libdir=[^$]+$' "${__}"; then
Lucio Andrés Illanes Albornoz (arab, vxp) 3ac274
			sed -i	-e '/^libdir=[^$]\+$/s/^libdir=\(.\+\)$/libdir=${exec_prefix}\1/'	\
Lucio Andrés Illanes Albornoz (arab, vxp) 3ac274
				-e '/^exec_prefix=$/s/^.*$/exec_prefix=${prefix}/'			\
Lucio Andrés Illanes Albornoz (arab, vxp) b47485
					"${__}";
Lucio Andrés Illanes Albornoz (arab, vxp) b47485
		fi;
Lucio Andrés Illanes Albornoz (arab, vxp) b47485
	done;
Lucio Andrés Illanes Albornoz (arab, vxp) b47485
};
Lucio Andrés Illanes Albornoz (arab, vxp) b47485
Lucio Andrés Illanes Albornoz (arab, vxp) f539a4
pkg_install() {
Lucio Andrés Illanes Albornoz (arab, vxp) b47485
	pkgp_install_pkgconfig;
Lucio Andrés Illanes Albornoz (arab, vxp) f539a4
	if [ ${PKG_NO_MAKE_INSTALL:-0} -eq 0 ]; then
Lucio Andrés Illanes Albornoz (arab, vxp) b47485
		run_cmd_unsplit make							\
Lucio Andrés Illanes Albornoz (arab, vxp) b47485
			${PKG_MAKEFLAGS_INSTALL}					\
Lucio Andrés Illanes Albornoz (arab, vxp) b47485
			${PKG_MAKEFLAGS_INSTALL_EXTRA}					\
Lucio Andrés Illanes Albornoz (arab, vxp) b47485
			AR=${AR} CC=${CC} RANLIB=${RANLIB}				\
Lucio Andrés Illanes Albornoz (arab, vxp) f539a4
			"${PKG_CFLAGS_INSTALL:+CFLAGS=${PKG_CFLAGS_INSTALL}}"				\
Lucio Andrés Illanes Albornoz (arab, vxp) f539a4
			"${PKG_CFLAGS_INSTALL_EXTRA:+CFLAGS+=${PKG_CFLAGS_INSTALL_EXTRA}}"		\
Lucio Andrés Illanes Albornoz (arab, vxp) f539a4
			"${PKG_LDFLAGS_INSTALL:+LDFLAGS=${PKG_LDFLAGS_INSTALL}}"			\
Lucio Andrés Illanes Albornoz (arab, vxp) f539a4
			"${PKG_LDFLAGS_INSTALL_EXTRA:+LDFLAGS+=${PKG_LDFLAGS_INSTALL_EXTRA}}"		\
Lucio Andrés Illanes Albornoz (arab, vxp) f539a4
			"${PKG_RANLIB_INSTALL:+RANLIB=${PKG_RANLIB_INSTALL}}"				\
Lucio Andrés Illanes Albornoz (arab, vxp) f539a4
			${PKG_INSTALL_TARGET:=install};
Lucio Andrés Illanes Albornoz (arab, vxp) f539a4
		if [ -n "${PKG_PREFIX_EXTRA}" ]; then
Lucio Andrés Illanes Albornoz (arab, vxp) b47485
			run_cmd_unsplit make						\
Lucio Andrés Illanes Albornoz (arab, vxp) b47485
				${PKG_MAKEFLAGS_INSTALL}				\
Lucio Andrés Illanes Albornoz (arab, vxp) b47485
				${PKG_MAKEFLAGS_INSTALL_EXTRA}				\
Lucio Andrés Illanes Albornoz (arab, vxp) b47485
				AR=${AR} CC=${CC} RANLIB=${RANLIB}			\
Lucio Andrés Illanes Albornoz (arab, vxp) f539a4
				"${PKG_CFLAGS_INSTALL:+CFLAGS=${PKG_CFLAGS_INSTALL}}"			\
Lucio Andrés Illanes Albornoz (arab, vxp) f539a4
				"${PKG_CFLAGS_INSTALL_EXTRA:+CFLAGS+=${PKG_CFLAGS_INSTALL_EXTRA}}"	\
Lucio Andrés Illanes Albornoz (arab, vxp) f539a4
				"${PKG_LDFLAGS_INSTALL:+LDFLAGS=${PKG_LDFLAGS_INSTALL}}"		\
Lucio Andrés Illanes Albornoz (arab, vxp) f539a4
				"${PKG_LDFLAGS_INSTALL_EXTRA:+LDFLAGS+=${PKG_LDFLAGS_INSTALL_EXTRA}}"	\
Lucio Andrés Illanes Albornoz (arab, vxp) f539a4
				"${PKG_RANLIB_INSTALL:+RANLIB=${PKG_RANLIB_INSTALL}}"			\
Lucio Andrés Illanes Albornoz (arab, vxp) b47485
				${PKG_INSTALL_TARGET_EXTRA:=install}			\
Lucio Andrés Illanes Albornoz (arab, vxp) f539a4
				DESTDIR=${PKG_PREFIX_EXTRA};
Lucio Andrés Illanes Albornoz (arab, vxp) f539a4
		fi;
Lucio Andrés Illanes Albornoz (arab, vxp) f539a4
	fi;
Lucio Andrés Illanes Albornoz (arab, vxp) f539a4
	pkgp_install_clean_lib;
Lucio Andrés Illanes Albornoz (arab, vxp) bd6eba
	if [ -n "${PKG_INSTALL_FILES}" ]; then
Lucio Andrés Illanes Albornoz (arab, vxp) bd97b6
		(install_files -v ${PKG_PREFIX} ${PKG_INSTALL_FILES});
Lucio Andrés Illanes Albornoz (arab, vxp) bd6eba
	fi;
Lucio Andrés Illanes Albornoz (arab, vxp) f539a4
	pkgp_install_dlltool;
Lucio Andrés Illanes Albornoz (arab, vxp) b47485
	pkgp_install_pkgconfig;
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
};
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
# vim:filetype=sh