Blame vars/gcc.vars

Lucio Andrés Illanes Albornoz (arab, vxp) 570129
#
Lucio Andrés Illanes Albornoz e1d469
# set +o errexit -o noglob -o nounset is assumed.
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
# Order: stage1_host, runtime_host, libstdcpp_v3_host, full_host, full
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
# Order: stage1_mingw32, native_mingw32
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
#
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
Lucio Andrés Illanes Albornoz b6a9a1
#
Lucio Andrés Illanes Albornoz b6a9a1
# Private subroutines
Lucio Andrés Illanes Albornoz b6a9a1
#
Lucio Andrés Illanes Albornoz 1eec19
pkgp_gcc_build_dir() { PKG_BUILD_DIR="${1}-${2}-${PKG_TARGET}"; };
Lucio Andrés Illanes Albornoz b6a9a1
pkgp_gcc_state_set() {
Lucio Andrés Illanes Albornoz b6a9a1
	printf "step unknown %s %s\n" "${PKG_NAME}" "${1}" >&3;
Lucio Andrés Illanes Albornoz b6a9a1
	ex_pkg_state_set "${PKG_NAME}" ${1} -${2};
Lucio Andrés Illanes Albornoz b6a9a1
};
Lucio Andrés Illanes Albornoz b6a9a1
Lucio Andrés Illanes Albornoz b6a9a1
pkgp_gcc_configure() {
Lucio Andrés Illanes Albornoz b6a9a1
	if ! rtl_fileop rm "${PKG_BASE_DIR}/${PKG_BUILD_DIR}"		\
Lucio Andrés Illanes Albornoz b6a9a1
	|| ! rtl_fileop mkdir "${PKG_BASE_DIR}/${PKG_BUILD_DIR}"	\
Lucio Andrés Illanes Albornoz b6a9a1
	|| ! rtl_fileop cd "${PKG_BASE_DIR}/${PKG_BUILD_DIR}"		\
Lucio Andrés Illanes Albornoz b6a9a1
	|| ! "../cbb-gcc-${PKG_VERSION}/configure" "${@}"		\
Lucio Andrés Illanes Albornoz b6a9a1
			--disable-bootstrap				\
Lucio Andrés Illanes Albornoz b6a9a1
			--disable-libmudflap				\
Lucio Andrés Illanes Albornoz b6a9a1
			--disable-multilib				\
Lucio Andrés Illanes Albornoz b6a9a1
			--disable-nls					\
Lucio Andrés Illanes Albornoz b6a9a1
			--disable-obsolete				\
Lucio Andrés Illanes Albornoz b6a9a1
			--disable-symvers				\
Lucio Andrés Illanes Albornoz b6a9a1
			--enable-canonical-system-headers		\
Lucio Andrés Illanes Albornoz b6a9a1
			--enable-__cxa_atexit				\
Lucio Andrés Illanes Albornoz b6a9a1
			--enable-debug					\
Lucio Andrés Illanes Albornoz b6a9a1
			--enable-gnu-indirect-function			\
Lucio Andrés Illanes Albornoz b6a9a1
			--enable-gnu-unique-object			\
Lucio Andrés Illanes Albornoz b6a9a1
			--enable-initfini-array				\
Lucio Andrés Illanes Albornoz b6a9a1
			--enable-languages=c,c++,fortran,objc,lto	\
Lucio Andrés Illanes Albornoz b6a9a1
			--enable-libstdcxx-debug			\
Lucio Andrés Illanes Albornoz b6a9a1
			--enable-lto					\
Lucio Andrés Illanes Albornoz b6a9a1
			--enable-multiarch				\
Lucio Andrés Illanes Albornoz b6a9a1
			--enable-secureplt				\
Lucio Andrés Illanes Albornoz b6a9a1
			--enable-shared					\
Lucio Andrés Illanes Albornoz b6a9a1
			--enable-threads=posix				\
Lucio Andrés Illanes Albornoz b6a9a1
			--target="${PKG_TARGET}"			\
Lucio Andrés Illanes Albornoz b6a9a1
			--with-fpmath=sse; then
Lucio Andrés Illanes Albornoz b6a9a1
		return 1;
Lucio Andrés Illanes Albornoz b6a9a1
	else
Lucio Andrés Illanes Albornoz b6a9a1
		pkgp_gcc_state_set "configure" -"build";
Lucio Andrés Illanes Albornoz b6a9a1
	fi;
Lucio Andrés Illanes Albornoz b6a9a1
};
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
Lucio Andrés Illanes Albornoz (arab, vxp) d4754c
pkgp_gcc_setup_env() {
Lucio Andrés Illanes Albornoz b6a9a1
	local _vname="";
Lucio Andrés Illanes Albornoz b6a9a1
	for _vname in	CFLAGS CFLAGS_FOR_BUILD CPPFLAGS_FOR_BUILD			\
Lucio Andrés Illanes Albornoz b6a9a1
			CXXFLAGS CXXFLAGS_FOR_BUILD; do
Lucio Andrés Illanes Albornoz b6a9a1
		export "${_vname}=${GCCFLAGS}";
Lucio Andrés Illanes Albornoz b6a9a1
	done;
Lucio Andrés Illanes Albornoz b6a9a1
	for _vname in	CFLAGS_FOR_TARGET CPPFLAGS_FOR_TARGET CXXFLAGS_FOR_TARGET	\
Lucio Andrés Illanes Albornoz b6a9a1
			LIBCFLAGS_FOR_TARGET XGCC_FLAGS_FOR_TARGET; do
Lucio Andrés Illanes Albornoz b6a9a1
		export "${_vname}=${GCCTARGET_FLAGS}";
Lucio Andrés Illanes Albornoz b6a9a1
	done;
Lucio Andrés Illanes Albornoz b6a9a1
	for _vname in	cbb_cflags_for_stage1 cbb_cflags_for_stage2			\
Lucio Andrés Illanes Albornoz b6a9a1
			cbb_cflags_for_stage3 cbb_cflags_for_stage4; do
Lucio Andrés Illanes Albornoz b6a9a1
		export "${_vname}=${CFLAGS_FOR_BUILD}" ;
Lucio Andrés Illanes Albornoz b6a9a1
	done;
Lucio Andrés Illanes Albornoz b6a9a1
};
Lucio Andrés Illanes Albornoz b6a9a1
Lucio Andrés Illanes Albornoz b6a9a1
pkgp_gcc_setup_vars() {
Lucio Andrés Illanes Albornoz b6a9a1
	local _unwind_midipix_h="";
Lucio Andrés Illanes Albornoz b6a9a1
	export cbb_target="${PKG_TARGET}" MAKE="make LIBTOOL=slibtool";
Lucio Andrés Illanes Albornoz b6a9a1
	_unwind_midipix_h="$(readlink -f "${PKG_BASE_DIR}/cbb-gcc-${PKG_VERSION}/gcc/unwind-midipix.h")";
Lucio Andrés Illanes Albornoz (arab, vxp) 36ab93
	case "${PKG_NAME}" in
Lucio Andrés Illanes Albornoz b6a9a1
	gcc_full)
