Lucio Andrés Illanes Albornoz (arab, vxp) 570129
#
Lucio Andrés Illanes Albornoz (arab, vxp) 802215
# set -o errexit -o noglob are assumed.
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
# Order: stage1, runtime, libstdcpp_v3, full, native
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
# Order: stage1_x86_64_w64_mingw32, native_x86_64_w64_mingw32
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
#
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
Lucio Andrés Illanes Albornoz (arab, vxp) d4754c
pkgp_gcc_setup_env() {
Lucio Andrés Illanes Albornoz (arab, vxp) 802215
	local __;
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
	export MAKE="make LIBTOOL=slibtool";
Lucio Andrés Illanes Albornoz (arab, vxp) 36ab93
	export	cbb_ldflags_for_target=--sysroot="${PKG_PREFIX}"	\
Lucio Andrés Illanes Albornoz (arab, vxp) 36ab93
		cbb_sysroot_for_libgcc="${PKG_PREFIX}"			\
Lucio Andrés Illanes Albornoz (arab, vxp) 36ab93
		cbb_target="${PKG_TARGET}";
Lucio Andrés Illanes Albornoz (arab, vxp) 36ab93
	case "${PKG_NAME}" in
Lucio Andrés Illanes Albornoz (arab, vxp) 03a637
	gcc_stage1)
Lucio Andrés Illanes Albornoz (arab, vxp) 03a637
		export	cbb_neutral_libiberty=no		\
Lucio Andrés Illanes Albornoz (arab, vxp) 36ab93
			cbb_xgcc_for_specs="${WORKDIR}/${PKG_BUILD_DIR}/gcc/xgcc"; ;;
Lucio Andrés Illanes Albornoz (arab, vxp) 03a637
	gcc_stage1_cross_x86_64_w64_mingw32)
Lucio Andrés Illanes Albornoz (arab, vxp) 03a637
		export	cbb_neutral_libiberty=no		\
Lucio Andrés Illanes Albornoz (arab, vxp) 36ab93
			cbb_xgcc_for_specs="${WORKDIR}/${PKG_BUILD_DIR}/gcc/xgcc"; ;;
Lucio Andrés Illanes Albornoz (arab, vxp) 03a637
	gcc_stage1_native_x86_64_w64_mingw32)
Lucio Andrés Illanes Albornoz (arab, vxp) 03a637
		export	cbb_neutral_libiberty=no		\
Lucio Andrés Illanes Albornoz (arab, vxp) 36ab93
			cbb_xgcc_for_specs="${PKG_TARGET}-gcc"; ;;
Lucio Andrés Illanes Albornoz (arab, vxp) 03a637
	gcc_native)
Lucio Andrés Illanes Albornoz (arab, vxp) 36ab93
		export	cbb_xgcc_for_specs="${PKG_TARGET}-gcc"	\
Lucio Andrés Illanes Albornoz (arab, vxp) 36ab93
			sysroot_headers_suffix="${PKG_PREFIX}"; ;;
Lucio Andrés Illanes Albornoz (arab, vxp) f93712
	esac;
Lucio Andrés Illanes Albornoz e9e741
	GCCTARGET_FLAGS="-DIN_TARGET_LIBRARY_BUILD --sysroot=${PKG_PREFIX} -midata";
