Blob Blame History Raw
# Order for build level 2 (runtime:) psxtypes pemagine dalist ntapi psxscl ntcon ntctty

parse_with_pkg_name ${2}				\
	bash binutils binutils_host coreutils dalist	\
	diffutils findutils gawk gmp grep libelf make	\
	mpc mpfr ntapi ntcon ntctty patch pemagine	\
	psxscl psxtypes sed;
if is_build_script_done finished; then
        exit 212;
else
	case "${SCRIPT_FNAME%[0-9][0-9]*}" in
	1)	_configure_args="--host=${HOST_NATIVE} --prefix=${PKG_PREFIX:-/} --target=${TARGET}";
		PKG_NO_CONFIG_CACHE=1; ;;
	2)
		_configure_args="--prefix=${PREFIX_LVL} --host=${HOST_NATIVE}";
		PKG_BUILD_TYPE=cross; PKG_URL_TYPE=git;
		PKG_NO_CONFIG_CACHE=${PKG_NO_DESTDIR:=${PKG_NO_EXTRACT:=${PKG_NO_PATCH:=1}}};
		export CFLAGS_PATH=-I${PREFIX_LVL}/include;
		export LDFLAGS_PATH=-L${PREFIX_LVL}/lib; ;;
	*)	_configure_args=${PKG_CONFIGURE_ARGS:--C --host=${HOST_NATIVE} --prefix= --target=${TARGET}}; ;;
	esac;
	if [ "x${PKG_URL_TYPE:-wget}" = "xwget" ]; then
		fetch ${PKG_URL} ${PKG_SHA256SUM};
	else
		fetch_git ${PKG_SUBDIR} ${PKG_URL};
	fi;
	set_build_dir ${PKG_SUBDIR} ${PKG_BUILD_TYPE:-native};
fi;
if command -v pkg_${PKG_NAME}_finish >/dev/null; then
	pkg_${PKG_NAME}_finish; exit 0;
elif [ ${PKG_NO_EXTRACT:-0} -eq 0 ] &&\
! is_build_script_done extracted; then
	rm_if_exists ${PKG_SUBDIR};
	tar -axf ${PKG_FNAME};
	set_build_script_done extracted -patched;
fi;
if [ ${PKG_NO_PATCH:-0} -eq 0 ] &&\
! is_build_script_done patched; then
	if [ -n "${PKG_PATCHES_EXTRA_URL}" ]; then
		apply_patches ${PKG_PATCHES_EXTRA_URL} ${PKG_SUBDIR}-patches-extra;
		if [ -n "${PKG_PATCHES_EXTRA_MANIFEST}" ]; then
			compare_hash_manifest ${PKG_PATCHES_EXTRA_MANIFEST};
		fi;
	fi;
	patch -d ${PKG_SUBDIR} -p1			\
		< portage/${PKG_SUBDIR}.midipix.patch;
	[ ${PKG_NO_CONFIG_CACHE:-0} -eq 0 ] &&\
		cp portage/config.cache ${PKG_SUBDIR}/;
	[ ${PKG_NO_LIBTOOL_MIDIPIX:-0} -eq 0 ] &&	\
		cp portage/libtool.midipix ${PKG_SUBDIR}/;
	set_build_script_done patched -configured;
fi;
if ! is_build_script_done configured; then
	rm_if_exists -m -c ${BUILD_DIR};
	../${PKG_SUBDIR}/configure			\
		${_configure_args}			\
		${PKG_CONFIGURE_EXTRA_ARGS};
	set_build_script_done configured -built;
else
	cd ${BUILD_DIR};
fi;
if ! is_build_script_done built; then
	make ${MAKEFLAGS};
	set_build_script_done built -installed1;
fi;
if ! is_build_script_done installed1; then
	if [ ${PKG_NO_DESTDIR:-0} -eq 0 ]; then
		make ${MAKEFLAGS} DESTDIR=${PREFIX_LVL} install;
	else
		make ${MAKEFLAGS} install;
	fi;
	set_build_script_done installed1 -installed2 -finished;
fi;
if ! is_build_script_done installed2; then
	[ -n "${PKG_PREFIX_EXTRA}" ] &&\
		make DESTDIR=${PKG_PREFIX_EXTRA} install;
	set_build_script_done installed2 -installed3 -finished;
fi;
if ! is_build_script_done installed3; then
	command -v pkg_${PKG_NAME}_install_post		\
		>/dev/null && pkg_${PKG_NAME}_install_post;
	set_build_script_done installed3 -finished;
fi;
set_build_script_done finished;

# vim:filetype=sh