Conan_Kudo / build / midipix_build

Forked from build/midipix_build 4 years ago
Clone

Blame 007.gcc.full.build

Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
#
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
# . ./build.vars and set -o errexit are assumed.
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
#
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
lalbornoz 340f4c
# Order: stage1, runtime, full, native
lalbornoz 340f4c
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
if [ "x${3}" = "xruntime" ]\
lalbornoz 340f4c
||   [ "x${3}" = "xfull" ]; then
Lucio Andrés Illanes Albornoz (arab, vxp) c49754
	set_build_dir cbb-gcc-${PKG_GCC_VERSION} cross;
Lucio Andrés Illanes Albornoz (arab, vxp) 96b309
	cd ${BUILD_DIR};
lalbornoz 340f4c
	if [ "x${3}" = "xruntime" ]; then
lalbornoz 340f4c
		# GCC, compiler runtime.
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
		if ! is_build_script_done build; then
lalbornoz 340f4c
			make ${MAKEFLAGS} all-target-libgcc;
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
			set_build_script_done build -install;
lalbornoz 340f4c
		fi;
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
		if ! is_build_script_done install; then
lalbornoz 340f4c
			make ${MAKEFLAGS} install-target-libgcc;
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
			set_build_script_done install finish;
lalbornoz 340f4c
		fi;
lalbornoz 340f4c
	elif [ "x${3}" = "xfull" ]; then
lalbornoz 340f4c
		# GCC, everything else.
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
		if ! is_build_script_done build1; then
lalbornoz 340f4c
			make ${MAKEFLAGS} all-target-libstdc++-v3;
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
			set_build_script_done build1 -install1;
lalbornoz 340f4c
		fi;
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
		if ! is_build_script_done install1; then
lalbornoz 340f4c
			make ${MAKEFLAGS} install-target-libstdc++-v3;
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
			set_build_script_done install1 -build2;
lalbornoz 340f4c
		fi;
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
		if ! is_build_script_done build2; then
lalbornoz 340f4c
			make ${MAKEFLAGS};
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
			set_build_script_done build2 -install2;
lalbornoz 340f4c
		fi;
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
		if ! is_build_script_done install2; then
lalbornoz 340f4c
			make ${MAKEFLAGS} install;
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
			set_build_script_done install2 finish;
lalbornoz 340f4c
		fi;
lalbornoz 340f4c
	fi;
lalbornoz 340f4c
else
lalbornoz 340f4c
	if [ "x${3}" = "xstage1" ]; then
lalbornoz 340f4c
		# GCC, stage1.
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
		if ! is_build_script_done fetch; then
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
			rm_if_exists cbb-gcc-${PKG_GCC_VERSION};
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
			fetch_git cbb-gcc-${PKG_GCC_VERSION}		\
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
			${GITROOT}/cbb/cbb-gcc-${PKG_GCC_VERSION};
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
			set_build_script_done fetch -configure;
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
		fi;
Lucio Andrés Illanes Albornoz (arab, vxp) c49754
		set_build_dir cbb-gcc-${PKG_GCC_VERSION} cross;
Lucio Andrés Illanes Albornoz (arab, vxp) f9c386
		export	cbb_ldflags_for_target=--sysroot=${PREFIX_LVL}	\
Lucio Andrés Illanes Albornoz (arab, vxp) f9c386
			cbb_sysroot_for_libgcc=${PREFIX_LVL}		\
Lucio Andrés Illanes Albornoz (arab, vxp) f9c386
			cbb_target=${TARGET}				\
Lucio Andrés Illanes Albornoz (arab, vxp) f9c386
			cbb_neutral_libiberty=no			\
Lucio Andrés Illanes Albornoz (arab, vxp) 96b309
			cbb_xgcc_for_specs=${WORKDIR}/${BUILD_DIR}/gcc/xgcc;
Lucio Andrés Illanes Albornoz (arab, vxp) f9c386
		GCCTARGET_FLAGS="-DIN_TARGET_LIBRARY_BUILD --sysroot=${PREFIX_LVL}";
lalbornoz 340f4c
	elif [ "x${3}" = "xnative" ]; then
