midipix / build / midipix_build

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

pkgp_musl_configure() {
	secure_rm ${PKG_BUILD_DIR};
	insecure_mkdir ${PKG_BUILD_DIR};
	secure_cd ${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() {
	PKG_MUSL_VERSION="${PKG_MUSL_NO_COMPLEX_VERSION}";
	# Git clone what we need.
	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}-${2} cross;
	if ! is_build_script_done fetch; then
		fetch http://www.musl-libc.org/releases/musl-${PKG_MUSL_VERSION}.tar.gz	\
			${PKG_MUSL_NO_COMPLEX_SHA256SUM};
		secure_rm mmglue;
		fetch_git mmglue ${GITROOT}/mmglue;
		set_build_script_done fetch -extract;
	fi;
	if ! is_build_script_done extract; then
		secure_rm musl-${PKG_MUSL_VERSION};
		tar -xf ${DLCACHEDIR}/musl-${PKG_MUSL_VERSION}.tar.gz;
		set +o noglob; cp -R -- mmglue/* musl-${PKG_MUSL_VERSION}/; set -o noglob;
		set_build_script_done extract -configure;
	fi;
	if ! is_build_script_done configure; then
		pkgp_musl_configure;
		set_build_script_done configure clean -build;
	else
		cd ${PKG_BUILD_DIR};
	fi;
	if ! is_build_script_done clean; then
		make ${MAKEFLAGS} clean;
		set_build_script_done clean -build;
	fi;
	if ! is_build_script_done build; then
		./lazy	-e ${_install}			\
			-x build;
		set_build_script_done build finish;
	fi;
};

pkg_musl_native_all() {
	PKG_MUSL_VERSION="${PKG_MUSL_NATIVE_VERSION}";
	# Git clone what we need.
	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 configure; then
		pkgp_musl_configure;
		set_build_script_done configure clean -build;
	else
		cd ${PKG_BUILD_DIR};
	fi;
	if ! is_build_script_done clean; then
		make ${MAKEFLAGS} clean;
		set_build_script_done clean -build;
	fi;
	if ! is_build_script_done build; then
		./lazy	-e ${_install}			\
			-x build;
		ln -sf -- ../lib/libc.so ${PKG_PREFIX}/bin/ldd;
		set_build_script_done build finish;
	fi;
};

pkg_musl_full_all() {
	PKG_MUSL_VERSION="${PKG_MUSL_FULL_VERSION}";
	# Git clone what we need.
	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 configure; then
		pkgp_musl_configure;
		set_build_script_done configure clean -build;
	else
		cd ${PKG_BUILD_DIR};
	fi;
	if ! is_build_script_done clean; then
		make ${MAKEFLAGS} clean;
		set_build_script_done clean -build;
	fi;
	if ! is_build_script_done build; then
		./lazy	-e ${_install}			\
			-x build;
		set_build_script_done build finish;
	fi;
};

# vim:filetype=sh