Lucio Andrés Illanes Albornoz (arab, vxp) 36ab93
	GCCFLAGS="${CFLAGS:+${CFLAGS} }--include $(readlink -f "${WORKDIR}/cbb-gcc-${1}/libc/cbb-musl-pe.h")";
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
	for __ in CFLAGS CFLAGS_FOR_BUILD CPPFLAGS_FOR_BUILD CXXFLAGS CXXFLAGS_FOR_BUILD; do
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
		export "${__}=${GCCFLAGS}";
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
	done;
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
	for __ in CFLAGS_FOR_TARGET CPPFLAGS_FOR_TARGET CXXFLAGS_FOR_TARGET LIBCFLAGS_FOR_TARGET XGCC_FLAGS_FOR_TARGET; do
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
		export "${__}=${GCCTARGET_FLAGS}";
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
	done;
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
	for __ in cbb_cflags_for_stage1 cbb_cflags_for_stage2 cbb_cflags_for_stage3 cbb_cflags_for_stage4; do
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
		export "${__}=${CFLAGS_FOR_BUILD}" ;
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
	done;
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
	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) d4754c
};
Lucio Andrés Illanes Albornoz (arab, vxp) d4754c
Lucio Andrés Illanes Albornoz (arab, vxp) d4754c
pkgp_gcc_configure() {
Lucio Andrés Illanes Albornoz (arab, vxp) d5afb4
	build_fileop rm "${WORKDIR}/${PKG_BUILD_DIR}";
Lucio Andrés Illanes Albornoz (arab, vxp) d5afb4
	build_fileop mkdir "${WORKDIR}/${PKG_BUILD_DIR}";
Lucio Andrés Illanes Albornoz (arab, vxp) d5afb4
	build_fileop cd "${WORKDIR}/${PKG_BUILD_DIR}";
Lucio Andrés Illanes Albornoz (arab, vxp) 36ab93
	"../cbb-gcc-${PKG_GCC_VERSION}/configure" "${@}"\
Lucio Andrés Illanes Albornoz (arab, vxp) d4754c
		--disable-bootstrap			\
Lucio Andrés Illanes Albornoz (arab, vxp) d4754c
		--disable-libmudflap			\
Lucio Andrés Illanes Albornoz (arab, vxp) d4754c
		--disable-multilib			\
Lucio Andrés Illanes Albornoz (arab, vxp) d4754c
		--disable-nls				\
Lucio Andrés Illanes Albornoz (arab, vxp) d4754c
		--disable-obsolete			\
Lucio Andrés Illanes Albornoz (arab, vxp) d4754c
		--disable-symvers			\
Lucio Andrés Illanes Albornoz (arab, vxp) d4754c
		--enable-__cxa_atexit			\
Lucio Andrés Illanes Albornoz (arab, vxp) d4754c
		--enable-canonical-system-headers	\
Lucio Andrés Illanes Albornoz (arab, vxp) d4754c
		--enable-debug				\
Lucio Andrés Illanes Albornoz (arab, vxp) d4754c
		--enable-gnu-indirect-function		\
Lucio Andrés Illanes Albornoz (arab, vxp) d4754c
		--enable-gnu-unique-object		\
Lucio Andrés Illanes Albornoz (arab, vxp) d4754c
		--enable-initfini-array			\
Lucio Andrés Illanes Albornoz (arab, vxp) d4754c
		--enable-languages=c,c++,objc,lto	\
Lucio Andrés Illanes Albornoz (arab, vxp) d4754c
		--enable-libstdcxx-debug		\
Lucio Andrés Illanes Albornoz (arab, vxp) d4754c
		--enable-lto				\
Lucio Andrés Illanes Albornoz (arab, vxp) d4754c
		--enable-multiarch			\
Lucio Andrés Illanes Albornoz (arab, vxp) d4754c
		--enable-secureplt			\
Lucio Andrés Illanes Albornoz (arab, vxp) d4754c
		--enable-shared				\
Lucio Andrés Illanes Albornoz (arab, vxp) d4754c
		--enable-threads=posix			\
Lucio Andrés Illanes Albornoz (arab, vxp) 36ab93
		--target="${PKG_TARGET}"		\
Lucio Andrés Illanes Albornoz (arab, vxp) d4754c
		--with-fpmath=sse;
Lucio Andrés Illanes Albornoz (arab, vxp) 36ab93
	set_build_script_done "${PKG_NAME}" configure -build;
Lucio Andrés Illanes Albornoz (arab, vxp) d4754c
};
Lucio Andrés Illanes Albornoz (arab, vxp) d4754c
Lucio Andrés Illanes Albornoz (arab, vxp) f93712
pkg_gcc_stage1_cross_x86_64_w64_mingw32_all() {
Lucio Andrés Illanes Albornoz (arab, vxp) f93712
	pkg_gcc_stage1_all "${@}";
Lucio Andrés Illanes Albornoz (arab, vxp) f93712
};
Lucio Andrés Illanes Albornoz (arab, vxp) f93712
Lucio Andrés Illanes Albornoz (arab, vxp) f93712
pkg_gcc_stage1_native_x86_64_w64_mingw32_all() {
Lucio Andrés Illanes Albornoz (arab, vxp) d5afb4
	export AR="${TARGET}-ar";
Lucio Andrés Illanes Albornoz (arab, vxp) d5afb4
	export CC="${TARGET}-gcc";
Lucio Andrés Illanes Albornoz (arab, vxp) d5afb4
	export CXX="${TARGET}-g++";
Lucio Andrés Illanes Albornoz (arab, vxp) d5afb4
	export RANLIB="${TARGET}-ranlib";
Lucio Andrés Illanes Albornoz (arab, vxp) d4754c
	pkg_gcc_stage1_all "${@}";
Lucio Andrés Illanes Albornoz (arab, vxp) d4754c
};
Lucio Andrés Illanes Albornoz (arab, vxp) d4754c
Lucio Andrés Illanes Albornoz (arab, vxp) d4754c
pkg_gcc_stage1_all() {
Lucio Andrés Illanes Albornoz (arab, vxp) 36ab93
	local __ _restart_at="${1}";
Lucio Andrés Illanes Albornoz (arab, vxp) 36ab93
	case "${PKG_NAME}" in
Lucio Andrés Illanes Albornoz (arab, vxp) f93712
	gcc_stage1)
