Conan_Kudo / build / midipix_build

Forked from build/midipix_build 4 years ago
Clone

Blame pkg.build

Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
#
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
# . ./build.vars and set -o errexit are assumed.
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
#
Lucio Andrés Illanes Albornoz (arab, vxp) f9c386
Lucio Andrés Illanes Albornoz (arab, vxp) 392fef
parse_with_pkg_name ${SCRIPT_FNAME%[0-9][0-9]*} ${2} ${PKG_BUILD_NAMES};
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
if ! is_build_script_done fetch; then
Lucio Andrés Illanes Albornoz (arab, vxp) 9ba5d3
	if [ "${PKG_URL_TYPE:-wget}" = wget ]; then
Lucio Andrés Illanes Albornoz (arab, vxp) f9c386
		fetch ${PKG_URL} ${PKG_SHA256SUM};
Lucio Andrés Illanes Albornoz (arab, vxp) fa26ee
	else
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
		fetch_git ${PKG_SUBDIR} ${PKG_URL} "${PKG_GIT_ARGS_EXTRA}";
Lucio Andrés Illanes Albornoz (arab, vxp) 1d3841
	fi;
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
	set_build_script_done fetch -extract;
lalbornoz 340f4c
fi;
Lucio Andrés Illanes Albornoz (arab, vxp) 392fef
if test_cmd pkg_${PKG_NAME}_finish; then
Lucio Andrés Illanes Albornoz (arab, vxp) f9c386
	pkg_${PKG_NAME}_finish; exit 0;
Lucio Andrés Illanes Albornoz (arab, vxp) 9ba5d3
elif [ "${PKG_URL_TYPE:-wget}" = wget ] &&\
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
! is_build_script_done extract; then
Lucio Andrés Illanes Albornoz (arab, vxp) 96b309
	rm_if_exists ${PKG_SUBDIR};
Lucio Andrés Illanes Albornoz (arab, vxp) 96b309
	tar -axf ${PKG_FNAME};
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
	set_build_script_done extract -build_dir;
lalbornoz 340f4c
fi;
Lucio Andrés Illanes Albornoz (arab, vxp) 392fef
if [ -z "${PKG_BUILD_DIR}" ]; then
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
	set_build_dir ${PKG_SUBDIR} ${PKG_BUILD_TYPE:-native};
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
fi;
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
if ! is_build_script_done build_dir; then
Lucio Andrés Illanes Albornoz (arab, vxp) 392fef
	[ ${PKG_SUBDIR} != ${PKG_BUILD_DIR} ] &&\
Lucio Andrés Illanes Albornoz (arab, vxp) 392fef
		rm_if_exists -m ${PKG_BUILD_DIR};
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
	set_build_script_done build_dir -patch;
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
fi;
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
if ! is_build_script_done patch; then
Lucio Andrés Illanes Albornoz (arab, vxp) 392fef
	for PATCH_FNAME in portage/${PKG_SUBDIR}.midipix.patch	\
Lucio Andrés Illanes Albornoz (arab, vxp) 92254a
			${_PWD}/${PKG_SUBDIR}.local.patch	\
Lucio Andrés Illanes Albornoz (arab, vxp) 92254a
			${_PWD}/${PKG_SUBDIR}.local@${BUILD_HNAME}.patch; do
Lucio Andrés Illanes Albornoz (arab, vxp) 392fef
		[ -r ${PATCH_FNAME} ] &&\
Lucio Andrés Illanes Albornoz (arab, vxp) 392fef
			patch -b -d ${PKG_SUBDIR} -p1 < ${PATCH_FNAME};
Lucio Andrés Illanes Albornoz (arab, vxp) 392fef
	done; unset PATCH_FNAME;
Lucio Andrés Illanes Albornoz (arab, vxp) f9c386
	if [ -n "${PKG_PATCHES_EXTRA_URL}" ]; then
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
		apply_patches ${PKG_PATCHES_EXTRA_URL} ${PKG_SUBDIR};