Lucio Andrés Illanes Albornoz b6a9a1
		GCCTARGET_FLAGS="-DIN_TARGET_LIBRARY_BUILD --sysroot=${PKG_PREFIX}";
Lucio Andrés Illanes Albornoz b6a9a1
		GCCTARGET_FLAGS="$(rtl_lconcat "${GCCTARGET_FLAGS}" "--include=${_unwind_midipix_h}")";
Lucio Andrés Illanes Albornoz b6a9a1
		GCCTARGET_FLAGS="$(rtl_lconcat "${GCCTARGET_FLAGS}" "-DTARGET_PERSONALITY_FUNCTION")";
Lucio Andrés Illanes Albornoz b6a9a1
		GCCTARGET_FLAGS="$(rtl_lconcat "${GCCTARGET_FLAGS}" "-DTARGET_PERSONALITY_FUNCTION_MIDIPIX")";
Lucio Andrés Illanes Albornoz b6a9a1
		GCCTARGET_FLAGS="$(rtl_lconcat "${GCCTARGET_FLAGS}" "${DEFAULT_CFLAGS_DEBUG_RUNTIME}")";
Lucio Andrés Illanes Albornoz b6a9a1
		export	cbb_ldflags_for_target=--sysroot="${PKG_PREFIX}"			\
Lucio Andrés Illanes Albornoz b6a9a1
			cbb_sysroot_for_libgcc="${PKG_PREFIX}"					\
Lucio Andrés Illanes Albornoz b6a9a1
			cbb_xgcc_for_specs="${PKG_TARGET}-gcc"					\
Lucio Andrés Illanes Albornoz b6a9a1
			sysroot_headers_suffix="${PKG_PREFIX}"; ;;
Lucio Andrés Illanes Albornoz b6a9a1
	gcc_stage1_cross_mingw32)
Lucio Andrés Illanes Albornoz b6a9a1
		GCCTARGET_FLAGS="-DIN_TARGET_LIBRARY_BUILD --sysroot=${PREFIX_MINGW32} -midata";
Lucio Andrés Illanes Albornoz b6a9a1
		export	cbb_ldflags_for_target=--sysroot="${PREFIX_MINGW32}"			\
Lucio Andrés Illanes Albornoz b6a9a1
			cbb_neutral_libiberty=no						\
Lucio Andrés Illanes Albornoz b6a9a1
			cbb_sysroot_for_libgcc="${PREFIX_MINGW32}"				\
Lucio Andrés Illanes Albornoz b6a9a1
			cbb_xgcc_for_specs="${PKG_BASE_DIR}/${PKG_BUILD_DIR}/gcc/xgcc"; ;;
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
	gcc_stage1_host)
Lucio Andrés Illanes Albornoz c2a378
		GCCTARGET_FLAGS="-DIN_TARGET_LIBRARY_BUILD --sysroot=${PREFIX_CROSS}";
Lucio Andrés Illanes Albornoz b6a9a1
		GCCTARGET_FLAGS="$(rtl_lconcat "${GCCTARGET_FLAGS}" "--include=${_unwind_midipix_h}")";
