parse_with_pkg_name ${2} libz gzip;
if is_build_script_done finished; then
exit 212;
else
fetch ${_pkg_url} ${_pkg_sha256sum};
fi;
if ! is_build_script_done extracted; then
rm_if_exists ${_pkg_fname%%.tar*};
tar -axf ${_pkg_fname};
set_build_script_done extracted -configured;
fi;
if ! is_build_script_done configured; then
set_build_dir ${_pkg_fname%%-*} native;
rm_if_exists -c -m ${_build_dir};
cp ../portage/config.cache .;
../${_pkg_subdir}/configure \
--host=${HOST_NATIVE} \
--prefix= \
--target=${TARGET};
set_build_script_done configured -built;
else
cd ${_build_dir};
fi;
if ! is_build_script_done built; then
if [ "x${2}" = "xlibz" ]; then
make -j18;
elif [ "x${2}" = "xgzip" ]; then
make clean;
make;
fi;
set_build_script_done built -installed;
fi;
if ! is_build_script_done installed; then
if [ "x${2}" = "xlibz" ]; then
make -j18 DESTDIR=${PREFIX_NATIVE} install;
elif [ "x${2}" = "xgzip" ]; then
cp gunzip gzip zcat ${PREFIX_NATIVE}/bin;
fi;
set_build_script_done installed finished;
fi;
# vim:filetype=sh