Lucio Andrés Illanes Albornoz (arab, vxp) f9c386
		if [ -n "${PKG_PATCHES_EXTRA_MANIFEST}" ]; then
Lucio Andrés Illanes Albornoz (arab, vxp) f9c386
			compare_hash_manifest ${PKG_PATCHES_EXTRA_MANIFEST};
Lucio Andrés Illanes Albornoz (arab, vxp) f9c386
		fi;
Lucio Andrés Illanes Albornoz (arab, vxp) 680d83
	fi;
Lucio Andrés Illanes Albornoz (arab, vxp) 392fef
	[ -x ${PKG_SUBDIR}/configure ] &&			\
Lucio Andrés Illanes Albornoz (arab, vxp) 392fef
		cp portage/config.cache ${PKG_BUILD_DIR}/;
Lucio Andrés Illanes Albornoz (arab, vxp) 2dd87f
	if [ ${PKG_LIBTOOL_MIDIPIX:-0} -eq 1 ]; then
Lucio Andrés Illanes Albornoz (arab, vxp) ce7607
		cp portage/libtool.midipix ${PKG_SUBDIR}/;
Lucio Andrés Illanes Albornoz (arab, vxp) 2dd87f
		sed -i.orig -e "/^libdir=/s/libdir='/libdir='\$PKG_PREFIX\//"\
Lucio Andrés Illanes Albornoz (arab, vxp) 2dd87f
			${PKG_SUBDIR}/libtool.midipix;
Lucio Andrés Illanes Albornoz (arab, vxp) 840cbd
		if [ ${PKG_LIBTOOL_MIDIPIX_FIX:-0} -eq 1 ]; then
Lucio Andrés Illanes Albornoz (arab, vxp) 840cbd
			sed -i.orig.orig									\
Lucio Andrés Illanes Albornoz (arab, vxp) 840cbd
				-e '/^\s\+test \"\$inst_prefix_dir\" = \"\$destdir\" && \\$/{s/^/#/;n;s/^/#/}'	\
Lucio Andrés Illanes Albornoz (arab, vxp) 840cbd
				${PKG_SUBDIR}/libtool.midipix;
Lucio Andrés Illanes Albornoz (arab, vxp) 840cbd
		fi;
Lucio Andrés Illanes Albornoz (arab, vxp) 2dd87f
	fi;
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
	set_build_script_done patch -configure;
lalbornoz 340f4c
fi;
Lucio Andrés Illanes Albornoz (arab, vxp) 392fef
cd ${PKG_BUILD_DIR};
Lucio Andrés Illanes Albornoz (arab, vxp) 392fef
if [ -x ../${PKG_SUBDIR}/configure ]\
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
&& ! is_build_script_done configure; then
Lucio Andrés Illanes Albornoz (arab, vxp) 392fef
	if test_cmd pkg_${PKG_NAME}_configure_pre; then
Lucio Andrés Illanes Albornoz (arab, vxp) 392fef
		pkg_${PKG_NAME}_configure_pre;
Lucio Andrés Illanes Albornoz (arab, vxp) 392fef
	fi;
Lucio Andrés Illanes Albornoz (arab, vxp) 392fef
	AR="${PKG_AR_CONFIGURE}" CC="${PKG_CC_CONFIGURE}"\
Lucio Andrés Illanes Albornoz (arab, vxp) 392fef
	CFLAGS="${PKG_CFLAGS_CONFIGURE}${PKG_CFLAGS_CONFIGURE_EXTRA:+ ${PKG_CFLAGS_CONFIGURE_EXTRA}}"\
Lucio Andrés Illanes Albornoz (arab, vxp) 392fef
	LDFLAGS="${PKG_LDFLAGS_CONFIGURE}${PKG_LDFLAGS_CONFIGURE_EXTRA:+ ${PKG_LDFLAGS_CONFIGURE_EXTRA}}"\
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
	../${PKG_SUBDIR}/configure				\
Lucio Andrés Illanes Albornoz (arab, vxp) 392fef
		${PKG_CONFIGURE_ARGS} ${PKG_CONFIGURE_ARGS_EXTRA};
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
	set_build_script_done configure clean -build;
