Blob Blame History Raw
parse_with_pkg_name ${2}				\
	coreutils diffutils findutils patch		\
	gawk bash make grep sed binutils;
if is_build_script_done finished; then
        exit 212;
else
	fetch ${_pkg_url} ${_pkg_sha256sum};
	if [ "x${_pkg_name}" = "xbinutils" ]\
	&& [ "x${3}" = "xhost" ]; then
		_no_config_cache=1; _no_destdir=1;
		_configure_args="--disable-werror --prefix=${PREFIX} --with-sysroot=${PREFIX_TARGET}";
		set_build_dir ${_pkg_subdir} cross;
	else
		_configure_args="-C --host=${HOST_NATIVE} --prefix=";
		set_build_dir ${_pkg_subdir} native;
	fi;
	_configure_args="${_configure_args}${_pkg_configure_extra_args:+ ${_pkg_configure_extra_args}}";
fi;
if ! is_build_script_done extracted; then
	rm_if_exists ${_pkg_subdir};
	tar -axf ${_pkg_fname};
	set_build_script_done extracted -patched;
fi;
if ! is_build_script_done patched; then
	if [ -n "${_pkg_patches_extra}" ]; then
		(rm_if_exists -m -c ${_pkg_subdir}-patches-extra;
		wget -c -nd -np -r -R \*.htm\* ${_pkg_patches_extra}
		for _patch_fname in			\
				$(find . -type f -not -iname \*.sig | sort); do
			patch -d ../${_pkg_subdir} -p0	\
				< ${_patch_fname};
		done); wait;
	fi;
	patch -d ${_pkg_subdir} -p1			\
		< portage/${_pkg_subdir}.midipix.patch;
	set_build_script_done patched -configured;
fi;
if ! is_build_script_done configured; then
	rm_if_exists -m -c ${_build_dir};
	[ ${_no_config_cache:-0} -eq 0 ] &&\
		cp ../portage/config.cache .;
	../${_pkg_subdir}/configure			\
		${_configure_args} --target=${TARGET};
	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 -installed;
fi;
if ! is_build_script_done installed; then
	if [ ${_no_destdir:-0} -eq 0 ]; then
		make ${MAKEFLAGS} DESTDIR=${PREFIX_NATIVE} install;
	else
		make ${MAKEFLAGS} install;
	fi;
	set_build_script_done installed finished;
fi;

# vim:filetype=sh