midipix / 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) 570129
	&& test_cmd ${PKG_TARGET}-dlltool; then
Lucio Andrés Illanes Albornoz (arab, vxp) 802215
		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) 802215
			if [ \( -e ${_so_fname%.so}.lib.a \) -o				\
Lucio Andrés Illanes Albornoz (arab, vxp) 4cb0c0
			     \( ! -e ${PKG_PREFIX}/lib/$(basename ${_so_fname}) \) -o	\
Lucio Andrés Illanes Albornoz (arab, vxp) 4cb0c0
			     \( "$(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) 802215
				_so_name="${_so_fname%.so}";
Lucio Andrés Illanes Albornoz (arab, vxp) 802215
				echo perk -epdlltool ${_so_fname} \> ${_so_fname%.so}.def;
Lucio Andrés Illanes Albornoz (arab, vxp) 802215
				perk -epdlltool ${_so_fname} > ${_so_fname%.so}.def;
Lucio Andrés Illanes Albornoz (arab, vxp) 802215
				echo ${PKG_TARGET}-dlltool -l ${_so_fname%.so}.lib.a	\
Lucio Andrés Illanes Albornoz (arab, vxp) 802215
					-D ${_so_fname} -d ${_so_fname%.so}.def;
Lucio Andrés Illanes Albornoz (arab, vxp) 802215
				${PKG_TARGET}-dlltool -l ${_so_fname%.so}.lib.a	\
Lucio Andrés Illanes Albornoz (arab, vxp) 802215
					-D ${_so_fname} -d ${_so_fname%.so}.def;
Lucio Andrés Illanes Albornoz (arab, vxp) 802215
				build_fileop 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) 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