Blob Blame History Raw
export CFLAGS="${CFLAGS_PACKAGES}";
parse_with_pkg_name "${2}"								\
	"https://ftp.gnu.org/gnu/coreutils/coreutils-${PKG_COREUTILS_VERSION}.tar.xz" ""	\
	"https://ftp.gnu.org/gnu/diffutils/diffutils-${PKG_DIFFUTILS_VERSION}.tar.xz" ""	\
	"http://alpha.gnu.org/gnu/findutils/findutils-${PKG_FINDUTILS_VERSION}.tar.gz"		\
		"CFLAGS=${CFLAGS:+${CFLAGS} }-Dendpwent=setpwent"				\
	"https://ftp.gnu.org/gnu/patch/patch-${PKG_PATCH_VERSION}.tar.gz" ""			\
	"https://ftp.gnu.org/gnu/gawk/gawk-${PKG_GAWK_VERSION}.tar.xz" ""			\
	"https://ftp.gnu.org/gnu/bash/bash-${PKG_BASH_VERSION}.tar.gz"				\
		"_configure_extra_args=--without-bash-malloc"					\
	"https://ftp.gnu.org/gnu/make/make-${PKG_MAKE_VERSION}.tar.bz2" ""			\
	"https://ftp.gnu.org/gnu/grep/grep-${PKG_GREP_VERSION}.tar.xz" ""			\
	"https://ftp.gnu.org/gnu/sed/sed-${PKG_SED_VERSION}.tar.bz2" ""				\
	"ftp://sourceware.org/pub/binutils/snapshots/binutils-${PKG_BINUTILS_VERSION}.tar.bz2" "";

if is_build_script_done finished; then
        exit 212;
else
	fetch "${_pkg_url}" "${_pkg_sha256sum}";
	if [ "${_pkg_name}" = "binutils" ]\
	&& [ "${3}" = "host" ]; then
		_configure_args="--disable-werror,--prefix=${PREFIX},--with-sysroot=${PREFIX_TARGET}";
		_no_config_cache=${_no_prefix:=1}; _target="${TARGET}";
	else
		_configure_args="-C,--host=${HOST_NATIVE},--prefix=${_configure_extra_args:+,${_configure_extra_args}}";
	fi;
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
	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 -c -m "${_pkg_subdir}-build-${_target:-native}";
	[ ${_no_config_cache:-0} -eq 0 ] &&\
		cp -a "../portage/config.cache" .;
	run_configure_with_extra_args			\
		"../${_pkg_subdir}/configure"		\
		"${_configure_args}"			\
		--target="${TARGET}";
	set_build_script_done configured -built;
else
	cd "${_pkg_subdir}-build-${_target:-native}";
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_prefix:-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