Blob Blame History Raw
if is_build_script_done finished; then
        exit 212;
elif [ "x${3}" = "xlibz" ]; then
	_pkg_url="https://sortix.org/libz/release/libz-${LIBZ_VERSION}.tar.gz";
	_pkg_fname="${_pkg_url##*/}";
elif [ "x${3}" = "xgzip" ]; then
	_pkg_url="ftp://ftp.gnu.org/gnu/gzip/gzip-${GZIP_VERSION}.tar.gz";
	_pkg_fname="${_pkg_url##*/}";
fi;
fetch "${_pkg_url}";
if ! is_build_script_done extracted; then
	rm_if_exists "${_pkg_fname%%.tar*}";
	tar -axf "${_pkg_fname}";
	set_build_script_done extracted -patched;
fi;
if ! is_build_script_done configured; then
	set_build_dir "${_pkg_fname%%-*}" "${TARGET}";
	rm_if_exists -c -m "${_build_dir}";
	cp -a "../portage/config.cache" .;
	CFLAGS="${CFLAGS_PACKAGES}"		\
	"../${LIBZ_VERSION}/configure"		\
		--host="${HOST_NATIVE}"		\
		--prefix=""			\
		--target="${TARGET}";
	set_build_script_done configured -built;
fi;
if ! is_build_script_done built; then
	if [ "x${3}" = "xlibz" ]; then
		make -j18;
	elif [ "x${3}" = "xgzip" ]; then
		make clean;
		make CFLAGS="-g3 -O0 -I${PREFIX_NATIVE}/include" LDFLAGS="--sysroot=${PREFIX_NATIVE}";
	fi;
	set_build_script_done built -installed;
fi;
if ! is_build_script_done installed; then
	if [ "x${3}" = "xlibz" ]; then
		make -j18 DESTDIR="${PREFIX_NATIVE}" install;
	elif [ "x${3}" = "xgzip" ]; then
		cp -a gunzip gzip zcat "${PREFIX_NATIVE}/bin";
	fi;
	set_build_script_done installed finished;
fi;

# vim:filetype=sh