Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
#
Lucio Andrés Illanes Albornoz (arab, vxp) 802215
# set -o errexit -o noglob are assumed.
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
# Order: no_complex, native, full
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
#
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
pkgp_musl_configure() {
Lucio Andrés Illanes Albornoz (arab, vxp) d5afb4
	build_fileop rm "${WORKDIR}/${PKG_BUILD_DIR}";
Lucio Andrés Illanes Albornoz (arab, vxp) d5afb4
	build_fileop mkdir "${WORKDIR}/${PKG_BUILD_DIR}";
Lucio Andrés Illanes Albornoz (arab, vxp) d5afb4
	build_fileop cd "${WORKDIR}/${PKG_BUILD_DIR}";
Lucio Andrés Illanes Albornoz (arab, vxp) 36ab93
	env	lz_cflags_cmdline=""			\
Lucio Andrés Illanes Albornoz (arab, vxp) 36ab93
		lz_debug="yes"				\
Lucio Andrés Illanes Albornoz (arab, vxp) 36ab93
	../lazy/lazy					\
Lucio Andrés Illanes Albornoz (arab, vxp) 36ab93
		-a "${ARCH}"				\
Lucio Andrés Illanes Albornoz (arab, vxp) 36ab93
		-c gcc					\
Lucio Andrés Illanes Albornoz (arab, vxp) 36ab93
		-f "${PKG_PREFIX}"			\
Lucio Andrés Illanes Albornoz (arab, vxp) 36ab93
		-n musl					\
Lucio Andrés Illanes Albornoz (arab, vxp) 36ab93
		-p "../musl-${PKG_MUSL_VERSION}"	\
Lucio Andrés Illanes Albornoz (arab, vxp) 36ab93
		-t "${lz_target}"			\
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
		-x config;
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
};
lalbornoz 340f4c
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
pkg_musl_no_complex_all() {
Lucio Andrés Illanes Albornoz (arab, vxp) 36ab93
	local _install _restart_at="${1}";
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
	PKG_MUSL_VERSION="${PKG_MUSL_NO_COMPLEX_VERSION}";
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
	# Git clone what we need.
Lucio Andrés Illanes Albornoz (arab, vxp) 03a637
	pkg_fetch -git "lazy=${GITROOT}/lazy";
Lucio Andrés Illanes Albornoz (arab, vxp) 36ab93
	export lz_arch="${ARCH}" lz_cflags_debug="-O2" lz_target="${TARGET}";
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) 36ab93
	set_build_dir "musl-${PKG_MUSL_VERSION}" cross;
Lucio Andrés Illanes Albornoz (arab, vxp) 36ab93
	if ! is_build_script_done "${PKG_NAME}" fetch "${_restart_at}"; then
Lucio Andrés Illanes Albornoz (arab, vxp) 36ab93
		pkg_fetch "http://www.musl-libc.org/releases/musl-${PKG_MUSL_VERSION}.tar.gz"	\
Lucio Andrés Illanes Albornoz (arab, vxp) 36ab93
			"${PKG_MUSL_NO_COMPLEX_SHA256SUM}";
Lucio Andrés Illanes Albornoz (arab, vxp) d5afb4
		build_fileop rm "${WORKDIR}/mmglue";
Lucio Andrés Illanes Albornoz (arab, vxp) 03a637
		pkg_fetch -git "mmglue=${GITROOT}/mmglue";
Lucio Andrés Illanes Albornoz (arab, vxp) 36ab93
		set_build_script_done "${PKG_NAME}" fetch -extract;
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
	fi;
Lucio Andrés Illanes Albornoz (arab, vxp) 36ab93
	if ! is_build_script_done "${PKG_NAME}" extract "${_restart_at}"; then
Lucio Andrés Illanes Albornoz (arab, vxp) 36ab93
		build_fileop rm "musl-${PKG_MUSL_VERSION}";
Lucio Andrés Illanes Albornoz (arab, vxp) d5afb4
		tar -C "${WORKDIR}" -xf "${DLCACHEDIR}/musl-${PKG_MUSL_VERSION}.tar.gz";
Lucio Andrés Illanes Albornoz (arab, vxp) 36ab93
		set +o noglob;
