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) ec19f0
# Order: no_complex_host, full_host, full
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
#
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
pkgp_musl_build_dir() {
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
	PKG_BUILD_DIR="${1}-${2}-${PKG_TARGET}";
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
};
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
pkgp_musl_configure() {
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
	ex_rtl_fileop rm "${PKG_BASE_DIR}/${PKG_BUILD_DIR}";
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
	ex_rtl_fileop mkdir "${PKG_BASE_DIR}/${PKG_BUILD_DIR}";
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
	ex_rtl_fileop cd "${PKG_BASE_DIR}/${PKG_BUILD_DIR}";
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
	env	lz_cflags_cmdline=""		\
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
		lz_debug="yes"			\
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
	../lazy/lazy				\
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
		-a "${ARCH}"			\
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
		-c gcc				\
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
		-f "${PKG_DESTDIR}"		\
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
		-n musl				\
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
		-p "../musl-${PKG_VERSION}"	\
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
		-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) ec19f0
pkg_musl_no_complex_host_all() {
Lucio Andrés Illanes Albornoz (arab, vxp) 36ab93
	local _install _restart_at="${1}";
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
	PKG_MUSL_VERSION="${PKG_VERSION}";
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
	# Git clone what we need.
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
	ex_rtl_fetch_urls_git "${PKG_BASE_DIR}" "lazy=${DEFAULT_GITROOT}/lazy";
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
	export lz_arch="${ARCH}" lz_cflags_debug="-O2" lz_target="${PKG_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) ec19f0
	pkgp_musl_build_dir "musl-${PKG_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) ec19f0
		ex_rtl_fetch_url_wget							\
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
			"http://www.musl-libc.org/releases/musl-${PKG_VERSION}.tar.gz"	\
Lucio Andrés Illanes Albornoz (arab, vxp) 36ab93
			"${PKG_MUSL_NO_COMPLEX_SHA256SUM}";
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
		ex_rtl_fileop rm "${PKG_BASE_DIR}/mmglue";
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
		ex_rtl_fetch_urls_git "${PKG_BASE_DIR}" "mmglue=${DEFAULT_GITROOT}/mmglue";
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
		ex_pkg_state_set "${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) ec19f0
		ex_rtl_fileop rm "musl-${PKG_VERSION}";
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
		tar -C "${PKG_BASE_DIR}" -xf "${BUILD_DLCACHEDIR}/musl-${PKG_VERSION}.tar.gz";
Lucio Andrés Illanes Albornoz (arab, vxp) 36ab93
		set +o noglob;
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
		 ex_rtl_fileop cp ${PKG_BASE_DIR}/mmglue/* "${PKG_BASE_DIR}/musl-${PKG_VERSION}/";
Lucio Andrés Illanes Albornoz (arab, vxp) 36ab93
		set -o noglob;
Lucio Andrés Illanes Albornoz (arab, vxp) ff26b5
		ex_pkg_state_set "${PKG_NAME}" extract -patch;
Lucio Andrés Illanes Albornoz (arab, vxp) ff26b5
	fi;
Lucio Andrés Illanes Albornoz (arab, vxp) ff26b5
	if ! ex_pkg_state_test "${PKG_NAME}" patch "${_restart_at}"; then
Lucio Andrés Illanes Albornoz (arab, vxp) ff26b5
		set +o noglob; for _patch_fname in	\
Lucio Andrés Illanes Albornoz (arab, vxp) ff26b5
				"${MIDIPIX_BUILD_PWD}/patches/musl/"*.patch; do
Lucio Andrés Illanes Albornoz (arab, vxp) ff26b5
			if [ -r "${_patch_fname}" ]; then
Lucio Andrés Illanes Albornoz (arab, vxp) ff26b5
				patch -b -d "${PKG_BASE_DIR}/musl-${PKG_VERSION}" -p1 < "${_patch_fname}";
Lucio Andrés Illanes Albornoz (arab, vxp) ff26b5
			fi;
Lucio Andrés Illanes Albornoz (arab, vxp) ff26b5
		done; set -o noglob;
Lucio Andrés Illanes Albornoz (arab, vxp) ff26b5
		ex_pkg_state_set "${PKG_NAME}" patch -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) ec19f0
		ex_pkg_state_set "${PKG_NAME}" configure -build;
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
	else
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
		ex_rtl_fileop cd "${PKG_BUILD_DIR}";
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
	fi;
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
	if ! ex_pkg_state_test "${PKG_NAME}" install_subdirs "${_restart_at}"; then
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
		pkg_install_subdirs;
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
		ex_pkg_state_set "${PKG_NAME}" install_subdirs -build;
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) ec19f0
		ex_pkg_state_set "${PKG_NAME}" build -install;
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
	fi;
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
	if ! ex_pkg_state_test "${PKG_NAME}" install "${_restart_at}"; then
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
		pkg_install;
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
		ex_pkg_state_set "${PKG_NAME}" install finish;
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
	fi;
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
};
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
pkg_musl_full_host_all() {
Lucio Andrés Illanes Albornoz (arab, vxp) 36ab93
	local _install _restart_at="${1}";
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
	# Git clone what we need.
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
	ex_rtl_fetch_urls_git "${PKG_BASE_DIR}" "lazy=${DEFAULT_GITROOT}/lazy";
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
	export lz_arch="${ARCH}" lz_cflags_debug="-O2" lz_target="${PKG_TARGET}";
lalbornoz 340f4c
	# Musl: build (full)
Lucio Andrés Illanes Albornoz (arab, vxp) 6e940c
	_install=install;
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
	pkgp_musl_build_dir "musl-${PKG_VERSION}" cross;
Lucio Andrés Illanes Albornoz (arab, vxp) 016ed7
	if ! ex_pkg_state_test "${PKG_NAME}" fetch "${_restart_at}"; then
Lucio Andrés Illanes Albornoz (arab, vxp) 016ed7
		ex_rtl_fetch_url_wget							\
Lucio Andrés Illanes Albornoz (arab, vxp) 016ed7
			"http://www.musl-libc.org/releases/musl-${PKG_VERSION}.tar.gz"	\
Lucio Andrés Illanes Albornoz (arab, vxp) 016ed7
			"${PKG_MUSL_NO_COMPLEX_SHA256SUM}";
Lucio Andrés Illanes Albornoz (arab, vxp) 016ed7
		ex_rtl_fileop rm "${PKG_BASE_DIR}/mmglue";
Lucio Andrés Illanes Albornoz (arab, vxp) 016ed7
		ex_rtl_fetch_urls_git "${PKG_BASE_DIR}" "mmglue=${DEFAULT_GITROOT}/mmglue";
Lucio Andrés Illanes Albornoz (arab, vxp) 016ed7
		ex_pkg_state_set "${PKG_NAME}" fetch -extract;
Lucio Andrés Illanes Albornoz (arab, vxp) 016ed7
	fi;
Lucio Andrés Illanes Albornoz (arab, vxp) 016ed7
	if ! ex_pkg_state_test "${PKG_NAME}" extract "${_restart_at}"; then
Lucio Andrés Illanes Albornoz (arab, vxp) 016ed7
		ex_rtl_fileop rm "musl-${PKG_VERSION}";
Lucio Andrés Illanes Albornoz (arab, vxp) 016ed7
		tar -C "${PKG_BASE_DIR}" -xf "${BUILD_DLCACHEDIR}/musl-${PKG_VERSION}.tar.gz";
Lucio Andrés Illanes Albornoz (arab, vxp) 016ed7
		set +o noglob;
Lucio Andrés Illanes Albornoz (arab, vxp) 016ed7
		 ex_rtl_fileop cp ${PKG_BASE_DIR}/mmglue/* "${PKG_BASE_DIR}/musl-${PKG_VERSION}/";
Lucio Andrés Illanes Albornoz (arab, vxp) 016ed7
		set -o noglob;
Lucio Andrés Illanes Albornoz (arab, vxp) ff26b5
		ex_pkg_state_set "${PKG_NAME}" extract -patch;
Lucio Andrés Illanes Albornoz (arab, vxp) ff26b5
	fi;
Lucio Andrés Illanes Albornoz (arab, vxp) ff26b5
	if ! ex_pkg_state_test "${PKG_NAME}" patch "${_restart_at}"; then
Lucio Andrés Illanes Albornoz (arab, vxp) ff26b5
		set +o noglob; for _patch_fname in	\
Lucio Andrés Illanes Albornoz (arab, vxp) ff26b5
				"${MIDIPIX_BUILD_PWD}/patches/musl/"*.patch; do
Lucio Andrés Illanes Albornoz (arab, vxp) ff26b5
			if [ -r "${_patch_fname}" ]; then
Lucio Andrés Illanes Albornoz (arab, vxp) ff26b5
				patch -b -d "${PKG_BASE_DIR}/musl-${PKG_VERSION}" -p1 < "${_patch_fname}";
Lucio Andrés Illanes Albornoz (arab, vxp) ff26b5
			fi;
Lucio Andrés Illanes Albornoz (arab, vxp) ff26b5
		done; set -o noglob;
Lucio Andrés Illanes Albornoz (arab, vxp) ff26b5
		ex_pkg_state_set "${PKG_NAME}" patch -configure;
Lucio Andrés Illanes Albornoz (arab, vxp) 016ed7
	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) ec19f0
		ex_pkg_state_set "${PKG_NAME}" configure -build;
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
	else
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
		ex_rtl_fileop cd "${PKG_BUILD_DIR}";
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
	fi;
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
	if ! ex_pkg_state_test "${PKG_NAME}" install_subdirs "${_restart_at}"; then
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
		pkg_install_subdirs;
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
		ex_pkg_state_set "${PKG_NAME}" install_subdirs -build;
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) ec19f0
		ex_pkg_state_set "${PKG_NAME}" build -install;
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
	fi;
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
	if ! ex_pkg_state_test "${PKG_NAME}" install "${_restart_at}"; then
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
		pkg_install;
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
		ex_pkg_state_set "${PKG_NAME}" install finish;
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
	fi;
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
	# Git clone what we need.
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
	ex_rtl_fetch_urls_git "${PKG_BASE_DIR}" "lazy=${DEFAULT_GITROOT}/lazy";
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
	export lz_arch="${ARCH}" lz_cflags_debug="-O2" lz_target="${PKG_TARGET}";
lalbornoz 340f4c
	# Musl: build (full)
Lucio Andrés Illanes Albornoz (arab, vxp) 6e940c
	_install=install;
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
	pkgp_musl_build_dir "musl-${PKG_VERSION}" native;
Lucio Andrés Illanes Albornoz (arab, vxp) d953a6
	if ! ex_pkg_state_test "${PKG_NAME}" fetch "${_restart_at}"; then
Lucio Andrés Illanes Albornoz (arab, vxp) d953a6
		ex_rtl_fetch_url_wget							\
Lucio Andrés Illanes Albornoz (arab, vxp) d953a6
			"http://www.musl-libc.org/releases/musl-${PKG_VERSION}.tar.gz"	\
Lucio Andrés Illanes Albornoz (arab, vxp) d953a6
			"${PKG_MUSL_NO_COMPLEX_SHA256SUM}";
Lucio Andrés Illanes Albornoz (arab, vxp) d953a6
		ex_rtl_fileop rm "${PKG_BASE_DIR}/mmglue";
Lucio Andrés Illanes Albornoz (arab, vxp) d953a6
		ex_rtl_fetch_urls_git "${PKG_BASE_DIR}" "mmglue=${DEFAULT_GITROOT}/mmglue";
Lucio Andrés Illanes Albornoz (arab, vxp) d953a6
		ex_pkg_state_set "${PKG_NAME}" fetch -extract;
Lucio Andrés Illanes Albornoz (arab, vxp) d953a6
	fi;
Lucio Andrés Illanes Albornoz (arab, vxp) d953a6
	if ! ex_pkg_state_test "${PKG_NAME}" extract "${_restart_at}"; then
Lucio Andrés Illanes Albornoz (arab, vxp) d953a6
		ex_rtl_fileop rm "musl-${PKG_VERSION}";
Lucio Andrés Illanes Albornoz (arab, vxp) d953a6
		tar -C "${PKG_BASE_DIR}" -xf "${BUILD_DLCACHEDIR}/musl-${PKG_VERSION}.tar.gz";
Lucio Andrés Illanes Albornoz (arab, vxp) d953a6
		set +o noglob;
Lucio Andrés Illanes Albornoz (arab, vxp) d953a6
		 ex_rtl_fileop cp ${PKG_BASE_DIR}/mmglue/* "${PKG_BASE_DIR}/musl-${PKG_VERSION}/";
Lucio Andrés Illanes Albornoz (arab, vxp) d953a6
		set -o noglob;
Lucio Andrés Illanes Albornoz (arab, vxp) ff26b5
		ex_pkg_state_set "${PKG_NAME}" extract -patch;
Lucio Andrés Illanes Albornoz (arab, vxp) ff26b5
	fi;
Lucio Andrés Illanes Albornoz (arab, vxp) ff26b5
	if ! ex_pkg_state_test "${PKG_NAME}" patch "${_restart_at}"; then
Lucio Andrés Illanes Albornoz (arab, vxp) ff26b5
		set +o noglob; for _patch_fname in	\
Lucio Andrés Illanes Albornoz (arab, vxp) ff26b5
				"${MIDIPIX_BUILD_PWD}/patches/musl/"*.patch; do
Lucio Andrés Illanes Albornoz (arab, vxp) ff26b5
			if [ -r "${_patch_fname}" ]; then
Lucio Andrés Illanes Albornoz (arab, vxp) ff26b5
				patch -b -d "${PKG_BASE_DIR}/musl-${PKG_VERSION}" -p1 < "${_patch_fname}";
Lucio Andrés Illanes Albornoz (arab, vxp) ff26b5
			fi;
Lucio Andrés Illanes Albornoz (arab, vxp) ff26b5
		done; set -o noglob;
Lucio Andrés Illanes Albornoz (arab, vxp) ff26b5
		ex_pkg_state_set "${PKG_NAME}" patch -configure;
Lucio Andrés Illanes Albornoz (arab, vxp) d953a6
	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) ec19f0
		ex_pkg_state_set "${PKG_NAME}" configure -build;
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
	else
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
		ex_rtl_fileop cd "${PKG_BUILD_DIR}";
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
	fi;
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
	if ! ex_pkg_state_test "${PKG_NAME}" install_subdirs "${_restart_at}"; then
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
		pkg_install_subdirs;
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
		ex_pkg_state_set "${PKG_NAME}" install_subdirs -build;
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) ec19f0
		ex_rtl_fileop ln_symbolic ../lib/libc.so "${PKG_DESTDIR}/bin/ldd";
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
		ex_pkg_state_set "${PKG_NAME}" build -install;
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
	fi;
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
	if ! ex_pkg_state_test "${PKG_NAME}" install "${_restart_at}"; then
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
		pkg_install;
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
		ex_pkg_state_set "${PKG_NAME}" install finish;
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
	fi;
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
};
lalbornoz 340f4c
lalbornoz 340f4c
# vim:filetype=sh