Lucio Andrés Illanes Albornoz (arab, vxp) d4754c
		PKG_GCC_VERSION="${PKG_GCC_STAGE1_VERSION}";
Lucio Andrés Illanes Albornoz (arab, vxp) 36ab93
		set_build_dir "cbb-gcc-${PKG_GCC_VERSION}" cross;
Lucio Andrés Illanes Albornoz (arab, vxp) f93712
		;;
Lucio Andrés Illanes Albornoz (arab, vxp) f93712
	gcc_stage1_cross_x86_64_w64_mingw32)
Lucio Andrés Illanes Albornoz (arab, vxp) f93712
		PKG_GCC_VERSION="${PKG_GCC_STAGE1_CROSS_X86_64_W64_MINGW32_VERSION}";
Lucio Andrés Illanes Albornoz (arab, vxp) 36ab93
		set_build_dir "cbb-gcc-${PKG_GCC_VERSION}" cross;
Lucio Andrés Illanes Albornoz (arab, vxp) f93712
		;;
Lucio Andrés Illanes Albornoz (arab, vxp) f93712
	gcc_stage1_native_x86_64_w64_mingw32)
Lucio Andrés Illanes Albornoz (arab, vxp) f93712
		PKG_GCC_VERSION="${PKG_GCC_STAGE1_NATIVE_X86_64_W64_MINGW32_VERSION}";
Lucio Andrés Illanes Albornoz (arab, vxp) 36ab93
		set_build_dir "cbb-gcc-${PKG_GCC_VERSION}" native;
Lucio Andrés Illanes Albornoz (arab, vxp) f93712
		;;
Lucio Andrés Illanes Albornoz (arab, vxp) f93712
	esac;
Lucio Andrés Illanes Albornoz (arab, vxp) d4754c
	# GCC, stage1.
Lucio Andrés Illanes Albornoz (arab, vxp) 36ab93
	if ! is_build_script_done "${PKG_NAME}" fetch "${_restart_at}"; then
Lucio Andrés Illanes Albornoz (arab, vxp) 03a637
		pkg_fetch -git "cbb-gcc-${PKG_GCC_VERSION}=${GITROOT}/cbb/cbb-gcc-${PKG_GCC_VERSION}";
Lucio Andrés Illanes Albornoz (arab, vxp) 17e78c
		set_build_script_done "${PKG_NAME}" fetch -patch;
Lucio Andrés Illanes Albornoz (arab, vxp) 17e78c
	fi;
Lucio Andrés Illanes Albornoz (arab, vxp) 17e78c
	if ! is_build_script_done "${PKG_NAME}" patch "${_restart_at}"; then