Lucio Andrés Illanes Albornoz b6a9a1
		GCCTARGET_FLAGS="$(rtl_lconcat "${GCCTARGET_FLAGS}" "-DTARGET_PERSONALITY_FUNCTION")";
Lucio Andrés Illanes Albornoz b6a9a1
		GCCTARGET_FLAGS="$(rtl_lconcat "${GCCTARGET_FLAGS}" "-DTARGET_PERSONALITY_FUNCTION_MIDIPIX")";
Lucio Andrés Illanes Albornoz b6a9a1
		GCCTARGET_FLAGS="$(rtl_lconcat "${GCCTARGET_FLAGS}" "${DEFAULT_CFLAGS_DEBUG_RUNTIME}")";
Lucio Andrés Illanes Albornoz b6a9a1
		export	cbb_ldflags_for_target="--sysroot=${PREFIX_CROSS}"			\
Lucio Andrés Illanes Albornoz b6a9a1
			cbb_neutral_libiberty="no"						\
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
			cbb_sysroot_for_libgcc="${PREFIX_CROSS}"				\
Lucio Andrés Illanes Albornoz 292783
			cbb_xgcc_for_specs="${PKG_BASE_DIR}/${PKG_BUILD_DIR}/gcc/xgcc"		\
Lucio Andrés Illanes Albornoz 292783
			LDFLAGS="${PKG_LDFLAGS_CONFIGURE}"; ;;
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
	gcc_stage1_native_mingw32)
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
		GCCTARGET_FLAGS="-DIN_TARGET_LIBRARY_BUILD --sysroot=${PKG_PREFIX} -midata";
Lucio Andrés Illanes Albornoz b6a9a1
		export	cbb_ldflags_for_target=--sysroot="${PKG_PREFIX}"			\
Lucio Andrés Illanes Albornoz b6a9a1
			cbb_neutral_libiberty=no						\
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
			cbb_sysroot_for_libgcc="${PKG_PREFIX}"					\
Lucio Andrés Illanes Albornoz (arab, vxp) 36ab93
			cbb_xgcc_for_specs="${PKG_TARGET}-gcc"; ;;
Lucio Andrés Illanes Albornoz (arab, vxp) f93712
	esac;
Lucio Andrés Illanes Albornoz b6a9a1
	GCCFLAGS="$(rtl_lconcat "${PKG_CFLAGS_CONFIGURE}"					\
Lucio Andrés Illanes Albornoz b6a9a1
		"--include $(readlink -f "${PKG_BASE_DIR}/cbb-gcc-${PKG_VERSION}/libc/cbb-musl-pe.h")")";
Lucio Andrés Illanes Albornoz (arab, vxp) d4754c
};
Lucio Andrés Illanes Albornoz (arab, vxp) d4754c
Lucio Andrés Illanes Albornoz b6a9a1
pkgp_gcc_stage1_all() {
Lucio Andrés Illanes Albornoz b6a9a1
	local _restart_at="${1}" _rc=0;
Lucio Andrés Illanes Albornoz (arab, vxp) 36ab93
	case "${PKG_NAME}" in
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
	gcc_stage1_cross_mingw32)
Lucio Andrés Illanes Albornoz b6a9a1
		pkgp_gcc_build_dir "cbb-gcc-${PKG_VERSION}" mingw32; ;;
Lucio Andrés Illanes Albornoz b6a9a1
	gcc_stage1_host)
Lucio Andrés Illanes Albornoz b6a9a1
		if ! rtl_fileop ln_symbolic . "${PREFIX_CROSS}/usr"\
Lucio Andrés Illanes Albornoz b6a9a1
		|| ! rtl_fileop mkdir "${PREFIX_CROSS}/usr/include"\
Lucio Andrés Illanes Albornoz b6a9a1
		|| ! pkgp_gcc_build_dir "cbb-gcc-${PKG_VERSION}" cross; then
Lucio Andrés Illanes Albornoz b6a9a1
			_rc=1;
Lucio Andrés Illanes Albornoz b6a9a1
		fi; ;;
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
	gcc_stage1_native_mingw32)
Lucio Andrés Illanes Albornoz b6a9a1
		pkgp_gcc_build_dir "cbb-gcc-${PKG_VERSION}" native; ;;
Lucio Andrés Illanes Albornoz (arab, vxp) f93712
	esac;
Lucio Andrés Illanes Albornoz b6a9a1
	if [ "${_rc}" -ne 0 ]; then
Lucio Andrés Illanes Albornoz b6a9a1
		return 1;
Lucio Andrés Illanes Albornoz b6a9a1
	fi;
Lucio Andrés Illanes Albornoz (arab, vxp) 32ad21
	if ! ex_pkg_state_test "${PKG_NAME}" fetch "${_restart_at}"; then
Lucio Andrés Illanes Albornoz 368962
		rtl_fetch_urls_git							\
Lucio Andrés Illanes Albornoz 368962
			"${BUILD_DLCACHEDIR}" "${DEFAULT_GIT_ARGS}" "${PKG_BASE_DIR}"	\
Lucio Andrés Illanes Albornoz 368962
			"${PKG_NAME}" "${PKG_MIRRORS_GIT:-}"				\