Lucio Andrés Illanes Albornoz (arab, vxp) d5afb4
		 build_fileop cp ${WORKDIR}/mmglue/* "${WORKDIR}/musl-${PKG_MUSL_VERSION}/";
Lucio Andrés Illanes Albornoz (arab, vxp) 36ab93
		set -o noglob;
Lucio Andrés Illanes Albornoz (arab, vxp) 36ab93
		set_build_script_done "${PKG_NAME}" extract -configure;
lalbornoz 340f4c
	fi;
Lucio Andrés Illanes Albornoz (arab, vxp) 36ab93
	if ! is_build_script_done "${PKG_NAME}" configure "${_restart_at}"; then
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
		pkgp_musl_configure;
Lucio Andrés Illanes Albornoz (arab, vxp) 36ab93
		set_build_script_done "${PKG_NAME}" configure -build;
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
	else
Lucio Andrés Illanes Albornoz (arab, vxp) 36ab93
		build_fileop cd "${PKG_BUILD_DIR}";
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
	fi;
Lucio Andrés Illanes Albornoz (arab, vxp) 36ab93
	if ! is_build_script_done "${PKG_NAME}" build "${_restart_at}"; then
Lucio Andrés Illanes Albornoz (arab, vxp) 36ab93
		./lazy -e "${_install}" -x build;
Lucio Andrés Illanes Albornoz (arab, vxp) 36ab93
		set_build_script_done "${PKG_NAME}" build finish;
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
	fi;
Lucio Andrés Illanes Albornoz (arab, vxp) 802215
	exit 0;
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
};
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
pkg_musl_native_all() {
Lucio Andrés Illanes Albornoz (arab, vxp) 36ab93
	local _install _restart_at="${1}";
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
	PKG_MUSL_VERSION="${PKG_MUSL_NATIVE_VERSION}";
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
	# Git clone what we need.
Lucio Andrés Illanes Albornoz (arab, vxp) 03a637
	pkg_fetch -git "lazy=${GITROOT}/lazy";
Lucio Andrés Illanes Albornoz (arab, vxp) 36ab93
	export lz_arch="${ARCH}" lz_cflags_debug="-O2" lz_target="${TARGET}";
lalbornoz 340f4c
	# Musl: build (full)
Lucio Andrés Illanes Albornoz (arab, vxp) 6e940c
	_install=install;
Lucio Andrés Illanes Albornoz (arab, vxp) 36ab93
	set_build_dir "musl-${PKG_MUSL_VERSION}" native;
Lucio Andrés Illanes Albornoz (arab, vxp) 36ab93
	if ! is_build_script_done "${PKG_NAME}" configure "${_restart_at}"; then
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
		pkgp_musl_configure;
Lucio Andrés Illanes Albornoz (arab, vxp) 36ab93
		set_build_script_done "${PKG_NAME}" configure -build;
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
	else
Lucio Andrés Illanes Albornoz (arab, vxp) 36ab93
		build_fileop cd "${PKG_BUILD_DIR}";
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
	fi;
Lucio Andrés Illanes Albornoz (arab, vxp) 36ab93
	if ! is_build_script_done "${PKG_NAME}" build "${_restart_at}"; then
Lucio Andrés Illanes Albornoz (arab, vxp) 36ab93
		./lazy -e "${_install}" -x build;
Lucio Andrés Illanes Albornoz (arab, vxp) 36ab93
		build_fileop ln_symbolic ../lib/libc.so "${PKG_PREFIX}/bin/ldd";
Lucio Andrés Illanes Albornoz (arab, vxp) 65ffec
		build_fileop cp lib/libc.so "${PREFIX_MINIPIX}/lib";
Lucio Andrés Illanes Albornoz (arab, vxp) 36ab93
		set_build_script_done "${PKG_NAME}" build finish;
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
	fi;
Lucio Andrés Illanes Albornoz (arab, vxp) 802215
	exit 0;
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
};
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
pkg_musl_full_all() {
Lucio Andrés Illanes Albornoz (arab, vxp) 36ab93
	local _install _restart_at="${1}";
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
	PKG_MUSL_VERSION="${PKG_MUSL_FULL_VERSION}";
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
	# Git clone what we need.
Lucio Andrés Illanes Albornoz (arab, vxp) 03a637
	pkg_fetch -git "lazy=${GITROOT}/lazy";
Lucio Andrés Illanes Albornoz (arab, vxp) 36ab93
	export lz_arch="${ARCH}" lz_cflags_debug="-O2" lz_target="${TARGET}";
lalbornoz 340f4c
	# Musl: build (full)
Lucio Andrés Illanes Albornoz (arab, vxp) 6e940c
	_install=install;
Lucio Andrés Illanes Albornoz (arab, vxp) 36ab93
	set_build_dir "musl-${PKG_MUSL_VERSION}" cross;
Lucio Andrés Illanes Albornoz (arab, vxp) 36ab93
	if ! is_build_script_done "${PKG_NAME}" configure "${_restart_at}"; then
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
		pkgp_musl_configure;
Lucio Andrés Illanes Albornoz (arab, vxp) 36ab93
		set_build_script_done "${PKG_NAME}" configure -build;
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
	else
Lucio Andrés Illanes Albornoz (arab, vxp) 36ab93
		build_fileop cd "${PKG_BUILD_DIR}";
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
	fi;
Lucio Andrés Illanes Albornoz (arab, vxp) 36ab93
	if ! is_build_script_done "${PKG_NAME}" build "${_restart_at}"; then
Lucio Andrés Illanes Albornoz (arab, vxp) 36ab93
		./lazy -e "${_install}" -x build;
Lucio Andrés Illanes Albornoz (arab, vxp) 36ab93
		set_build_script_done "${PKG_NAME}" build finish;
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
	fi;
Lucio Andrés Illanes Albornoz (arab, vxp) 802215
	exit 0;
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
};
lalbornoz 340f4c
lalbornoz 340f4c
# vim:filetype=sh