Lucio Andrés Illanes Albornoz (arab, vxp) d30b8f
parse_with_pkg_name ${2} libz gzip;
lalbornoz 340f4c
if is_build_script_done finished; then
lalbornoz 340f4c
        exit 212;
Lucio Andrés Illanes Albornoz (arab, vxp) d30b8f
else
Lucio Andrés Illanes Albornoz (arab, vxp) 96b309
	fetch ${PKG_URL} ${PKG_SHA256SUM};
lalbornoz 340f4c
fi;
lalbornoz 340f4c
if ! is_build_script_done extracted; then
Lucio Andrés Illanes Albornoz (arab, vxp) 96b309
	rm_if_exists ${PKG_FNAME%%.tar*};
Lucio Andrés Illanes Albornoz (arab, vxp) 96b309
	tar -axf ${PKG_FNAME};
Lucio Andrés Illanes Albornoz (arab, vxp) d30b8f
	set_build_script_done extracted -configured;
lalbornoz 340f4c
fi;
lalbornoz 340f4c
if ! is_build_script_done configured; then
Lucio Andrés Illanes Albornoz (arab, vxp) 96b309
	set_build_dir ${PKG_FNAME%%-*} native;
Lucio Andrés Illanes Albornoz (arab, vxp) 96b309
	rm_if_exists -c -m ${BUILD_DIR};
Lucio Andrés Illanes Albornoz (arab, vxp) d30b8f
	cp ../portage/config.cache .;
Lucio Andrés Illanes Albornoz (arab, vxp) 96b309
	../${PKG_SUBDIR}/configure		\
Lucio Andrés Illanes Albornoz (arab, vxp) 6e940c
		--host=${HOST_NATIVE}		\
Lucio Andrés Illanes Albornoz (arab, vxp) 6e940c
		--prefix=			\
Lucio Andrés Illanes Albornoz (arab, vxp) 6e940c
		--target=${TARGET};
lalbornoz 340f4c
	set_build_script_done configured -built;
Lucio Andrés Illanes Albornoz (arab, vxp) c49754
else
Lucio Andrés Illanes Albornoz (arab, vxp) 96b309
	cd ${BUILD_DIR};
lalbornoz 340f4c
fi;
lalbornoz 340f4c
if ! is_build_script_done built; then
Lucio Andrés Illanes Albornoz (arab, vxp) d30b8f
	if [ "x${2}" = "xlibz" ]; then
lalbornoz 340f4c
		make -j18;
Lucio Andrés Illanes Albornoz (arab, vxp) d30b8f
	elif [ "x${2}" = "xgzip" ]; then
lalbornoz 340f4c
		make clean;
Lucio Andrés Illanes Albornoz (arab, vxp) d30b8f
		make;
lalbornoz 340f4c
	fi;
lalbornoz 340f4c
	set_build_script_done built -installed;
lalbornoz 340f4c
fi;
lalbornoz 340f4c
if ! is_build_script_done installed; then
Lucio Andrés Illanes Albornoz (arab, vxp) d30b8f
	if [ "x${2}" = "xlibz" ]; then
Lucio Andrés Illanes Albornoz (arab, vxp) 6e940c
		make -j18 DESTDIR=${PREFIX_NATIVE} install;
Lucio Andrés Illanes Albornoz (arab, vxp) d30b8f
	elif [ "x${2}" = "xgzip" ]; then
Lucio Andrés Illanes Albornoz (arab, vxp) d30b8f
		cp gunzip gzip zcat ${PREFIX_NATIVE}/bin;
lalbornoz 340f4c
	fi;
lalbornoz 340f4c
	set_build_script_done installed finished;
lalbornoz 340f4c
fi;
lalbornoz 340f4c
lalbornoz 340f4c
# vim:filetype=sh