Lucio Andrés Illanes Albornoz (arab, vxp) 0f5aa2
		if [ -e "${MIDIPIX_BUILD_PWD}/patches/${PKG_NAME}.local.patch" ]; then
Lucio Andrés Illanes Albornoz (arab, vxp) 0f5aa2
			patch -b -d "${WORKDIR}" -p0 < "${MIDIPIX_BUILD_PWD}/patches/${PKG_NAME}.local.patch";
Lucio Andrés Illanes Albornoz (arab, vxp) 0f5aa2
		fi;
Lucio Andrés Illanes Albornoz (arab, vxp) 17e78c
		set_build_script_done "${PKG_NAME}" patch -configure;
Lucio Andrés Illanes Albornoz (arab, vxp) d4754c
	fi;
Lucio Andrés Illanes Albornoz (arab, vxp) 36ab93
	pkgp_gcc_setup_env "${PKG_GCC_VERSION}";
Lucio Andrés Illanes Albornoz (arab, vxp) 36ab93
	if ! is_build_script_done "${PKG_NAME}" configure "${_restart_at}"; then
Lucio Andrés Illanes Albornoz (arab, vxp) 36ab93
		build_fileop mkdir "${PKG_PREFIX}/include";
Lucio Andrés Illanes Albornoz (arab, vxp) 36ab93
		[ \! -d "${PKG_PREFIX}/usr" ] &&			\
Lucio Andrés Illanes Albornoz (arab, vxp) 36ab93
			build_fileop ln_symbolic . "${PKG_PREFIX}/usr";
Lucio Andrés Illanes Albornoz (arab, vxp) 36ab93
		case "${PKG_NAME}" in
Lucio Andrés Illanes Albornoz (arab, vxp) 03a637
		gcc_stage1)
Lucio Andrés Illanes Albornoz (arab, vxp) 03a637
			pkgp_gcc_configure				\
Lucio Andrés Illanes Albornoz (arab, vxp) 03a637
				--disable-sjlj-exceptions		\
Lucio Andrés Illanes Albornoz (arab, vxp) 36ab93
				--prefix="${PREFIX}"			\
Lucio Andrés Illanes Albornoz (arab, vxp) 36ab93
				--with-sysroot="${PREFIX}/${PKG_TARGET}"; ;;
Lucio Andrés Illanes Albornoz (arab, vxp) 03a637
		gcc_stage1_cross_x86_64_w64_mingw32)
Lucio Andrés Illanes Albornoz (arab, vxp) 03a637
			pkgp_gcc_configure				\
Lucio Andrés Illanes Albornoz (arab, vxp) 03a637
				--enable-sjlj-exceptions		\
Lucio Andrés Illanes Albornoz (arab, vxp) 36ab93
				--prefix="${PREFIX}"			\
Lucio Andrés Illanes Albornoz (arab, vxp) 36ab93
				--with-sysroot="${PREFIX}/${PKG_TARGET}"\
Lucio Andrés Illanes Albornoz (arab, vxp) 03a637
				--without-headers; ;;
Lucio Andrés Illanes Albornoz (arab, vxp) 03a637
		gcc_stage1_native_x86_64_w64_mingw32)
Lucio Andrés Illanes Albornoz (arab, vxp) d4754c
			pkgp_gcc_configure				\
Lucio Andrés Illanes Albornoz (arab, vxp) f93712
				--build=x86_64-unknown-linux-gnu	\
Lucio Andrés Illanes Albornoz (arab, vxp) d4754c
				--enable-sjlj-exceptions		\
Lucio Andrés Illanes Albornoz (arab, vxp) f93712
				--host=x86_64-nt64-midipix		\
Lucio Andrés Illanes Albornoz (arab, vxp) f93712
				--prefix=/				\
Lucio Andrés Illanes Albornoz (arab, vxp) 36ab93
				--with-elf="${PKG_PREFIX}"		\
Lucio Andrés Illanes Albornoz (arab, vxp) 36ab93
				--with-gmp="${PKG_PREFIX}"		\