lalbornoz 340f4c
else
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
	set_build_script_done clean;
lalbornoz 340f4c
fi;
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
if [ ${PKG_NO_CLEAN:-0} -eq 0 ]\
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
&& ! is_build_script_done clean; then
Lucio Andrés Illanes Albornoz (arab, vxp) 392fef
	make clean;
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
	set_build_script_done clean -build;
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
fi;
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
if ! is_build_script_done build; then
Lucio Andrés Illanes Albornoz (arab, vxp) 392fef
	run_cmd_unsplit make					\
Lucio Andrés Illanes Albornoz (arab, vxp) 392fef
		${PKG_MAKEFLAGS_BUILD}				\
Lucio Andrés Illanes Albornoz (arab, vxp) 392fef
		${PKG_MAKEFLAGS_BUILD_EXTRA}			\
Lucio Andrés Illanes Albornoz (arab, vxp) 392fef
		"${PKG_AR_BUILD:+AR=${PKG_AR_BUILD}}"		\
Lucio Andrés Illanes Albornoz (arab, vxp) 392fef
		"${PKG_CC_BUILD:+CC=${PKG_CC_BUILD}}"		\
Lucio Andrés Illanes Albornoz (arab, vxp) 392fef
		"${PKG_CFLAGS_BUILD:+CFLAGS=${PKG_CFLAGS_BUILD}}"\
Lucio Andrés Illanes Albornoz (arab, vxp) 392fef
		"${PKG_CFLAGS_BUILD_EXTRA:+CFLAGS+=${PKG_CFLAGS_BUILD_EXTRA}}"\
Lucio Andrés Illanes Albornoz (arab, vxp) 392fef
		"${PKG_LDFLAGS_BUILD:+LDFLAGS=${PKG_LDFLAGS_BUILD}}"\
Lucio Andrés Illanes Albornoz (arab, vxp) 392fef
		"${PKG_LDFLAGS_BUILD_EXTRA:+LDFLAGS+=${PKG_LDFLAGS_BUILD_EXTRA}}";
Lucio Andrés Illanes Albornoz (arab, vxp) 392fef
	set_build_script_done build -install;
lalbornoz 340f4c
fi;
Lucio Andrés Illanes Albornoz (arab, vxp) 392fef
if ! is_build_script_done install; then
Lucio Andrés Illanes Albornoz (arab, vxp) 392fef
	if test_cmd pkg_${PKG_NAME}_install; then
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
		pkg_${PKG_NAME}_install;
Lucio Andrés Illanes Albornoz (arab, vxp) f9c386
	else
Lucio Andrés Illanes Albornoz (arab, vxp) 392fef
		run_cmd_unsplit make				\
Lucio Andrés Illanes Albornoz (arab, vxp) 392fef
			${PKG_MAKEFLAGS_INSTALL}		\
Lucio Andrés Illanes Albornoz (arab, vxp) 392fef
			${PKG_MAKEFLAGS_INSTALL_EXTRA}		\
Lucio Andrés Illanes Albornoz (arab, vxp) 392fef
			"${PKG_AR_INSTALL:+AR=${PKG_AR_INSTALL}}"\
Lucio Andrés Illanes Albornoz (arab, vxp) 392fef
			"${PKG_CC_INSTALL:+CC=${PKG_CC_INSTALL}}"\
Lucio Andrés Illanes Albornoz (arab, vxp) 392fef
			"${PKG_CC_INSTALL:+CC=${PKG_CC_INSTALL}}"\
Lucio Andrés Illanes Albornoz (arab, vxp) 392fef
			"${PKG_CFLAGS_INSTALL:+CFLAGS=${PKG_CFLAGS_INSTALL}}"\
Lucio Andrés Illanes Albornoz (arab, vxp) 392fef
			"${PKG_CFLAGS_INSTALL_EXTRA:+CFLAGS+=${PKG_CFLAGS_INSTALL_EXTRA}}"\
