midipix / build / midipix_build

Forked from build/midipix_build 4 years ago
Clone
Blob Blame History Raw
#
# set -o errexit -o noglob are assumed.
# Order: no_complex, native, full
#

pkgp_musl_configure() {
	build_fileop rm "${WORKDIR}/${PKG_BUILD_DIR}";
	build_fileop mkdir "${WORKDIR}/${PKG_BUILD_DIR}";
	build_fileop cd "${WORKDIR}/${PKG_BUILD_DIR}";
	env	lz_cflags_cmdline=""			\
		lz_debug="yes"				\
	../lazy/lazy					\
		-a "${ARCH}"				\
		-c gcc					\
		-f "${PKG_PREFIX}"			\
		-n musl					\
		-p "../musl-${PKG_MUSL_VERSION}"	\
		-t "${lz_target}"			\
		-x config;
};

pkg_musl_no_complex_all() {
	local _install _restart_at="${1}";
	PKG_MUSL_VERSION="${PKG_MUSL_NO_COMPLEX_VERSION}";
	# Git clone what we need.
	pkg_fetch -git "lazy=${GITROOT}/lazy";
	export lz_arch="${ARCH}" lz_cflags_debug="-O2" lz_target="${TARGET}";
	# Musl: build (no-complex)
	_install=install_no_complex;
	set_build_dir "musl-${PKG_MUSL_VERSION}" cross;
	if ! is_build_script_done "${PKG_NAME}" fetch "${_restart_at}"; then
		pkg_fetch "http://www.musl-libc.org/releases/musl-${PKG_MUSL_VERSION}.tar.gz"	\
			"${PKG_MUSL_NO_COMPLEX_SHA256SUM}";
		build_fileop rm "${WORKDIR}/mmglue";
		pkg_fetch -git "mmglue=${GITROOT}/mmglue";
		set_build_script_done "${PKG_NAME}" fetch -extract;
	fi;
	if ! is_build_script_done "${PKG_NAME}" extract "${_restart_at}"; then
		build_fileop rm "musl-${PKG_MUSL_VERSION}";
		tar -C "${WORKDIR}" -xf "${DLCACHEDIR}/musl-${PKG_MUSL_VERSION}.tar.gz";
		set +o noglob;
		 build_fileop cp ${WORKDIR}/mmglue/* "${WORKDIR}/musl-${PKG_MUSL_VERSION}/";
		set -o noglob;
		set_build_script_done "${PKG_NAME}" extract -configure;
	fi;
	if ! is_build_script_done "${PKG_NAME}" configure "${_restart_at}"; then
		pkgp_musl_configure;
		set_build_script_done "${PKG_NAME}" configure -build;
	else
		build_fileop cd "${PKG_BUILD_DIR}";
	fi;
	if ! is_build_script_done "${PKG_NAME}" build "${_restart_at}"; then
		./lazy -e "${_install}" -x build;
		set_build_script_done "${PKG_NAME}" build finish;
	fi;
	exit 0;
};

pkg_musl_native_all() {
	local _install _restart_at="${1}";
	PKG_MUSL_VERSION="${PKG_MUSL_NATIVE_VERSION}";
	# Git clone what we need.
	pkg_fetch -git "lazy=${GITROOT}/lazy";
	export lz_arch="${ARCH}" lz_cflags_debug="-O2" lz_target="${TARGET}";
	# Musl: build (full)
	_install=install;
	set_build_dir "musl-${PKG_MUSL_VERSION}" native;
	if ! is_build_script_done "${PKG_NAME}" configure "${_restart_at}"; then
		pkgp_musl_configure;
		set_build_script_done "${PKG_NAME}" configure -build;
	else
		build_fileop cd "${PKG_BUILD_DIR}";
	fi;
	if ! is_build_script_done "${PKG_NAME}" build "${_restart_at}"; then
		./lazy -e "${_install}" -x build;
		build_fileop ln_symbolic ../lib/libc.so "${PKG_PREFIX}/bin/ldd";
		build_fileop cp lib/libc.so "${PREFIX_MINIPIX}/lib";
		set_build_script_done "${PKG_NAME}" build finish;
	fi;
	exit 0;
};

pkg_musl_full_all() {
	local _install _restart_at="${1}";
	PKG_MUSL_VERSION="${PKG_MUSL_FULL_VERSION}";
	# Git clone what we need.
	pkg_fetch -git "lazy=${GITROOT}/lazy";
	export lz_arch="${ARCH}" lz_cflags_debug="-O2" lz_target="${TARGET}";
	# Musl: build (full)
	_install=install;
	set_build_dir "musl-${PKG_MUSL_VERSION}" cross;
	if ! is_build_script_done "${PKG_NAME}" configure "${_restart_at}"; then
		pkgp_musl_configure;
		set_build_script_done "${PKG_NAME}" configure -build;
	else
		build_fileop cd "${PKG_BUILD_DIR}";
	fi;
	if ! is_build_script_done "${PKG_NAME}" build "${_restart_at}"; then
		./lazy -e "${_install}" -x build;
		set_build_script_done "${PKG_NAME}" build finish;
	fi;
	exit 0;
};

# vim:filetype=sh