Lucio Andrés Illanes Albornoz 368962
			"cbb-gcc-${PKG_VERSION}=${PKG_GITROOT}/cbb/cbb-gcc-${PKG_VERSION}" || return 1;
Lucio Andrés Illanes Albornoz b6a9a1
		pkgp_gcc_state_set "fetch" -"patch";
Lucio Andrés Illanes Albornoz (arab, vxp) 17e78c
	fi;
Lucio Andrés Illanes Albornoz (arab, vxp) 32ad21
	if ! ex_pkg_state_test "${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 b6a9a1
			patch -b -d "${PKG_BASE_DIR}" -p0 < "${MIDIPIX_BUILD_PWD}/patches/${PKG_NAME}.local.patch" || return 1;
Lucio Andrés Illanes Albornoz (arab, vxp) 0f5aa2
		fi;
Lucio Andrés Illanes Albornoz b6a9a1
		pkgp_gcc_state_set "patch" -"configure";
Lucio Andrés Illanes Albornoz (arab, vxp) d4754c
	fi;
Lucio Andrés Illanes Albornoz b6a9a1
	pkgp_gcc_setup_vars; pkgp_gcc_setup_env;
Lucio Andrés Illanes Albornoz (arab, vxp) 32ad21
	if ! ex_pkg_state_test "${PKG_NAME}" configure "${_restart_at}"; then
Lucio Andrés Illanes Albornoz (arab, vxp) 36ab93
		case "${PKG_NAME}" in
Lucio Andrés Illanes Albornoz b6a9a1
		gcc_stage1_cross_mingw32)
Lucio Andrés Illanes Albornoz (arab, vxp) 03a637
			pkgp_gcc_configure				\
Lucio Andrés Illanes Albornoz b6a9a1
				--enable-sjlj-exceptions		\
Lucio Andrés Illanes Albornoz (arab, vxp) 36ab93
				--prefix="${PREFIX}"			\
Lucio Andrés Illanes Albornoz 292783
				--with-gmp="${PREFIX}"			\
Lucio Andrés Illanes Albornoz 292783
				--with-mpc="${PREFIX}"			\
Lucio Andrés Illanes Albornoz 292783
				--with-mpfr="${PREFIX}"			\
Lucio Andrés Illanes Albornoz b6a9a1
				--with-sysroot="${PREFIX_MINGW32}"	\
Lucio Andrés Illanes Albornoz b6a9a1
				--without-headers; ;;
Lucio Andrés Illanes Albornoz b6a9a1
		gcc_stage1_host)
Lucio Andrés Illanes Albornoz (arab, vxp) 03a637
			pkgp_gcc_configure				\
Lucio Andrés Illanes Albornoz b6a9a1
				--disable-sjlj-exceptions		\
Lucio Andrés Illanes Albornoz (arab, vxp) 36ab93
				--prefix="${PREFIX}"			\
Lucio Andrés Illanes Albornoz 292783
				--with-gmp="${PREFIX}"			\
Lucio Andrés Illanes Albornoz 292783
				--with-mpc="${PREFIX}"			\
Lucio Andrés Illanes Albornoz 292783
				--with-mpfr="${PREFIX}"			\
Lucio Andrés Illanes Albornoz b6a9a1
				--with-sysroot="${PREFIX_CROSS}"; ;;
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
		gcc_stage1_native_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 b6a9a1
		if [ "${?}" -ne 0 ]; then
Lucio Andrés Illanes Albornoz b6a9a1
			return 1;
Lucio Andrés Illanes Albornoz b6a9a1
		fi;
Lucio Andrés Illanes Albornoz b6a9a1
	else	rtl_fileop cd "${PKG_BASE_DIR}/${PKG_BUILD_DIR}" || return 1;
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
	fi;
Lucio Andrés Illanes Albornoz (arab, vxp) 32ad21
	if ! ex_pkg_state_test "${PKG_NAME}" build "${_restart_at}"; then
Lucio Andrés Illanes Albornoz b6a9a1
		make ${PKG_MAKEFLAGS_BUILD} "all-gcc" || return 1;
Lucio Andrés Illanes Albornoz b6a9a1
		pkgp_gcc_state_set "build" -"install_subdirs";
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
	fi;
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
	if ! ex_pkg_state_test "${PKG_NAME}" install_subdirs "${_restart_at}"; then
Lucio Andrés Illanes Albornoz b6a9a1
		pkg_install_subdirs || return 1;
Lucio Andrés Illanes Albornoz b6a9a1
		pkgp_gcc_state_set "install_subdirs" -"install_make";
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
	fi;
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
	if ! ex_pkg_state_test "${PKG_NAME}" install_make "${_restart_at}"; then
Lucio Andrés Illanes Albornoz (arab, vxp) 36ab93
		case "${PKG_NAME}" in
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
		gcc_stage1_cross_mingw32)
Lucio Andrés Illanes Albornoz b6a9a1
			make ${PKG_MAKEFLAGS_BUILD} "prefix=${PKG_DESTDIR}" "install-gcc"; ;;
Lucio Andrés Illanes Albornoz b6a9a1
		gcc_stage1_host)