Lucio Andrés Illanes Albornoz (arab, vxp) 36ab93
				--with-mpc="${PKG_PREFIX}"		\
Lucio Andrés Illanes Albornoz (arab, vxp) 36ab93
				--with-mpfr="${PKG_PREFIX}"		\
Lucio Andrés Illanes Albornoz (arab, vxp) f93712
				--with-sysroot=				\
Lucio Andrés Illanes Albornoz (arab, vxp) 03a637
				--without-headers; ;;
Lucio Andrés Illanes Albornoz (arab, vxp) 03a637
		esac;
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
	else
Lucio Andrés Illanes Albornoz (arab, vxp) d5afb4
		build_fileop cd "${WORKDIR}/${PKG_BUILD_DIR}";
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
	fi;
Lucio Andrés Illanes Albornoz (arab, vxp) 36ab93
	if ! is_build_script_done "${PKG_NAME}" build "${_restart_at}"; then
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
		make ${MAKEFLAGS} all-gcc;
Lucio Andrés Illanes Albornoz (arab, vxp) 36ab93
		set_build_script_done "${PKG_NAME}" build -install;
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
	fi;
Lucio Andrés Illanes Albornoz (arab, vxp) 36ab93
	if ! is_build_script_done "${PKG_NAME}" install "${_restart_at}"; then
Lucio Andrés Illanes Albornoz (arab, vxp) 36ab93
		case "${PKG_NAME}" in
Lucio Andrés Illanes Albornoz (arab, vxp) 03a637
		gcc_stage1)
Lucio Andrés Illanes Albornoz (arab, vxp) 03a637
			make ${MAKEFLAGS} install-gcc; ;;
Lucio Andrés Illanes Albornoz (arab, vxp) 03a637
		gcc_stage1_cross_x86_64_w64_mingw32)
Lucio Andrés Illanes Albornoz (arab, vxp) 03a637
			make ${MAKEFLAGS} install-gcc; ;;
Lucio Andrés Illanes Albornoz (arab, vxp) 03a637
		gcc_stage1_native_x86_64_w64_mingw32)
Lucio Andrés Illanes Albornoz (arab, vxp) 36ab93
			make ${MAKEFLAGS} "DESTDIR=${PKG_PREFIX}" install-gcc; ;;
Lucio Andrés Illanes Albornoz (arab, vxp) 03a637
		esac;
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
		__="$(uname -s)";
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
		if [ "${__#*CYGWIN*}" != "${__}" ]; then
Lucio Andrés Illanes Albornoz (arab, vxp) 36ab93
			build_fileop ln_symbolic "${PREFIX}/libexec/gcc/${PKG_TARGET}/${PKG_GCC_VERSION}/liblto_plugin.dll.a"	\
Lucio Andrés Illanes Albornoz (arab, vxp) 36ab93
				build_fileop ln_symbolic "${PREFIX}/libexec/gcc/${PKG_TARGET}/${PKG_GCC_VERSION}/liblto_plugin.so";
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
		fi;
Lucio Andrés Illanes Albornoz (arab, vxp) 36ab93
		set_build_script_done "${PKG_NAME}" install finish;
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
	fi;
