Blame vars/musl.vars

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) 32ad21
	ex_build_fileop rm "${PKG_BASE_DIR}/${PKG_BUILD_DIR}";
Lucio Andrés Illanes Albornoz (arab, vxp) 32ad21
	ex_build_fileop mkdir "${PKG_BASE_DIR}/${PKG_BUILD_DIR}";
Lucio Andrés Illanes Albornoz (arab, vxp) 32ad21
	ex_build_fileop cd "${PKG_BASE_DIR}/${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) c27bea
	pkg_fetch_git "lazy=${DEFAULT_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) 32ad21
	ex_pkg_state_build_dir "musl-${PKG_MUSL_VERSION}" cross;
Lucio Andrés Illanes Albornoz (arab, vxp) 32ad21
	if ! ex_pkg_state_test "${PKG_NAME}" fetch "${_restart_at}"; then
Lucio Andrés Illanes Albornoz (arab, vxp) c27bea
		pkg_fetch_wget "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) 32ad21
		ex_build_fileop rm "${PKG_BASE_DIR}/mmglue";
Lucio Andrés Illanes Albornoz (arab, vxp) c27bea
		pkg_fetch_git "mmglue=${DEFAULT_GITROOT}/mmglue";
Lucio Andrés Illanes Albornoz (arab, vxp) 32ad21
		ex_pkg_state_push "${PKG_NAME}" fetch -extract;
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
	fi;
Lucio Andrés Illanes Albornoz (arab, vxp) 32ad21
	if ! ex_pkg_state_test "${PKG_NAME}" extract "${_restart_at}"; then
Lucio Andrés Illanes Albornoz (arab, vxp) 32ad21
		ex_build_fileop rm "musl-${PKG_MUSL_VERSION}";
Lucio Andrés Illanes Albornoz (arab, vxp) d01c02
		tar -C "${PKG_BASE_DIR}" -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) 32ad21
		 ex_build_fileop cp ${PKG_BASE_DIR}/mmglue/* "${PKG_BASE_DIR}/musl-${PKG_MUSL_VERSION}/";
Lucio Andrés Illanes Albornoz (arab, vxp) 36ab93
		set -o noglob;
Lucio Andrés Illanes Albornoz (arab, vxp) 32ad21
		ex_pkg_state_push "${PKG_NAME}" extract -configure;
lalbornoz 340f4c
	fi;
Lucio Andrés Illanes Albornoz (arab, vxp) 32ad21
	if ! ex_pkg_state_test "${PKG_NAME}" configure "${_restart_at}"; then
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
		pkgp_musl_configure;
Lucio Andrés Illanes Albornoz (arab, vxp) 32ad21
		ex_pkg_state_push "${PKG_NAME}" configure -build;
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
	else
Lucio Andrés Illanes Albornoz (arab, vxp) 32ad21
		ex_build_fileop cd "${PKG_BUILD_DIR}";
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
	fi;
Lucio Andrés Illanes Albornoz (arab, vxp) 32ad21
	if ! ex_pkg_state_test "${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) 32ad21
		ex_pkg_state_push "${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) c27bea
	pkg_fetch_git "lazy=${DEFAULT_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) 32ad21
	ex_pkg_state_build_dir "musl-${PKG_MUSL_VERSION}" native;
Lucio Andrés Illanes Albornoz (arab, vxp) 32ad21
	if ! ex_pkg_state_test "${PKG_NAME}" configure "${_restart_at}"; then
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
		pkgp_musl_configure;
Lucio Andrés Illanes Albornoz (arab, vxp) 32ad21
		ex_pkg_state_push "${PKG_NAME}" configure -build;
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
	else
Lucio Andrés Illanes Albornoz (arab, vxp) 32ad21
		ex_build_fileop cd "${PKG_BUILD_DIR}";
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
	fi;
Lucio Andrés Illanes Albornoz (arab, vxp) 32ad21
	if ! ex_pkg_state_test "${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) 32ad21
		ex_build_fileop ln_symbolic ../lib/libc.so "${PKG_PREFIX}/bin/ldd";
Lucio Andrés Illanes Albornoz (arab, vxp) 32ad21
		ex_pkg_state_push "${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) c27bea
	pkg_fetch_git "lazy=${DEFAULT_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) 32ad21
	ex_pkg_state_build_dir "musl-${PKG_MUSL_VERSION}" cross;
Lucio Andrés Illanes Albornoz (arab, vxp) 32ad21
	if ! ex_pkg_state_test "${PKG_NAME}" configure "${_restart_at}"; then
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
		pkgp_musl_configure;
Lucio Andrés Illanes Albornoz (arab, vxp) 32ad21
		ex_pkg_state_push "${PKG_NAME}" configure -build;
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
	else
Lucio Andrés Illanes Albornoz (arab, vxp) 32ad21
		ex_build_fileop cd "${PKG_BUILD_DIR}";
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
	fi;
Lucio Andrés Illanes Albornoz (arab, vxp) 32ad21
	if ! ex_pkg_state_test "${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) 32ad21
		ex_pkg_state_push "${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