lalbornoz 340f4c
libelf_install_post() {
lalbornoz 340f4c
	echo EXPORTS >| lib/libelf.def || return 1;
lalbornoz 340f4c
	perk -e lib/libelf.so >> lib/libelf.def || return 2;
lalbornoz 340f4c
	"${HOST_NATIVE}-dlltool"			\
lalbornoz 340f4c
		--output-lib lib/libelf.lib.a	\
lalbornoz 340f4c
		--dllname libelf.so		\
lalbornoz 340f4c
		--input-def lib/libelf.def || return 3;
lalbornoz 340f4c
	cp lib/libelf.lib.a "${PREFIX}/lib" || return 4;
lalbornoz 340f4c
};
lalbornoz 340f4c
lalbornoz 340f4c
parse_with_pkg_name "${2}" 										\
lalbornoz 340f4c
	"https://gmplib.org/download/gmp/gmp-${GMP_VERSION}.tar.bz2"					\
lalbornoz 340f4c
		"_configure_extra_args=--disable-assembly:_prefix_extra=${PREFIX_TARGET}"		\
lalbornoz 340f4c
	"ftp://ftp.gnu.org/gnu/mpfr/mpfr-${MPFR_VERSION}.tar.bz2"					\
lalbornoz 340f4c
		"_configure_extra_args=--with-gmp=${PREFIX_NATIVE}:_prefix_extra=${PREFIX_TARGET}"	\
lalbornoz 340f4c
	"ftp://ftp.gnu.org/gnu/mpc/mpc-${MPC_VERSION}.tar.gz"						\
lalbornoz 340f4c
		"_configure_extra_args=--with-gmp=${PREFIX_NATIVE},--with-mpfr=${PREFIX_NATIVE}:_prefix_extra=${PREFIX_TARGET}"\
lalbornoz 340f4c
	"http://www.mr511.de/software/libelf-${LIBELF_VERSION}.tar.gz"					\
lalbornoz 340f4c
		"_no_libtool_midipix=1:_prefix=${PREFIX_NATIVE}:CC=${HOST_NATIVE}-gcc:DESTDIR="		\
lalbornoz 340f4c
	"ftp://sourceware.org/pub/binutils/snapshots/binutils-${BINUTILS_VERSION}.tar.bz2"		\
lalbornoz 340f4c
		"_configure_extra_args=--with-libelf=${PREFIX_NATIVE},--with-gmp=${PREFIX_NATIVE},--with-mpc=${PREFIX_NATIVE},--with-mpfr=${PREFIX_NATIVE},--with-sysroot=/";
lalbornoz 340f4c
lalbornoz 340f4c
if is_build_script_done finished; then
lalbornoz 340f4c
        exit 212;
lalbornoz 340f4c
else
lalbornoz 340f4c
	fetch "${_pkg_url}";
lalbornoz 340f4c
fi;
lalbornoz 340f4c
if ! is_build_script_done extracted; then
lalbornoz 340f4c
	rm_if_exists "${_pkg_subdir}";
lalbornoz 340f4c
	tar -axf "${_pkg_fname}";
lalbornoz 340f4c
	set_build_script_done extracted -patched;
lalbornoz 340f4c
fi;
lalbornoz 340f4c
if ! is_build_script_done patched; then
lalbornoz 340f4c
	patch -d "${_pkg_subdir}" -p1		\
lalbornoz 340f4c
		< "portage/${_pkg_subdir}.midipix.patch";
lalbornoz 340f4c
	if [ ${_no_libtool_midipix:-0} -eq 0 ]; then
lalbornoz 340f4c
		cp portage/libtool.midipix "${_pkg_subdir}/";
lalbornoz 340f4c
	fi;
lalbornoz 340f4c
	set_build_script_done patched -configured;
lalbornoz 340f4c
fi;
lalbornoz 340f4c
if ! is_build_script_done configured; then
lalbornoz 340f4c
	rm_if_exists -c -m "${_pkg_subdir}-build-native${3:+-${3}}";
lalbornoz 340f4c
	run_configure_with_extra_args		\
lalbornoz 340f4c
	"../${_pkg_subdir}/configure"		\
lalbornoz 340f4c
		"${_configure_extra_args}"	\
lalbornoz 340f4c
		--host="${HOST_NATIVE}"		\
lalbornoz 340f4c
		--prefix=${_prefix:-/}		\
lalbornoz 340f4c
		--target="${TARGET}";
lalbornoz 340f4c
	set_build_script_done configured -built;
lalbornoz 340f4c
else
lalbornoz 340f4c
	cd "${_pkg_subdir}-build-native${3:+-${3}}";
lalbornoz 340f4c
fi;
lalbornoz 340f4c
if ! is_build_script_done built; then
lalbornoz 340f4c
	make;
lalbornoz 340f4c
	set_build_script_done configured built -installed1;
lalbornoz 340f4c
fi;
lalbornoz 340f4c
if ! is_build_script_done installed1; then
lalbornoz 340f4c
	make DESTDIR="${PREFIX_NATIVE}" install;
lalbornoz 340f4c
	set_build_script_done configured installed1 -installed2 -finished;
lalbornoz 340f4c
fi;
lalbornoz 340f4c
if [ -n "${_prefix_extra}" ]; then
lalbornoz 340f4c
	if ! is_build_script_done installed2; then
lalbornoz 340f4c
		make DESTDIR="${_prefix_extra}" install;
lalbornoz 340f4c
		set_build_script_done configured installed2 -finished;
lalbornoz 340f4c
	fi;
lalbornoz 340f4c
fi;
lalbornoz 340f4c
set_build_script_done finished;
lalbornoz 340f4c
lalbornoz 340f4c
# vim:filetype=sh