Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
#
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
# . ./build.vars and set -o errexit are assumed.
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
#
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
# Order: no-complex, native
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
Lucio Andrés Illanes Albornoz (arab, vxp) 6e940c
export lz_arch=${ARCH} lz_cflags_debug=-O2 lz_target=${TARGET};
lalbornoz 340f4c
Lucio Andrés Illanes Albornoz (arab, vxp) 9ba5d3
if [ "${3}" = no-complex ]; then
lalbornoz 340f4c
	# Musl: build (no-complex)
Lucio Andrés Illanes Albornoz (arab, vxp) 6e940c
	_install=install_no_complex;
Lucio Andrés Illanes Albornoz (arab, vxp) c49754
	set_build_dir musl-${PKG_MUSL_VERSION}-${3} cross;
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
	if ! is_build_script_done fetch; then
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
		fetch http://www.musl-libc.org/releases/musl-${PKG_MUSL_VERSION}.tar.gz	\
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
			${PKG_MUSL_SHA256SUM};
Lucio Andrés Illanes Albornoz (arab, vxp) 0724e5
		[ ${ARG_NO_DOWNLOAD:-0} -eq 0 ] &&\
Lucio Andrés Illanes Albornoz (arab, vxp) 0724e5
			rm_if_exists mmglue;
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
		fetch_git mmglue ${GITROOT}/mmglue;
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
		set_build_script_done fetch -extract;
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
	fi;
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
	if ! is_build_script_done extract; then
Lucio Andrés Illanes Albornoz (arab, vxp) 6e940c
		rm_if_exists musl-${PKG_MUSL_VERSION};
Lucio Andrés Illanes Albornoz (arab, vxp) 6e940c
		tar -xf musl-${PKG_MUSL_VERSION}.tar.gz;
Lucio Andrés Illanes Albornoz (arab, vxp) 6e940c
		cp -R mmglue/* musl-${PKG_MUSL_VERSION}/;
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
		set_build_script_done extract -configure;
lalbornoz 340f4c
	fi;
Lucio Andrés Illanes Albornoz (arab, vxp) 9ba5d3
elif [ "${3}" = native ]; then
lalbornoz 340f4c
	# Musl: build (full)
Lucio Andrés Illanes Albornoz (arab, vxp) 6e940c
	_install=install;
Lucio Andrés Illanes Albornoz (arab, vxp) 9ba5d3
	set_build_dir musl-${PKG_MUSL_VERSION} "${3}";
Lucio Andrés Illanes Albornoz (arab, vxp) 9ba5d3
elif [ "${3}" = full ]; then
lalbornoz 340f4c
	# Musl: build (full)
Lucio Andrés Illanes Albornoz (arab, vxp) 6e940c
	_install=install;
Lucio Andrés Illanes Albornoz (arab, vxp) c49754
	set_build_dir musl-${PKG_MUSL_VERSION} cross;
lalbornoz 340f4c
fi;
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
if ! is_build_script_done configure; then
Lucio Andrés Illanes Albornoz (arab, vxp) 392fef
	rm_if_exists -m -c ${PKG_BUILD_DIR};
Lucio Andrés Illanes Albornoz (arab, vxp) f9c386
	../lazy/lazy				\
Lucio Andrés Illanes Albornoz (arab, vxp) f9c386
		-a ${ARCH}			\
Lucio Andrés Illanes Albornoz (arab, vxp) f9c386
		-c gcc				\
Lucio Andrés Illanes Albornoz (arab, vxp) f9c386
		-f ${PREFIX_LVL}		\
Lucio Andrés Illanes Albornoz (arab, vxp) f9c386
		-n musl				\
Lucio Andrés Illanes Albornoz (arab, vxp) f9c386
		-p ../musl-${PKG_MUSL_VERSION}	\
Lucio Andrés Illanes Albornoz (arab, vxp) f9c386
		-t ${lz_target}			\
lalbornoz 340f4c
		-x config;
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
	set_build_script_done configure clean -build;
lalbornoz 340f4c
else
Lucio Andrés Illanes Albornoz (arab, vxp) 392fef
	cd ${PKG_BUILD_DIR};
lalbornoz 340f4c
fi;
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
if ! is_build_script_done clean; then
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
	make ${MAKEFLAGS} clean;
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
	set_build_script_done clean -build;
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
fi;
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
if ! is_build_script_done build; then
Lucio Andrés Illanes Albornoz (arab, vxp) f9c386
	./lazy	-e ${_install}			\
lalbornoz 340f4c
		-x build;
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
	set_build_script_done build finish;
lalbornoz 340f4c
fi;
lalbornoz 340f4c
lalbornoz 340f4c
# vim:filetype=sh