midipix / build / midipix_build

Forked from build/midipix_build 4 years ago
Clone

Blame 008.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) 9ba5d3
if [ "${3}" = runtime ]\
Lucio Andrés Illanes Albornoz (arab, vxp) 9ba5d3
||   [ "${3}" = full ]; 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) 392fef
	cd ${PKG_BUILD_DIR};
Lucio Andrés Illanes Albornoz (arab, vxp) 9ba5d3
	if [ "${3}" = runtime ]; 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;
Lucio Andrés Illanes Albornoz (arab, vxp) 9ba5d3
	elif [ "${3}" = full ]; 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
Lucio Andrés Illanes Albornoz (arab, vxp) 9ba5d3
	if [ "${3}" = stage1 ]; 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
			fetch_git cbb-gcc-${PKG_GCC_VERSION}		\
Lucio Andrés Illanes Albornoz (arab, vxp) 0724e5
				${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) 392fef
			cbb_xgcc_for_specs=${WORKDIR}/${PKG_BUILD_DIR}/gcc/xgcc;
Lucio Andrés Illanes Albornoz (arab, vxp) f9c386
		GCCTARGET_FLAGS="-DIN_TARGET_LIBRARY_BUILD --sysroot=${PREFIX_LVL}";
Lucio Andrés Illanes Albornoz (arab, vxp) 9ba5d3
	elif [ "${3}" = native ]; 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
Lucio Andrés Illanes Albornoz (arab, vxp) 9ba5d3
		if [ "${3}" = stage1 ]; 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}";
Lucio Andrés Illanes Albornoz (arab, vxp) 9ba5d3
		elif [ "${3}" = native ]; 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;
Lucio Andrés Illanes Albornoz (arab, vxp) 951620
			if [ "${ARCH}" = nt32 ]; then
Lucio Andrés Illanes Albornoz (arab, vxp) 951620
				_configure_args="--host=i686-nt32-midipix";
Lucio Andrés Illanes Albornoz (arab, vxp) 951620
			else
Lucio Andrés Illanes Albornoz (arab, vxp) 951620
				_configure_args="--host=x86_64-nt64-midipix";
Lucio Andrés Illanes Albornoz (arab, vxp) 951620
			fi;
Lucio Andrés Illanes Albornoz (arab, vxp) 951620
			_configure_args="${_configure_args}	\
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) 392fef
		rm_if_exists -m -c ${PKG_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) 392fef
		cd ${PKG_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
Lucio Andrés Illanes Albornoz (arab, vxp) 9ba5d3
		if [ "${3}" = stage1 ]; then
lalbornoz 340f4c
			make ${MAKEFLAGS} all-gcc;
Lucio Andrés Illanes Albornoz (arab, vxp) 9ba5d3
		elif [ "${3}" = native ]; 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
Lucio Andrés Illanes Albornoz (arab, vxp) 9ba5d3
		if [ "${3}" = stage1 ]; then
lalbornoz 340f4c
			make ${MAKEFLAGS} install-gcc;
Lucio Andrés Illanes Albornoz (arab, vxp) 41d5cc
			if match_uname_any CYGWIN\*; then
Lucio Andrés Illanes Albornoz (arab, vxp) 41d5cc
				ln -s ${PREFIX}/libexec/gcc/${TARGET}/${PKG_GCC_VERSION}/liblto_plugin.dll.a	\
Lucio Andrés Illanes Albornoz (arab, vxp) 41d5cc
					ln -s ${PREFIX}/libexec/gcc/${TARGET}/${PKG_GCC_VERSION}/liblto_plugin.so;
Lucio Andrés Illanes Albornoz (arab, vxp) 41d5cc
			fi;
Lucio Andrés Illanes Albornoz (arab, vxp) 9ba5d3
		elif [ "${3}" = native ]; 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