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) bd97b6
	build_fileop rm ${PKG_BUILD_DIR};
Lucio Andrés Illanes Albornoz (arab, vxp) bd97b6
	build_fileop mkdir ${PKG_BUILD_DIR};
Lucio Andrés Illanes Albornoz (arab, vxp) bd97b6
	build_fileop cd ${PKG_BUILD_DIR};
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
	env	lz_cflags_cmdline=""		\
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
		lz_debug="yes"			\
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
	../lazy/lazy				\
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
		-a ${ARCH}			\
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
		-c gcc				\
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
		-f ${PKG_PREFIX}		\
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
		-n musl				\
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
		-p ../musl-${PKG_MUSL_VERSION}	\
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
		-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) 802215
	local _install;
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) 570129
	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) 59765f
	set_build_dir musl-${PKG_MUSL_VERSION}-${2} cross;
Lucio Andrés Illanes Albornoz (arab, vxp) 802215
	if ! is_build_script_done ${PKG_NAME} fetch; then
Lucio Andrés Illanes Albornoz (arab, vxp) 03a637
		pkg_fetch http://www.musl-libc.org/releases/musl-${PKG_MUSL_VERSION}.tar.gz	\
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
			${PKG_MUSL_NO_COMPLEX_SHA256SUM};
Lucio Andrés Illanes Albornoz (arab, vxp) bd97b6
		build_fileop rm mmglue;
Lucio Andrés Illanes Albornoz (arab, vxp) 03a637
		pkg_fetch -git "mmglue=${GITROOT}/mmglue";
Lucio Andrés Illanes Albornoz (arab, vxp) 802215
		set_build_script_done ${PKG_NAME} fetch -extract;
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
	fi;
Lucio Andrés Illanes Albornoz (arab, vxp) 802215
	if ! is_build_script_done ${PKG_NAME} extract; then
Lucio Andrés Illanes Albornoz (arab, vxp) bd97b6
		build_fileop rm musl-${PKG_MUSL_VERSION};
Lucio Andrés Illanes Albornoz (arab, vxp) 820be1
		tar -xf ${DLCACHEDIR}/musl-${PKG_MUSL_VERSION}.tar.gz;
Lucio Andrés Illanes Albornoz (arab, vxp) bd97b6
		set +o noglob; build_fileop cp mmglue/* musl-${PKG_MUSL_VERSION}/; set -o noglob;
Lucio Andrés Illanes Albornoz (arab, vxp) 802215
		set_build_script_done ${PKG_NAME} extract -configure;
lalbornoz 340f4c
	fi;
Lucio Andrés Illanes Albornoz (arab, vxp) 802215
	if ! is_build_script_done ${PKG_NAME} configure; then
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
		pkgp_musl_configure;
Lucio Andrés Illanes Albornoz (arab, vxp) 802215
		set_build_script_done ${PKG_NAME} configure -build;
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
	else
Lucio Andrés Illanes Albornoz (arab, vxp) bd97b6
		build_fileop cd ${PKG_BUILD_DIR};
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
	fi;
Lucio Andrés Illanes Albornoz (arab, vxp) 802215
	if ! is_build_script_done ${PKG_NAME} build; then
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
		./lazy	-e ${_install}			\
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
			-x build;
Lucio Andrés Illanes Albornoz (arab, vxp) 802215
		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) 802215
	local _install;
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) 570129
	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) 570129
	set_build_dir musl-${PKG_MUSL_VERSION} native;
Lucio Andrés Illanes Albornoz (arab, vxp) 802215
	if ! is_build_script_done ${PKG_NAME} configure; then
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
		pkgp_musl_configure;
Lucio Andrés Illanes Albornoz (arab, vxp) 802215
		set_build_script_done ${PKG_NAME} configure -build;
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
	else
Lucio Andrés Illanes Albornoz (arab, vxp) bd97b6
		build_fileop cd ${PKG_BUILD_DIR};
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
	fi;
Lucio Andrés Illanes Albornoz (arab, vxp) 802215
	if ! is_build_script_done ${PKG_NAME} build; then
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
		./lazy	-e ${_install}			\
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
			-x build;
Lucio Andrés Illanes Albornoz (arab, vxp) bd97b6
		build_fileop ln_symbolic ../lib/libc.so ${PKG_PREFIX}/bin/ldd;
Lucio Andrés Illanes Albornoz (arab, vxp) 802215
		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) 802215
	local _install;
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) 570129
	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) c49754
	set_build_dir musl-${PKG_MUSL_VERSION} cross;
Lucio Andrés Illanes Albornoz (arab, vxp) 802215
	if ! is_build_script_done ${PKG_NAME} configure; then
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
		pkgp_musl_configure;
Lucio Andrés Illanes Albornoz (arab, vxp) 802215
		set_build_script_done ${PKG_NAME} configure -build;
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
	else
Lucio Andrés Illanes Albornoz (arab, vxp) bd97b6
		build_fileop cd ${PKG_BUILD_DIR};
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
	fi;
Lucio Andrés Illanes Albornoz (arab, vxp) 802215
	if ! is_build_script_done ${PKG_NAME} build; then
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
		./lazy	-e ${_install}			\
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
			-x build;
Lucio Andrés Illanes Albornoz (arab, vxp) 802215
		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