parse_with_pkg_name ${2} gmp mpfr mpc libelf binutils;
if is_build_script_done finished; then
exit 212;
else
fetch ${_pkg_url} ${_pkg_sha256sum};
set_build_dir ${_pkg_subdir} native;
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;
if [ ${_pkg_no_libtool_midipix:-0} -eq 0 ]; then
cp portage/libtool.midipix ${_pkg_subdir}/;
fi;
set_build_script_done patched -configured;
fi;
if ! is_build_script_done configured; then
rm_if_exists -m -c ${_build_dir};
../${_pkg_subdir}/configure \
${_pkg_configure_extra_args} \
--host=${HOST_NATIVE} \
--prefix=${_pkg_prefix:-/} \
--target=${TARGET};
set_build_script_done configured -built;
else
cd ${_build_dir};
fi;
if ! is_build_script_done built; then
make;
set_build_script_done configured built -installed1;
fi;
if ! is_build_script_done installed1; then
make DESTDIR=${PREFIX_NATIVE} install;
set_build_script_done configured installed1 -installed2 -finished;
fi;
if [ -n "${_pkg_prefix_extra}" ]; then
if ! is_build_script_done installed2; then
make DESTDIR=${_pkg_prefix_extra} install;
set_build_script_done configured installed2 -finished;
fi;
elif [ "x${_pkg_name}" = "xlibelf" ]; then
if ! is_build_script_done installed2; then
rm -f lib/libelf.def;
echo EXPORTS > lib/libelf.def;
perk -e lib/libelf.so >> lib/libelf.def;
${HOST_NATIVE}-dlltool \
--output-lib lib/libelf.lib.a \
--dllname libelf.so \
--input-def lib/libelf.def;
cp lib/libelf.lib.a ${PREFIX}/lib;
set_build_script_done configured installed2 -finished;
fi;
fi;
set_build_script_done finished;
# vim:filetype=sh