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