lalbornoz 340f4c
		# GCC, native.
Lucio Andrés Illanes Albornoz (arab, vxp) 6e940c
		set_build_dir cbb-gcc-${PKG_GCC_VERSION} native;
Lucio Andrés Illanes Albornoz (arab, vxp) f9c386
		export 	cbb_ldflags_for_target=--sysroot=${PREFIX_LVL}	\
Lucio Andrés Illanes Albornoz (arab, vxp) f9c386
			cbb_sysroot_for_libgcc=${PREFIX_LVL}		\
Lucio Andrés Illanes Albornoz (arab, vxp) f9c386
			cbb_target=${TARGET}				\
Lucio Andrés Illanes Albornoz (arab, vxp) 6e940c
			cbb_xgcc_for_specs=${TARGET}-gcc;
Lucio Andrés Illanes Albornoz (arab, vxp) f9c386
		GCCTARGET_FLAGS="-DIN_TARGET_LIBRARY_BUILD --sysroot=${PREFIX_LVL}";
lalbornoz 340f4c
	fi;
Lucio Andrés Illanes Albornoz (arab, vxp) bd43d0
	GCCFLAGS="${CFLAGS:+${CFLAGS} }--include $(readlink -f ${WORKDIR}/cbb-gcc-${PKG_GCC_VERSION}/libc/cbb-musl-pe.h)";
lalbornoz 340f4c
	set_env_vars "${GCCFLAGS}" CFLAGS CFLAGS_FOR_BUILD CPPFLAGS_FOR_BUILD CXXFLAGS CXXFLAGS_FOR_BUILD;
lalbornoz 340f4c
	set_env_vars "${GCCTARGET_FLAGS}" CFLAGS_FOR_TARGET CPPFLAGS_FOR_TARGET CXXFLAGS_FOR_TARGET LIBCFLAGS_FOR_TARGET XGCC_FLAGS_FOR_TARGET;
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
	set_env_vars "${CFLAGS_FOR_BUILD}" cbb_cflags_for_stage1 cbb_cflags_for_stage2 cbb_cflags_for_stage3 cbb_cflags_for_stage4;
lalbornoz 340f4c
	export CFLAGS CXXFLAGS CFLAGS_FOR_BUILD CPPFLAGS_FOR_BUILD CXXFLAGS_FOR_BUILD CFLAGS_FOR_TARGET XGCC_FLAGS_FOR_TARGET CPPFLAGS_FOR_TARGET CXXFLAGS_FOR_TARGET LIBCFLAGS_FOR_TARGET;
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
	if ! is_build_script_done configure; then
lalbornoz 340f4c
		if [ "x${3}" = "xstage1" ]; then
Lucio Andrés Illanes Albornoz (arab, vxp) f9c386
			mkdir -p ${PREFIX_LVL}/include;
Lucio Andrés Illanes Albornoz (arab, vxp) f9c386
			[ \! -d ${PREFIX_LVL}/usr ] &&			\
Lucio Andrés Illanes Albornoz (arab, vxp) f9c386
				ln -s . ${PREFIX_LVL}/usr;
Lucio Andrés Illanes Albornoz (arab, vxp) f9c386
			_configure_args="--prefix=${PREFIX} --with-sysroot=${PREFIX_LVL}";
lalbornoz 340f4c
		elif [ "x${3}" = "xnative" ]; then
Lucio Andrés Illanes Albornoz (arab, vxp) f9c386
			mkdir -p ${PREFIX_LVL}/${TARGET};
Lucio Andrés Illanes Albornoz (arab, vxp) f9c386
			if [ \! -d ${PREFIX_LVL}/${TARGET}/usr ]; then
Lucio Andrés Illanes Albornoz (arab, vxp) f9c386
				ln -s . ${PREFIX_LVL}/${TARGET}/usr;
lalbornoz 340f4c
			fi;
lalbornoz 340f4c
			_configure_args="			\
lalbornoz 340f4c
				--host=x86_64-nt64-midipix	\
lalbornoz 340f4c
				--prefix=/			\
