Lucio Andrés Illanes Albornoz (arab, vxp) c49754
parse_with_pkg_name ${2} gmp mpfr mpc libelf binutils;
lalbornoz 340f4c
if is_build_script_done finished; then
lalbornoz 340f4c
        exit 212;
lalbornoz 340f4c
else
Lucio Andrés Illanes Albornoz (arab, vxp) 96b309
	fetch ${PKG_URL} ${PKG_SHA256SUM};
Lucio Andrés Illanes Albornoz (arab, vxp) 96b309
	set_build_dir ${PKG_SUBDIR} native;
lalbornoz 340f4c
fi;
lalbornoz 340f4c
if ! is_build_script_done extracted; 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};
lalbornoz 340f4c
	set_build_script_done extracted -patched;
lalbornoz 340f4c
fi;
lalbornoz 340f4c
if ! is_build_script_done patched; then
Lucio Andrés Illanes Albornoz (arab, vxp) 96b309
	patch -d ${PKG_SUBDIR} -p1		\
Lucio Andrés Illanes Albornoz (arab, vxp) 96b309
		< portage/${PKG_SUBDIR}.midipix.patch;
Lucio Andrés Illanes Albornoz (arab, vxp) 96b309
	if [ ${PKG_NO_LIBTOOL_MIDIPIX:-0} -eq 0 ]; then
Lucio Andrés Illanes Albornoz (arab, vxp) 96b309
		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
Lucio Andrés Illanes Albornoz (arab, vxp) 96b309
	rm_if_exists -m -c ${BUILD_DIR};
Lucio Andrés Illanes Albornoz (arab, vxp) 96b309
	../${PKG_SUBDIR}/configure		\
Lucio Andrés Illanes Albornoz (arab, vxp) 96b309
		${PKG_CONFIGURE_EXTRA_ARGS}	\
Lucio Andrés Illanes Albornoz (arab, vxp) 6e940c
		--host=${HOST_NATIVE}		\
Lucio Andrés Illanes Albornoz (arab, vxp) 96b309
		--prefix=${PKG_PREFIX:-/}	\
Lucio Andrés Illanes Albornoz (arab, vxp) 6e940c
		--target=${TARGET};
lalbornoz 340f4c
	set_build_script_done configured -built;
lalbornoz 340f4c
else
Lucio Andrés Illanes Albornoz (arab, vxp) 96b309
	cd ${BUILD_DIR};
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
Lucio Andrés Illanes Albornoz (arab, vxp) 6e940c
	make DESTDIR=${PREFIX_NATIVE} install;
lalbornoz 340f4c
	set_build_script_done configured installed1 -installed2 -finished;
lalbornoz 340f4c
fi;
Lucio Andrés Illanes Albornoz (arab, vxp) 96b309
if [ -n "${PKG_PREFIX_EXTRA}" ]; then
Lucio Andrés Illanes Albornoz (arab, vxp) c49754
	if ! is_build_script_done installed2; then
Lucio Andrés Illanes Albornoz (arab, vxp) 96b309
		make DESTDIR=${PKG_PREFIX_EXTRA} install;
Lucio Andrés Illanes Albornoz (arab, vxp) c49754
		set_build_script_done configured installed2 -finished;
Lucio Andrés Illanes Albornoz (arab, vxp) c49754
	fi;
Lucio Andrés Illanes Albornoz (arab, vxp) 96b309
elif [ "x${PKG_NAME}" = "xlibelf" ]; then
lalbornoz 340f4c
	if ! is_build_script_done installed2; then
Lucio Andrés Illanes Albornoz (arab, vxp) c49754
		rm -f lib/libelf.def;
Lucio Andrés Illanes Albornoz (arab, vxp) c49754
		echo EXPORTS > lib/libelf.def;
Lucio Andrés Illanes Albornoz (arab, vxp) c49754
		perk -e lib/libelf.so >> lib/libelf.def;
Lucio Andrés Illanes Albornoz (arab, vxp) c49754
		${HOST_NATIVE}-dlltool			\
Lucio Andrés Illanes Albornoz (arab, vxp) c49754
			--output-lib lib/libelf.lib.a	\
Lucio Andrés Illanes Albornoz (arab, vxp) c49754
			--dllname libelf.so		\
Lucio Andrés Illanes Albornoz (arab, vxp) c49754
			--input-def lib/libelf.def;
Lucio Andrés Illanes Albornoz (arab, vxp) c49754
		cp lib/libelf.lib.a ${PREFIX}/lib;
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