summaryrefslogtreecommitdiffhomepage
path: root/207.libz.build
blob: 7b5de83211e94511d246d1c770396d1807636410 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
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