midipix / build / midipix_build

Forked from build/midipix_build 4 years ago
Clone

Blame 009.gcc.full.build

Lucio Andrés Illanes Albornoz (arab, vxp) 1d0876
#
Lucio Andrés Illanes Albornoz (arab, vxp) 820be1
# . ./build.vars and set -o errexit -o noglob 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) 990c25
||   [ "${3}" = libstdc++-v3 ]\
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) 806c98
	elif [ "${3}" = libstdc++-v3 ]; then
Lucio Andrés Illanes Albornoz (arab, vxp) 806c98
		# GCC, libstdc++-v3.
Lucio Andrés Illanes Albornoz (arab, vxp) 806c98
		if ! is_build_script_done build; then
lalbornoz 340f4c
			make ${MAKEFLAGS} all-target-libstdc++-v3;
Lucio Andrés Illanes Albornoz (arab, vxp) 806c98
			set_build_script_done build -install;
lalbornoz 340f4c
		fi;
Lucio Andrés Illanes Albornoz (arab, vxp) 806c98
		if ! is_build_script_done install; then
lalbornoz 340f4c
			make ${MAKEFLAGS} install-target-libstdc++-v3;
Lucio Andrés Illanes Albornoz (arab, vxp) 806c98
			set_build_script_done install finish;
lalbornoz 340f4c
		fi;
Lucio Andrés Illanes Albornoz (arab, vxp) 806c98
	elif [ "${3}" = full ]; then
Lucio Andrés Illanes Albornoz (arab, vxp) 806c98
		# GCC, everything else.
Lucio Andrés Illanes Albornoz (arab, vxp) 806c98
		if ! is_build_script_done build; then
lalbornoz 340f4c
			make ${MAKEFLAGS};
Lucio Andrés Illanes Albornoz (arab, vxp) 806c98
			set_build_script_done build -install;
lalbornoz 340f4c
		fi;
Lucio Andrés Illanes Albornoz (arab, vxp) 806c98
		if ! is_build_script_done install; then
lalbornoz 340f4c
			make ${MAKEFLAGS} install;
Lucio Andrés Illanes Albornoz (arab, vxp) 806c98
			set_build_script_done install 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) 820be1
		export	cbb_ldflags_for_target=--sysroot=${PKG_PREFIX}	\
Lucio Andrés Illanes Albornoz (arab, vxp) 820be1
			cbb_sysroot_for_libgcc=${PKG_PREFIX}		\
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) 820be1
		GCCTARGET_FLAGS="-DIN_TARGET_LIBRARY_BUILD --sysroot=${PKG_PREFIX}";
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) 820be1
		export 	cbb_ldflags_for_target=--sysroot=${PKG_PREFIX}	\
Lucio Andrés Illanes Albornoz (arab, vxp) 820be1
			cbb_sysroot_for_libgcc=${PKG_PREFIX}		\
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) 820be1
		GCCTARGET_FLAGS="-DIN_TARGET_LIBRARY_BUILD --sysroot=${PKG_PREFIX}";
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) 820be1
			mkdir -p -- ${PKG_PREFIX}/include;
Lucio Andrés Illanes Albornoz (arab, vxp) 820be1
			[ \! -d ${PKG_PREFIX}/usr ] &&			\
Lucio Andrés Illanes Albornoz (arab, vxp) 820be1
				ln -s -- . ${PKG_PREFIX}/usr;
Lucio Andrés Illanes Albornoz (arab, vxp) 820be1
			_configure_args="--prefix=${PREFIX} --with-sysroot=${PKG_PREFIX}";
Lucio Andrés Illanes Albornoz (arab, vxp) 9ba5d3
		elif [ "${3}" = native ]; then
Lucio Andrés Illanes Albornoz (arab, vxp) 820be1
			mkdir -p -- ${PKG_PREFIX}/${TARGET};
Lucio Andrés Illanes Albornoz (arab, vxp) 820be1
			if [ \! -d ${PKG_PREFIX}/${TARGET}/usr ]; then
Lucio Andrés Illanes Albornoz (arab, vxp) 820be1
				ln -s -- . ${PKG_PREFIX}/${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) 820be1
				--with-elf=${PKG_PREFIX}	\
Lucio Andrés Illanes Albornoz (arab, vxp) 820be1
				--with-gmp=${PKG_PREFIX}	\
Lucio Andrés Illanes Albornoz (arab, vxp) 820be1
				--with-mpc=${PKG_PREFIX}	\
Lucio Andrés Illanes Albornoz (arab, vxp) 820be1
				--with-mpfr=${PKG_PREFIX}	\
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) 820be1
				ln -s -- ${PREFIX}/libexec/gcc/${TARGET}/${PKG_GCC_VERSION}/liblto_plugin.dll.a	\
Lucio Andrés Illanes Albornoz (arab, vxp) 820be1
					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) 820be1
			make ${MAKEFLAGS} DESTDIR=${PKG_PREFIX} 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