Lucio Andrés Illanes Albornoz b6a9a1
			make ${PKG_MAKEFLAGS_BUILD} "prefix=${PKG_DESTDIR}" "install-gcc"; ;;
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
		gcc_stage1_native_mingw32)
Lucio Andrés Illanes Albornoz b6a9a1
			make ${PKG_MAKEFLAGS_BUILD} "prefix=${PKG_DESTDIR}" "install-gcc"; ;;
Lucio Andrés Illanes Albornoz (arab, vxp) 03a637
		esac;
Lucio Andrés Illanes Albornoz b6a9a1
		if [ "${?}" -ne 0 ]; then
Lucio Andrés Illanes Albornoz b6a9a1
			return 1;
Lucio Andrés Illanes Albornoz b6a9a1
		else	case "$(uname -s)" in
Lucio Andrés Illanes Albornoz b6a9a1
			CYGWIN_*)
Lucio Andrés Illanes Albornoz b6a9a1
				if ! rtl_fileop ln_symbolic "${PKG_DESTDIR}/libexec/gcc/${PKG_TARGET}/${PKG_VERSION}/liblto_plugin.dll.a"\
Lucio Andrés Illanes Albornoz b6a9a1
				|| ! rtl_fileop ln_symbolic "${PKG_DESTDIR}/libexec/gcc/${PKG_TARGET}/${PKG_VERSION}/liblto_plugin.so"; then
Lucio Andrés Illanes Albornoz b6a9a1
					return 1;
Lucio Andrés Illanes Albornoz b6a9a1
				fi; ;;
Lucio Andrés Illanes Albornoz b6a9a1
			esac;
Lucio Andrés Illanes Albornoz b6a9a1
			pkgp_gcc_state_set "install_make" -"install";
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
		fi;
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
	fi;
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
	if ! ex_pkg_state_test "${PKG_NAME}" install "${_restart_at}"; then
Lucio Andrés Illanes Albornoz b6a9a1
		pkg_install || return 1;
Lucio Andrés Illanes Albornoz b6a9a1
		pkgp_gcc_state_set "install" -"finish";
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
	fi;
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
};
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
pkg_gcc_full_all() {
Lucio Andrés Illanes Albornoz b6a9a1
	local _restart_at="${1}" _configure_host="" _vis_hide="vis_hide=-fvisibility=hidden";
Lucio Andrés Illanes Albornoz 3c2739
	export MAKE="make LIBTOOL=slibtool ${_vis_hide}";
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
	pkgp_gcc_build_dir "cbb-gcc-${PKG_VERSION}" native;
Lucio Andrés Illanes Albornoz (arab, vxp) 0580af
	if ! ex_pkg_state_test "${PKG_NAME}" fetch "${_restart_at}"; then
Lucio Andrés Illanes Albornoz 368962
		rtl_fetch_urls_git					\
Lucio Andrés Illanes Albornoz 368962
			"${BUILD_DLCACHEDIR}" "${DEFAULT_GIT_ARGS}"	\
Lucio Andrés Illanes Albornoz 368962
			"${PKG_BASE_DIR}" "${PKG_NAME}"			\
Lucio Andrés Illanes Albornoz 368962
			"${PKG_MIRRORS_GIT:-}"				\
Lucio Andrés Illanes Albornoz 368962
			"cbb-gcc-${PKG_VERSION}=${PKG_GITROOT}/cbb/cbb-gcc-${PKG_VERSION}" || return 1;
Lucio Andrés Illanes Albornoz b6a9a1
		pkgp_gcc_state_set "fetch" -"patch";
Lucio Andrés Illanes Albornoz (arab, vxp) 0580af
	fi;
Lucio Andrés Illanes Albornoz (arab, vxp) 0580af
	if ! ex_pkg_state_test "${PKG_NAME}" patch "${_restart_at}"; then
Lucio Andrés Illanes Albornoz (arab, vxp) 0580af
		if [ -e "${MIDIPIX_BUILD_PWD}/patches/${PKG_NAME}.local.patch" ]; then
Lucio Andrés Illanes Albornoz b6a9a1
			patch -b -d "${PKG_BASE_DIR}" -p0 < "${MIDIPIX_BUILD_PWD}/patches/${PKG_NAME}.local.patch" || return 1;
Lucio Andrés Illanes Albornoz (arab, vxp) 0580af
		fi;
Lucio Andrés Illanes Albornoz b6a9a1
		pkgp_gcc_state_set "patch" -"configure";
Lucio Andrés Illanes Albornoz (arab, vxp) 0580af
	fi;
Lucio Andrés Illanes Albornoz e1d469
	pkgp_gcc_setup_vars; pkgp_gcc_setup_env;
Lucio Andrés Illanes Albornoz (arab, vxp) 32ad21
	if ! ex_pkg_state_test "${PKG_NAME}" configure "${_restart_at}"; then
Lucio Andrés Illanes Albornoz b6a9a1
		rtl_fileop mkdir "${PKG_PREFIX}/${PKG_TARGET}" || return 1;
Lucio Andrés Illanes Albornoz (arab, vxp) 36ab93
		if [ \! -d "${PKG_PREFIX}/${PKG_TARGET}/usr" ]; then
Lucio Andrés Illanes Albornoz b6a9a1
			rtl_fileop ln_symbolic . "${PKG_PREFIX}/${PKG_TARGET}/usr" || return 1;
Lucio Andrés Illanes Albornoz (arab, vxp) d4754c
		fi;
Lucio Andrés Illanes Albornoz b6a9a1
		case "${ARCH}" in
Lucio Andrés Illanes Albornoz b6a9a1
		nt32)	_configure_host="i686-nt32-midipix"; ;;