Lucio Andrés Illanes Albornoz (arab, vxp) 392fef
			"${PKG_LDFLAGS_INSTALL:+LDFLAGS=${PKG_LDFLAGS_INSTALL}}"\
Lucio Andrés Illanes Albornoz (arab, vxp) 392fef
			"${PKG_LDFLAGS_INSTALL_EXTRA:+LDFLAGS+=${PKG_LDFLAGS_INSTALL_EXTRA}}"\
Lucio Andrés Illanes Albornoz (arab, vxp) 392fef
			"${PKG_RANLIB_INSTALL:+RANLIB=${PKG_RANLIB_INSTALL}}"\
Lucio Andrés Illanes Albornoz (arab, vxp) 392fef
			${PKG_INSTALL_TARGET:=install};
Lucio Andrés Illanes Albornoz (arab, vxp) 392fef
		if [ -n "${PKG_PREFIX_EXTRA}" ]; then
Lucio Andrés Illanes Albornoz (arab, vxp) 392fef
			run_cmd_unsplit make			\
Lucio Andrés Illanes Albornoz (arab, vxp) 392fef
				${PKG_MAKEFLAGS_INSTALL}	\
Lucio Andrés Illanes Albornoz (arab, vxp) 392fef
				${PKG_MAKEFLAGS_INSTALL_EXTRA}	\
Lucio Andrés Illanes Albornoz (arab, vxp) 392fef
				"${PKG_AR_INSTALL:+AR=${PKG_AR_INSTALL}}"\
Lucio Andrés Illanes Albornoz (arab, vxp) 392fef
				"${PKG_CC_INSTALL:+CC=${PKG_CC_INSTALL}}"\
Lucio Andrés Illanes Albornoz (arab, vxp) 392fef
				"${PKG_CC_INSTALL:+CC=${PKG_CC_INSTALL}}"\
Lucio Andrés Illanes Albornoz (arab, vxp) 392fef
				"${PKG_CFLAGS_INSTALL:+CFLAGS=${PKG_CFLAGS_INSTALL}}"\
Lucio Andrés Illanes Albornoz (arab, vxp) 392fef
				"${PKG_CFLAGS_INSTALL_EXTRA:+CFLAGS+=${PKG_CFLAGS_INSTALL_EXTRA}}"\
Lucio Andrés Illanes Albornoz (arab, vxp) 392fef
				"${PKG_LDFLAGS_INSTALL:+LDFLAGS=${PKG_LDFLAGS_INSTALL}}"\
Lucio Andrés Illanes Albornoz (arab, vxp) 392fef
				"${PKG_LDFLAGS_INSTALL_EXTRA:+LDFLAGS+=${PKG_LDFLAGS_INSTALL_EXTRA}}"\
Lucio Andrés Illanes Albornoz (arab, vxp) 392fef
				"${PKG_RANLIB_INSTALL:+RANLIB=${PKG_RANLIB_INSTALL}}"\
Lucio Andrés Illanes Albornoz (arab, vxp) 392fef
				${PKG_PREFIX_EXTRA}		\
Lucio Andrés Illanes Albornoz (arab, vxp) 392fef
				${PKG_INSTALL_TARGET:=install};
Lucio Andrés Illanes Albornoz (arab, vxp) 392fef
		fi;
Lucio Andrés Illanes Albornoz (arab, vxp) 392fef
		if test_cmd pkg_${PKG_NAME}_install_post; then
Lucio Andrés Illanes Albornoz (arab, vxp) 392fef
			pkg_${PKG_NAME}_install_post;
Lucio Andrés Illanes Albornoz (arab, vxp) 392fef
		fi;
Lucio Andrés Illanes Albornoz (arab, vxp) f9c386
	fi;
Lucio Andrés Illanes Albornoz (arab, vxp) 392fef
	set_build_script_done install -finish;
lalbornoz 340f4c
fi;
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
set_build_script_done finish;
lalbornoz 340f4c
lalbornoz 340f4c
# vim:filetype=sh