Lucio Andrés Illanes Albornoz (arab, vxp) 802215
	exit 0;
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
};
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
pkg_gcc_runtime_all() {
Lucio Andrés Illanes Albornoz (arab, vxp) 36ab93
	local _restart_at="${1}";
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
	export MAKE="make LIBTOOL=slibtool";
Lucio Andrés Illanes Albornoz (arab, vxp) 36ab93
	set_build_dir "cbb-gcc-${PKG_GCC_RUNTIME_VERSION}" cross;
Lucio Andrés Illanes Albornoz (arab, vxp) d5afb4
	build_fileop cd "${WORKDIR}/${PKG_BUILD_DIR}";
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
	# GCC, compiler runtime.
Lucio Andrés Illanes Albornoz (arab, vxp) 36ab93
	if ! is_build_script_done "${PKG_NAME}" build "${_restart_at}"; then
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
		make ${MAKEFLAGS} all-target-libgcc;
Lucio Andrés Illanes Albornoz (arab, vxp) 36ab93
		set_build_script_done "${PKG_NAME}" build -install;
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
	fi;
Lucio Andrés Illanes Albornoz (arab, vxp) 36ab93
	if ! is_build_script_done "${PKG_NAME}" install "${_restart_at}"; then
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
		make ${MAKEFLAGS} install-target-libgcc;
Lucio Andrés Illanes Albornoz (arab, vxp) 36ab93
		set_build_script_done "${PKG_NAME}" install finish;
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
	fi;
Lucio Andrés Illanes Albornoz (arab, vxp) 802215
	exit 0;
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
};
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
pkg_gcc_libstdcpp_v3_all() {
Lucio Andrés Illanes Albornoz (arab, vxp) 36ab93
	local _restart_at="${1}";
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
	export MAKE="make LIBTOOL=slibtool";
Lucio Andrés Illanes Albornoz (arab, vxp) 36ab93
	set_build_dir "cbb-gcc-${PKG_GCC_LIBSTDCPP_V3_VERSION}" cross;
Lucio Andrés Illanes Albornoz (arab, vxp) d5afb4
	build_fileop cd "${WORKDIR}/${PKG_BUILD_DIR}";
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
	# GCC, libstdc++-v3.
Lucio Andrés Illanes Albornoz (arab, vxp) 36ab93
	if ! is_build_script_done "${PKG_NAME}" build "${_restart_at}"; then
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
		make ${MAKEFLAGS} all-target-libstdc++-v3;
Lucio Andrés Illanes Albornoz (arab, vxp) 36ab93
		set_build_script_done "${PKG_NAME}" build -install;
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
	fi;
Lucio Andrés Illanes Albornoz (arab, vxp) 36ab93
	if ! is_build_script_done "${PKG_NAME}" install "${_restart_at}"; then
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
		make ${MAKEFLAGS} install-target-libstdc++-v3;
Lucio Andrés Illanes Albornoz (arab, vxp) 36ab93
		set_build_script_done "${PKG_NAME}" install finish;
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
	fi;
Lucio Andrés Illanes Albornoz (arab, vxp) 802215
	exit 0;
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
};
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
pkg_gcc_full_all() {
Lucio Andrés Illanes Albornoz (arab, vxp) 36ab93
	local _restart_at="${1}";
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
	export MAKE="make LIBTOOL=slibtool";
Lucio Andrés Illanes Albornoz (arab, vxp) 36ab93
	set_build_dir "cbb-gcc-${PKG_GCC_FULL_VERSION}" cross;
Lucio Andrés Illanes Albornoz (arab, vxp) d5afb4
	build_fileop cd "${WORKDIR}/${PKG_BUILD_DIR}";
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
	# GCC, everything else.
Lucio Andrés Illanes Albornoz (arab, vxp) 36ab93
	if ! is_build_script_done "${PKG_NAME}" build "${_restart_at}"; then
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
		make ${MAKEFLAGS};
Lucio Andrés Illanes Albornoz (arab, vxp) 36ab93
		set_build_script_done "${PKG_NAME}" build -install;
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
	fi;
Lucio Andrés Illanes Albornoz (arab, vxp) 36ab93
	if ! is_build_script_done "${PKG_NAME}" install "${_restart_at}"; then
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
		make ${MAKEFLAGS} install;
Lucio Andrés Illanes Albornoz (arab, vxp) 36ab93
		set_build_script_done "${PKG_NAME}" install finish;
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
	fi;
Lucio Andrés Illanes Albornoz (arab, vxp) 802215
	exit 0;
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
};
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
Lucio Andrés Illanes Albornoz (arab, vxp) d4754c
pkg_gcc_native_all() {
Lucio Andrés Illanes Albornoz (arab, vxp) 36ab93
	local _restart_at="${1}" _configure_host;
Lucio Andrés Illanes Albornoz (arab, vxp) f93712
	PKG_GCC_VERSION="${PKG_GCC_NATIVE_VERSION}";
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
	export MAKE="make LIBTOOL=slibtool";
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
	# GCC, native.
Lucio Andrés Illanes Albornoz (arab, vxp) 36ab93
	set_build_dir "cbb-gcc-${PKG_GCC_VERSION}" native;
Lucio Andrés Illanes Albornoz (arab, vxp) 36ab93
	pkgp_gcc_setup_env "${PKG_GCC_VERSION}";
Lucio Andrés Illanes Albornoz (arab, vxp) 36ab93
	if ! is_build_script_done "${PKG_NAME}" configure "${_restart_at}"; then
Lucio Andrés Illanes Albornoz (arab, vxp) 36ab93
		build_fileop mkdir "${PKG_PREFIX}/${PKG_TARGET}";
Lucio Andrés Illanes Albornoz (arab, vxp) 36ab93
		if [ \! -d "${PKG_PREFIX}/${PKG_TARGET}/usr" ]; then
Lucio Andrés Illanes Albornoz (arab, vxp) 36ab93
			build_fileop ln_symbolic . "${PKG_PREFIX}/${PKG_TARGET}/usr";
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
		fi;
Lucio Andrés Illanes Albornoz (arab, vxp) f93712
		if [ "${ARCH}" = nt32 ]; then
Lucio Andrés Illanes Albornoz (arab, vxp) 36ab93
			_configure_host="i686-nt32-midipix";
Lucio Andrés Illanes Albornoz (arab, vxp) d4754c
		else
Lucio Andrés Illanes Albornoz (arab, vxp) 36ab93
			_configure_host="x86_64-nt64-midipix";
Lucio Andrés Illanes Albornoz (arab, vxp) d4754c
		fi;
Lucio Andrés Illanes Albornoz (arab, vxp) f93712
		pkgp_gcc_configure				\
Lucio Andrés Illanes Albornoz (arab, vxp) f93712
			--disable-sjlj-exceptions		\
Lucio Andrés Illanes Albornoz (arab, vxp) 36ab93
			--host="${_configure_host}"		\
Lucio Andrés Illanes Albornoz (arab, vxp) f93712
			--prefix=/				\
Lucio Andrés Illanes Albornoz (arab, vxp) 36ab93
			--with-elf="${PKG_PREFIX}"		\
Lucio Andrés Illanes Albornoz (arab, vxp) 36ab93
			--with-gmp="${PKG_PREFIX}"		\
Lucio Andrés Illanes Albornoz (arab, vxp) 36ab93
			--with-mpc="${PKG_PREFIX}"		\
Lucio Andrés Illanes Albornoz (arab, vxp) 36ab93
			--with-mpfr="${PKG_PREFIX}"		\
Lucio Andrés Illanes Albornoz (arab, vxp) f93712
			--with-sysroot=;
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
	else
Lucio Andrés Illanes Albornoz (arab, vxp) d5afb4
		build_fileop cd "${WORKDIR}/${PKG_BUILD_DIR}";
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
	fi;
Lucio Andrés Illanes Albornoz (arab, vxp) 36ab93
	if ! is_build_script_done "${PKG_NAME}" build "${_restart_at}"; then
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
		make ${MAKEFLAGS} all-gcc;
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
		make ${MAKEFLAGS} all-target-libgcc;
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
		make ${MAKEFLAGS} all-target-libstdc++-v3;
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
		make ${MAKEFLAGS} all;
Lucio Andrés Illanes Albornoz (arab, vxp) 36ab93
		set_build_script_done "${PKG_NAME}" build -install;
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
	fi;
Lucio Andrés Illanes Albornoz (arab, vxp) 36ab93
	if ! is_build_script_done "${PKG_NAME}" install "${_restart_at}"; then
Lucio Andrés Illanes Albornoz (arab, vxp) 36ab93
		make ${MAKEFLAGS} "DESTDIR=${PKG_PREFIX}" install;
Lucio Andrés Illanes Albornoz (arab, vxp) 36ab93
		set_build_script_done "${PKG_NAME}" install finish;
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
	fi;
Lucio Andrés Illanes Albornoz (arab, vxp) 802215
	exit 0;
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
};
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
# vim:filetype=sh