Lucio Andrés Illanes Albornoz b6a9a1
		nt64)	_configure_host="x86_64-nt64-midipix"; ;;
Lucio Andrés Illanes Albornoz b6a9a1
		esac;
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 b6a9a1
			--with-sysroot="" || return 1;
Lucio Andrés Illanes Albornoz b6a9a1
	else	rtl_fileop cd "${PKG_BASE_DIR}/${PKG_BUILD_DIR}" || return 1;
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
	fi;
Lucio Andrés Illanes Albornoz (arab, vxp) 32ad21
	if ! ex_pkg_state_test "${PKG_NAME}" build "${_restart_at}"; then
Lucio Andrés Illanes Albornoz b6a9a1
		if ! make ${PKG_MAKEFLAGS_BUILD} "all-gcc"\
Lucio Andrés Illanes Albornoz b6a9a1
		|| ! make ${PKG_MAKEFLAGS_BUILD} "all-target-libgcc" ${_vis_hide}\
Lucio Andrés Illanes Albornoz b6a9a1
		|| ! make ${PKG_MAKEFLAGS_BUILD} "all-target-libstdc++-v3"\
Lucio Andrés Illanes Albornoz b6a9a1
		|| ! make ${PKG_MAKEFLAGS_BUILD} "all-target-libgfortran"\
Lucio Andrés Illanes Albornoz b6a9a1
		|| ! make ${PKG_MAKEFLAGS_BUILD} "all"; then
Lucio Andrés Illanes Albornoz b6a9a1
			return 1;
Lucio Andrés Illanes Albornoz b6a9a1
		else	pkgp_gcc_state_set "build" -"install_subdirs";
Lucio Andrés Illanes Albornoz b6a9a1
		fi;
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
	fi;
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
	if ! ex_pkg_state_test "${PKG_NAME}" install_subdirs "${_restart_at}"; then
Lucio Andrés Illanes Albornoz b6a9a1
		pkg_install_subdirs || return 1;
Lucio Andrés Illanes Albornoz b6a9a1
		pkgp_gcc_state_set "install_subdirs" -"install_make";
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
	fi;
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
	if ! ex_pkg_state_test "${PKG_NAME}" install_make "${_restart_at}"; then
Lucio Andrés Illanes Albornoz b6a9a1
		make ${PKG_MAKEFLAGS_BUILD} "prefix=${PKG_DESTDIR}" "install" || return 1;
Lucio Andrés Illanes Albornoz b6a9a1
		pkgp_gcc_state_set "install_make" -"install";
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
	fi;
Lucio Andrés Illanes Albornoz (arab, vxp) 32ad21
	if ! ex_pkg_state_test "${PKG_NAME}" install "${_restart_at}"; then
Lucio Andrés Illanes Albornoz b6a9a1
		pkg_install || return 1; pkgp_gcc_state_set "install" "finish";
Lucio Andrés Illanes Albornoz b6a9a1
	fi;