Lucio Andrés Illanes Albornoz (arab, vxp) f9c386
				--with-elf=${PREFIX_LVL}	\
Lucio Andrés Illanes Albornoz (arab, vxp) f9c386
				--with-gmp=${PREFIX_LVL}	\
Lucio Andrés Illanes Albornoz (arab, vxp) f9c386
				--with-mpc=${PREFIX_LVL}	\
Lucio Andrés Illanes Albornoz (arab, vxp) f9c386
				--with-mpfr=${PREFIX_LVL}	\
lalbornoz 340f4c
				--with-sysroot=";
lalbornoz 340f4c
		fi;
Lucio Andrés Illanes Albornoz (arab, vxp) 96b309
		rm_if_exists -m -c ${BUILD_DIR};
Lucio Andrés Illanes Albornoz (arab, vxp) 6e940c
		../cbb-gcc-${PKG_GCC_VERSION}/configure		\
lalbornoz 340f4c
			--disable-bootstrap			\
lalbornoz 340f4c
			--disable-libmudflap			\
lalbornoz 340f4c
			--disable-multilib			\
lalbornoz 340f4c
			--disable-nls				\
lalbornoz 340f4c
			--disable-obsolete			\
lalbornoz 340f4c
			--disable-sjlj-exceptions		\
lalbornoz 340f4c
			--disable-symvers			\
lalbornoz 340f4c
			--enable-canonical-system-headers	\
lalbornoz 340f4c
			--enable-__cxa_atexit			\
lalbornoz 340f4c
			--enable-debug				\
lalbornoz 340f4c
			--enable-gnu-indirect-function		\
lalbornoz 340f4c
			--enable-gnu-unique-object		\
lalbornoz 340f4c
			--enable-initfini-array			\
lalbornoz 340f4c
			--enable-languages=c,c++,objc,lto	\
lalbornoz 340f4c
			--enable-libstdcxx-debug		\
lalbornoz 340f4c
			--enable-lto				\
lalbornoz 340f4c
			--enable-multiarch			\
lalbornoz 340f4c
			--enable-secureplt			\
lalbornoz 340f4c
			--enable-shared				\
lalbornoz 340f4c
			--enable-threads=posix			\
lalbornoz 340f4c
			--target=${TARGET}			\
lalbornoz 340f4c
			--with-fpmath=sse			\
lalbornoz 340f4c
			${_configure_args};
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
		set_build_script_done configure clean -build;
lalbornoz 340f4c
	else
Lucio Andrés Illanes Albornoz (arab, vxp) 96b309
		cd ${BUILD_DIR};
lalbornoz 340f4c
	fi;
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
	if ! is_build_script_done clean; then
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
		make ${MAKEFLAGS} clean;
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
		set_build_script_done clean -build;
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
	fi;
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
	if ! is_build_script_done build; then
lalbornoz 340f4c
		if [ "x${3}" = "xstage1" ]; then
lalbornoz 340f4c
			make ${MAKEFLAGS} all-gcc;
lalbornoz 340f4c
		elif [ "x${3}" = "xnative" ]; then
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
			make ${MAKEFLAGS} all-gcc;
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
			make ${MAKEFLAGS} all-target-libgcc;
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
			make ${MAKEFLAGS} all-target-libstdc++-v3;
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
			make ${MAKEFLAGS} all;
lalbornoz 340f4c
		fi;
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
		set_build_script_done build -install;
lalbornoz 340f4c
	fi;
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
	if ! is_build_script_done install; then
lalbornoz 340f4c
		if [ "x${3}" = "xstage1" ]; then
lalbornoz 340f4c
			make ${MAKEFLAGS} install-gcc;
lalbornoz 340f4c
		elif [ "x${3}" = "xnative" ]; then
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
			make ${MAKEFLAGS} DESTDIR=${PREFIX_LVL} install;
lalbornoz 340f4c
		fi;
Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
		set_build_script_done install finish;
lalbornoz 340f4c
	fi;
lalbornoz 340f4c
fi;
lalbornoz 340f4c
lalbornoz 340f4c
# vim:filetype=sh