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) 570129
# . ./build.vars and set -o errexit -o noglob are assumed.
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
# See warning at the top of build.vars.
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
#
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
pkg_install() {
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
	if test_cmd pkg_${PKG_NAME}_install; then
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
		pkg_${PKG_NAME}_install;
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
	else
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
		if [ ${PKG_NO_MAKE_INSTALL:-0} -eq 0 ]; then
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
			run_cmd_unsplit make					\
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
				${PKG_MAKEFLAGS_INSTALL}			\
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
				${PKG_MAKEFLAGS_INSTALL_EXTRA}			\
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
				AR=${AR} CC=${CC} RANLIB=${RANLIB}		\
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
				"${PKG_CFLAGS_INSTALL:+CFLAGS=${PKG_CFLAGS_INSTALL}}"				\
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
				"${PKG_CFLAGS_INSTALL_EXTRA:+CFLAGS+=${PKG_CFLAGS_INSTALL_EXTRA}}"		\
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
				"${PKG_LDFLAGS_INSTALL:+LDFLAGS=${PKG_LDFLAGS_INSTALL}}"			\
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
				"${PKG_LDFLAGS_INSTALL_EXTRA:+LDFLAGS+=${PKG_LDFLAGS_INSTALL_EXTRA}}"		\
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
				"${PKG_RANLIB_INSTALL:+RANLIB=${PKG_RANLIB_INSTALL}}"				\
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
				${PKG_INSTALL_TARGET:=install};
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
			if [ -n "${PKG_PREFIX_EXTRA}" ]; then
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
				run_cmd_unsplit make				\
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
					${PKG_MAKEFLAGS_INSTALL}		\
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
					${PKG_MAKEFLAGS_INSTALL_EXTRA}		\
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
					AR=${AR} CC=${CC} RANLIB=${RANLIB}	\
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
					"${PKG_CFLAGS_INSTALL:+CFLAGS=${PKG_CFLAGS_INSTALL}}"			\
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
					"${PKG_CFLAGS_INSTALL_EXTRA:+CFLAGS+=${PKG_CFLAGS_INSTALL_EXTRA}}"	\
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
					"${PKG_LDFLAGS_INSTALL:+LDFLAGS=${PKG_LDFLAGS_INSTALL}}"		\
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
					"${PKG_LDFLAGS_INSTALL_EXTRA:+LDFLAGS+=${PKG_LDFLAGS_INSTALL_EXTRA}}"	\
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
					"${PKG_RANLIB_INSTALL:+RANLIB=${PKG_RANLIB_INSTALL}}"			\
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
					${PKG_INSTALL_TARGET_EXTRA:=install}	\
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
					DESTDIR=${PKG_PREFIX_EXTRA};
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
			fi;
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
		fi;
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
		if test_cmd pkg_${PKG_NAME}_install_post; then
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
			pkg_${PKG_NAME}_install_post;
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
		fi;
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
	fi;
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) 570129
			secure_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) 570129
	if [ -n "${PKG_INSTALL_FILES}" ]; then
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
		(set -- ${PKG_INSTALL_FILES};
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
		while [ ${#} -gt 0 ]; do
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
		case "${1}" in
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
		@*=*)
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
			__ln_target="${1%=*}";
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
			__ln_target="${__ln_target#@}";
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
			__ln_fname="${1#*=}";
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
			echo ln -sf -- ${__ln_target} ${PKG_PREFIX}/${__ln_fname};
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
			ln -sf -- ${__ln_target} ${PKG_PREFIX}/${__ln_fname};
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
			;;
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
		/=*)
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
			__mkdir_fname="${1#/=}";
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
			insecure_mkdir ${PKG_PREFIX}/${__mkdir_fname};
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
			;;
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
		*)
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
			__file_fname_src="${1%=*}";
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
			__file_fname_dst="${1#*=}";
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
			echo cp -pP -- ${__file_fname_src} ${PKG_PREFIX}/${__file_fname_dst};
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
			cp -pP -- ${__file_fname_src} ${PKG_PREFIX}/${__file_fname_dst};
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
			;;
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
		esac; shift;
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) 570129
	if [ "${PKG_BUILD_TYPE}" != "host" ]						\
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
	&& test_cmd perk								\
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
	&& test_cmd ${PKG_TARGET}-dlltool; then
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
		for __so_fname in							\
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
			$(find	\( -name "*.so"						\
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
				-or -name "*.so.[0-9]"					\
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
				-or -name "*.so.[0-9].[0-9]"				\
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
				-or -name "*.so.[0-9].[0-9].[0-9]" \) -printf '%P\n');
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
		do
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
			if [ \( -e ${__so_fname%.so}.lib.a \) -o			\
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
			     \( ! -e ${PKG_PREFIX}/lib/$(basename ${__so_fname}) \) ];
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
			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) 570129
				__so_name="${__so_fname%.so}";
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
				echo perk -epdlltool ${__so_fname} \> ${__so_fname%.so}.def;
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
				perk -epdlltool ${__so_fname} > ${__so_fname%.so}.def;
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
				echo ${PKG_TARGET}-dlltool -l ${__so_fname%.so}.lib.a	\
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
					-D ${__so_fname} -d ${__so_fname%.so}.def;
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
				${PKG_TARGET}-dlltool -l ${__so_fname%.so}.lib.a	\
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
					-D ${__so_fname} -d ${__so_fname%.so}.def;
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
				echo cp -- ${__so_fname%.so}.lib.a "${PKG_PREFIX}/lib";
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
				cp -- ${__so_fname%.so}.lib.a "${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) 570129
	set_build_script_done install -finish;
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