Lucio Andrés Illanes Albornoz b6a9a1
};
Lucio Andrés Illanes Albornoz b6a9a1
Lucio Andrés Illanes Albornoz b6a9a1
pkg_gcc_full_host_all() {
Lucio Andrés Illanes Albornoz b6a9a1
	local _restart_at="${1}";
Lucio Andrés Illanes Albornoz b6a9a1
	export MAKE="make LIBTOOL=slibtool";
Lucio Andrés Illanes Albornoz b6a9a1
	if ! pkgp_gcc_build_dir "cbb-gcc-${PKG_VERSION}" cross\
Lucio Andrés Illanes Albornoz b6a9a1
	|| ! rtl_fileop cd "${PKG_BASE_DIR}/${PKG_BUILD_DIR}"; then
Lucio Andrés Illanes Albornoz b6a9a1
		return 1;
Lucio Andrés Illanes Albornoz b6a9a1
	else	if ! ex_pkg_state_test "${PKG_NAME}" build "${_restart_at}"; then
Lucio Andrés Illanes Albornoz b6a9a1
			make ${PKG_MAKEFLAGS_BUILD} || return 1;
Lucio Andrés Illanes Albornoz b6a9a1
			pkgp_gcc_state_set "build" -"install_subdirs";
Lucio Andrés Illanes Albornoz b6a9a1
		fi;
Lucio Andrés Illanes Albornoz b6a9a1
		if ! ex_pkg_state_test "${PKG_NAME}" install_subdirs "${_restart_at}"; then
Lucio Andrés Illanes Albornoz b6a9a1
			pkg_install_subdirs || return 1;
Lucio Andrés Illanes Albornoz b6a9a1
			pkgp_gcc_state_set "install_subdirs" -"install_make";
Lucio Andrés Illanes Albornoz b6a9a1
		fi;
Lucio Andrés Illanes Albornoz b6a9a1
		if ! ex_pkg_state_test "${PKG_NAME}" install_make "${_restart_at}"; then
Lucio Andrés Illanes Albornoz b6a9a1
			make ${PKG_MAKEFLAGS_BUILD} "prefix=${PKG_DESTDIR}" "install" || return 1;
Lucio Andrés Illanes Albornoz b6a9a1
			pkgp_gcc_state_set "install_make" -"install";
Lucio Andrés Illanes Albornoz b6a9a1
		fi;
Lucio Andrés Illanes Albornoz b6a9a1
		if ! ex_pkg_state_test "${PKG_NAME}" install "${_restart_at}"; then
Lucio Andrés Illanes Albornoz b6a9a1
			pkg_install || return 1;
Lucio Andrés Illanes Albornoz b6a9a1
			pkgp_gcc_state_set "install" "finish";
Lucio Andrés Illanes Albornoz b6a9a1
		fi;
Lucio Andrés Illanes Albornoz b6a9a1
	fi;
Lucio Andrés Illanes Albornoz b6a9a1
};
Lucio Andrés Illanes Albornoz b6a9a1
Lucio Andrés Illanes Albornoz b6a9a1
pkg_gcc_libstdcpp_v3_host_all() {
Lucio Andrés Illanes Albornoz b6a9a1
	local _restart_at="${1}";
Lucio Andrés Illanes Albornoz b6a9a1
	export MAKE="make LIBTOOL=slibtool";
Lucio Andrés Illanes Albornoz b6a9a1
	if ! pkgp_gcc_build_dir "cbb-gcc-${PKG_VERSION}" cross\
Lucio Andrés Illanes Albornoz b6a9a1
	|| ! rtl_fileop cd "${PKG_BASE_DIR}/${PKG_BUILD_DIR}"; then
Lucio Andrés Illanes Albornoz b6a9a1
		return 1;
Lucio Andrés Illanes Albornoz b6a9a1
	else	if ! ex_pkg_state_test "${PKG_NAME}" build "${_restart_at}"; then
Lucio Andrés Illanes Albornoz b6a9a1
			make ${PKG_MAKEFLAGS_BUILD} "all-target-libstdc++-v3" || return 1;
Lucio Andrés Illanes Albornoz b6a9a1
			pkgp_gcc_state_set "build" -"install_subdirs";
Lucio Andrés Illanes Albornoz b6a9a1
		fi;
Lucio Andrés Illanes Albornoz b6a9a1
		if ! ex_pkg_state_test "${PKG_NAME}" install_subdirs "${_restart_at}"; then
Lucio Andrés Illanes Albornoz b6a9a1
			pkg_install_subdirs || return 1;
Lucio Andrés Illanes Albornoz b6a9a1
			pkgp_gcc_state_set "install_subdirs" -"install_make";
Lucio Andrés Illanes Albornoz b6a9a1
		fi;
Lucio Andrés Illanes Albornoz b6a9a1
		if ! ex_pkg_state_test "${PKG_NAME}" install_make "${_restart_at}"; then
Lucio Andrés Illanes Albornoz b6a9a1
			make ${PKG_MAKEFLAGS_BUILD} "prefix=${PKG_DESTDIR}" "install-target-libstdc++-v3" || return 1;
Lucio Andrés Illanes Albornoz b6a9a1
			pkgp_gcc_state_set "install_make" -"install";
Lucio Andrés Illanes Albornoz b6a9a1
		fi;
Lucio Andrés Illanes Albornoz b6a9a1
		if ! ex_pkg_state_test "${PKG_NAME}" install "${_restart_at}"; then
Lucio Andrés Illanes Albornoz b6a9a1
			pkg_install || return 1;
Lucio Andrés Illanes Albornoz b6a9a1
			pkgp_gcc_state_set "install" "finish";
Lucio Andrés Illanes Albornoz b6a9a1
		fi;
Lucio Andrés Illanes Albornoz b6a9a1
	fi;
Lucio Andrés Illanes Albornoz b6a9a1
};
Lucio Andrés Illanes Albornoz b6a9a1
Lucio Andrés Illanes Albornoz b6a9a1
pkg_gcc_runtime_host_all() {
Lucio Andrés Illanes Albornoz b6a9a1
	local _restart_at="${1}" _vis_hide="vis_hide=-fvisibility=hidden";
Lucio Andrés Illanes Albornoz b6a9a1
	export MAKE="make LIBTOOL=slibtool ${_vis_hide}";
Lucio Andrés Illanes Albornoz b6a9a1
	if ! pkgp_gcc_build_dir "cbb-gcc-${PKG_VERSION}" cross\
Lucio Andrés Illanes Albornoz b6a9a1
	|| ! rtl_fileop cd "${PKG_BASE_DIR}/${PKG_BUILD_DIR}"; then
Lucio Andrés Illanes Albornoz b6a9a1
		return 1;
Lucio Andrés Illanes Albornoz b6a9a1
	else	if ! ex_pkg_state_test "${PKG_NAME}" build "${_restart_at}"; then
Lucio Andrés Illanes Albornoz b6a9a1
			make ${PKG_MAKEFLAGS_BUILD} "all-target-libgcc" ${_vis_hide} || return 1;
Lucio Andrés Illanes Albornoz b6a9a1
			pkgp_gcc_state_set "build" -"install_subdirs";
Lucio Andrés Illanes Albornoz b6a9a1
		fi;
Lucio Andrés Illanes Albornoz b6a9a1
		if ! ex_pkg_state_test "${PKG_NAME}" install_subdirs "${_restart_at}"; then
Lucio Andrés Illanes Albornoz b6a9a1
			pkg_install_subdirs || return 1;
Lucio Andrés Illanes Albornoz b6a9a1
			pkgp_gcc_state_set "install_subdirs" -"install_make";
Lucio Andrés Illanes Albornoz b6a9a1
		fi;
Lucio Andrés Illanes Albornoz b6a9a1
		if ! ex_pkg_state_test "${PKG_NAME}" install_make "${_restart_at}"; then
Lucio Andrés Illanes Albornoz b6a9a1
			make ${PKG_MAKEFLAGS_BUILD} "prefix=${PKG_DESTDIR}" "install-target-libgcc" || return 1;
Lucio Andrés Illanes Albornoz b6a9a1
			pkgp_gcc_state_set "install_make" -"install";
Lucio Andrés Illanes Albornoz b6a9a1
		fi;
Lucio Andrés Illanes Albornoz b6a9a1
		if ! ex_pkg_state_test "${PKG_NAME}" install "${_restart_at}"; then
Lucio Andrés Illanes Albornoz b6a9a1
			pkg_install || return 1;
Lucio Andrés Illanes Albornoz b6a9a1
			pkgp_gcc_state_set "install" "finish";
Lucio Andrés Illanes Albornoz b6a9a1
		fi;
Lucio Andrés Illanes Albornoz b6a9a1
	fi;
Lucio Andrés Illanes Albornoz b6a9a1
};
Lucio Andrés Illanes Albornoz b6a9a1
Lucio Andrés Illanes Albornoz b6a9a1
pkg_gcc_stage1_all() {
Lucio Andrés Illanes Albornoz b6a9a1
	pkgp_gcc_stage1_all "${@}";
Lucio Andrés Illanes Albornoz b6a9a1
};
Lucio Andrés Illanes Albornoz b6a9a1
Lucio Andrés Illanes Albornoz b6a9a1
pkg_gcc_stage1_cross_mingw32_all() {
Lucio Andrés Illanes Albornoz b6a9a1
	if ! rtl_fileop ln_symbolic . "${PKG_PREFIX}/x86_64-w64-mingw32/mingw"\
Lucio Andrés Illanes Albornoz b6a9a1
	|| ! rtl_fileop mkdir "${PKG_DESTDIR}/x86_64-w64-mingw32"\
Lucio Andrés Illanes Albornoz b6a9a1
	|| ! rtl_fileop ln_symbolic . "${PKG_DESTDIR}/x86_64-w64-mingw32/mingw"\
Lucio Andrés Illanes Albornoz b6a9a1
	|| ! rtl_fileop mkdir "${PKG_PREFIX}/x86_64-w64-mingw32/include"\
Lucio Andrés Illanes Albornoz b6a9a1
	|| ! pkgp_gcc_stage1_all "${@}"; then
Lucio Andrés Illanes Albornoz b6a9a1
		return 1;
Lucio Andrés Illanes Albornoz b6a9a1
	fi;
Lucio Andrés Illanes Albornoz b6a9a1
};
Lucio Andrés Illanes Albornoz b6a9a1
Lucio Andrés Illanes Albornoz b6a9a1
pkg_gcc_stage1_host_all() {
Lucio Andrés Illanes Albornoz b6a9a1
	pkgp_gcc_stage1_all "${@}";
Lucio Andrés Illanes Albornoz b6a9a1
};
Lucio Andrés Illanes Albornoz b6a9a1
Lucio Andrés Illanes Albornoz b6a9a1
pkg_gcc_stage1_native_mingw32_all() {
Lucio Andrés Illanes Albornoz b6a9a1
	if ! rtl_fileop ln_symbolic . "${PKG_PREFIX}/x86_64-w64-mingw32/mingw"\
Lucio Andrés Illanes Albornoz b6a9a1
	|| ! rtl_fileop mkdir "${PKG_DESTDIR}/x86_64-w64-mingw32"\
Lucio Andrés Illanes Albornoz b6a9a1
	|| ! rtl_fileop ln_symbolic . "${PKG_DESTDIR}/x86_64-w64-mingw32/mingw"\
Lucio Andrés Illanes Albornoz b6a9a1
	|| ! rtl_fileop mkdir "${PKG_PREFIX}/x86_64-w64-mingw32/include"\
Lucio Andrés Illanes Albornoz b6a9a1
	|| ! pkgp_gcc_stage1_all "${@}"; then
Lucio Andrés Illanes Albornoz b6a9a1
		return 1;
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
	fi;
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
};
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
Lucio Andrés Illanes Albornoz bf9edf
# vim:filetype=sh textwidth=0