Blame vars/gcc.vars

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) 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 (arab, vxp) ec19f0
pkgp_gcc_build_dir() {
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
	PKG_BUILD_DIR="${1}-${2}-${PKG_TARGET}";
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
};
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 907bd3
	local __="";
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
	export MAKE="make LIBTOOL=slibtool";
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
	export cbb_target="${PKG_TARGET}";
Lucio Andrés Illanes Albornoz (arab, vxp) 36ab93
	case "${PKG_NAME}" in
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
	gcc_stage1_host)
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
		GCCTARGET_FLAGS="-DIN_TARGET_LIBRARY_BUILD --sysroot=${PREFIX_CROSS} -midata";
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
		export	cbb_neutral_libiberty=no						\
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
			cbb_ldflags_for_target=--sysroot="${PREFIX_CROSS}"			\
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
			cbb_sysroot_for_libgcc="${PREFIX_CROSS}"				\
Lucio Andrés Illanes Albornoz (arab, vxp) d01c02
			cbb_xgcc_for_specs="${PKG_BASE_DIR}/${PKG_BUILD_DIR}/gcc/xgcc"; ;;
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
	gcc_stage1_cross_mingw32)
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
		GCCTARGET_FLAGS="-DIN_TARGET_LIBRARY_BUILD --sysroot=${PREFIX_MINGW32} -midata";
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
		export	cbb_neutral_libiberty=no						\
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
			cbb_ldflags_for_target=--sysroot="${PREFIX_MINGW32}"			\
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
			cbb_sysroot_for_libgcc="${PREFIX_MINGW32}"				\
Lucio Andrés Illanes Albornoz (arab, vxp) d01c02
			cbb_xgcc_for_specs="${PKG_BASE_DIR}/${PKG_BUILD_DIR}/gcc/xgcc"; ;;
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 (arab, vxp) ec19f0
		export	cbb_neutral_libiberty=no						\
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
			cbb_ldflags_for_target=--sysroot="${PKG_PREFIX}"			\
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) ec19f0
	gcc_full)
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
		GCCTARGET_FLAGS="-DIN_TARGET_LIBRARY_BUILD --sysroot=${PKG_PREFIX} -midata";
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
		export	cbb_xgcc_for_specs="${PKG_TARGET}-gcc"					\
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
			cbb_ldflags_for_target=--sysroot="${PKG_PREFIX}"			\
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
			cbb_sysroot_for_libgcc="${PKG_PREFIX}"					\
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 (arab, vxp) ec19f0
	GCCFLAGS="${PKG_CFLAGS_CONFIGURE} --include $(readlink -f "${PKG_BASE_DIR}/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) ec19f0
	ex_rtl_fileop rm "${PKG_BASE_DIR}/${PKG_BUILD_DIR}";
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
	ex_rtl_fileop mkdir "${PKG_BASE_DIR}/${PKG_BUILD_DIR}";
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
	ex_rtl_fileop cd "${PKG_BASE_DIR}/${PKG_BUILD_DIR}";
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
	"../cbb-gcc-${PKG_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) ec19f0
	ex_pkg_state_set "${PKG_NAME}" configure -build;
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
};
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
pkg_gcc_stage1_host_all() {
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
	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) ec19f0
pkg_gcc_stage1_cross_mingw32_all() {
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
	ex_rtl_fileop ln_symbolic . "${PKG_PREFIX}/x86_64-w64-mingw32/mingw";
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
	ex_rtl_fileop mkdir "${PKG_DESTDIR}/x86_64-w64-mingw32";
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
	ex_rtl_fileop ln_symbolic . "${PKG_DESTDIR}/x86_64-w64-mingw32/mingw";
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
	mkdir "${PKG_PREFIX}/x86_64-w64-mingw32/include";
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) ec19f0
pkg_gcc_stage1_native_mingw32_all() {
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
	ex_rtl_fileop ln_symbolic . "${PKG_PREFIX}/x86_64-w64-mingw32/mingw";
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
	ex_rtl_fileop mkdir "${PKG_DESTDIR}/x86_64-w64-mingw32";
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
	ex_rtl_fileop ln_symbolic . "${PKG_DESTDIR}/x86_64-w64-mingw32/mingw";
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
	mkdir "${PKG_PREFIX}/x86_64-w64-mingw32/include";
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 907bd3
	local __="" _restart_at="${1}";
Lucio Andrés Illanes Albornoz (arab, vxp) 36ab93
	case "${PKG_NAME}" in
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
	gcc_stage1_host)
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
		pkgp_gcc_build_dir "cbb-gcc-${PKG_VERSION}" cross;
Lucio Andrés Illanes Albornoz (arab, vxp) f93712
		;;
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
	gcc_stage1_cross_mingw32)
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
		pkgp_gcc_build_dir "cbb-gcc-${PKG_VERSION}" mingw32;
Lucio Andrés Illanes Albornoz (arab, vxp) f93712
		;;
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
	gcc_stage1_native_mingw32)
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
		pkgp_gcc_build_dir "cbb-gcc-${PKG_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) 32ad21
	if ! ex_pkg_state_test "${PKG_NAME}" fetch "${_restart_at}"; then
Lucio Andrés Illanes Albornoz (arab, vxp) f9882b
		ex_rtl_fetch_urls_git "${PKG_BASE_DIR}" "cbb-gcc-${PKG_VERSION}=${PKG_GITROOT}/cbb/cbb-gcc-${PKG_VERSION}";
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
		ex_pkg_state_set "${PKG_NAME}" 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 (arab, vxp) d01c02
			patch -b -d "${PKG_BASE_DIR}" -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) ec19f0
		ex_pkg_state_set "${PKG_NAME}" patch -configure;
Lucio Andrés Illanes Albornoz (arab, vxp) d4754c
	fi;
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
	pkgp_gcc_setup_env "${PKG_VERSION}";
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 (arab, vxp) ec19f0
		gcc_stage1_host)
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) ec19f0
				--with-sysroot="${PREFIX_CROSS}"; ;;
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
		gcc_stage1_cross_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) ec19f0
				--with-sysroot="${PREFIX_MINGW32}"	\
Lucio Andrés Illanes Albornoz (arab, vxp) 03a637
				--without-headers; ;;
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 (arab, vxp) 570129
	else
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
		ex_rtl_fileop cd "${PKG_BASE_DIR}/${PKG_BUILD_DIR}";
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 (arab, vxp) 981a63
		make ${PKG_MAKEFLAGS_BUILD} all-gcc;
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
		ex_pkg_state_set "${PKG_NAME}" build -install;
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 (arab, vxp) ec19f0
		pkg_install_subdirs;
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
		ex_pkg_state_set "${PKG_NAME}" 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_host)
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
			make ${PKG_MAKEFLAGS_BUILD} "prefix=${PKG_DESTDIR}" install-gcc; ;;
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
		gcc_stage1_cross_mingw32)
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
			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 (arab, vxp) ec19f0
			make ${PKG_MAKEFLAGS_BUILD} "prefix=${PKG_DESTDIR}" 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) ec19f0
			ex_rtl_fileop ln_symbolic "${PKG_DESTDIR}/libexec/gcc/${PKG_TARGET}/${PKG_VERSION}/liblto_plugin.dll.a"	\
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
				ex_rtl_fileop ln_symbolic "${PKG_DESTDIR}/libexec/gcc/${PKG_TARGET}/${PKG_VERSION}/liblto_plugin.so";
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
		fi;
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
		ex_pkg_state_set "${PKG_NAME}" install_make -install;
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 (arab, vxp) ec19f0
		pkg_install;
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
		ex_pkg_state_set "${PKG_NAME}" 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) ec19f0
pkg_gcc_runtime_host_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) ec19f0
	pkgp_gcc_build_dir "cbb-gcc-${PKG_VERSION}" cross;
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
	ex_rtl_fileop cd "${PKG_BASE_DIR}/${PKG_BUILD_DIR}";
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
	# GCC, compiler runtime.
Lucio Andrés Illanes Albornoz (arab, vxp) 32ad21
	if ! ex_pkg_state_test "${PKG_NAME}" build "${_restart_at}"; then
Lucio Andrés Illanes Albornoz (arab, vxp) 981a63
		make ${PKG_MAKEFLAGS_BUILD} all-target-libgcc;
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
		ex_pkg_state_set "${PKG_NAME}" build -install;
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 (arab, vxp) ec19f0
		pkg_install_subdirs;
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
		ex_pkg_state_set "${PKG_NAME}" 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) ec19f0
		make ${PKG_MAKEFLAGS_BUILD} "prefix=${PKG_DESTDIR}" install-target-libgcc;
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
		ex_pkg_state_set "${PKG_NAME}" 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 (arab, vxp) ec19f0
		pkg_install;
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
		ex_pkg_state_set "${PKG_NAME}" 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) ec19f0
pkg_gcc_libstdcpp_v3_host_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) ec19f0
	pkgp_gcc_build_dir "cbb-gcc-${PKG_VERSION}" cross;
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
	ex_rtl_fileop cd "${PKG_BASE_DIR}/${PKG_BUILD_DIR}";
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
	# GCC, libstdc++-v3.
Lucio Andrés Illanes Albornoz (arab, vxp) 32ad21
	if ! ex_pkg_state_test "${PKG_NAME}" build "${_restart_at}"; then
Lucio Andrés Illanes Albornoz (arab, vxp) 981a63
		make ${PKG_MAKEFLAGS_BUILD} all-target-libstdc++-v3;
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
		ex_pkg_state_set "${PKG_NAME}" build -install;
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 (arab, vxp) ec19f0
		pkg_install_subdirs;
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
		ex_pkg_state_set "${PKG_NAME}" 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) ec19f0
		make ${PKG_MAKEFLAGS_BUILD} "prefix=${PKG_DESTDIR}" install-target-libstdc++-v3;
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
		ex_pkg_state_set "${PKG_NAME}" 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 (arab, vxp) ec19f0
		pkg_install;
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
		ex_pkg_state_set "${PKG_NAME}" 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) ec19f0
pkg_gcc_full_host_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) ec19f0
	pkgp_gcc_build_dir "cbb-gcc-${PKG_VERSION}" cross;
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
	ex_rtl_fileop cd "${PKG_BASE_DIR}/${PKG_BUILD_DIR}";
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
	# GCC, everything else.
Lucio Andrés Illanes Albornoz (arab, vxp) 32ad21
	if ! ex_pkg_state_test "${PKG_NAME}" build "${_restart_at}"; then
Lucio Andrés Illanes Albornoz (arab, vxp) 981a63
		make ${PKG_MAKEFLAGS_BUILD};
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
		ex_pkg_state_set "${PKG_NAME}" build -install;
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 (arab, vxp) ec19f0
		pkg_install_subdirs;
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
		ex_pkg_state_set "${PKG_NAME}" 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) ec19f0
		make ${PKG_MAKEFLAGS_BUILD} "prefix=${PKG_DESTDIR}" install;
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
		ex_pkg_state_set "${PKG_NAME}" 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 (arab, vxp) ec19f0
		pkg_install;
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
		ex_pkg_state_set "${PKG_NAME}" 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) ec19f0
pkg_gcc_full_all() {
Lucio Andrés Illanes Albornoz 907bd3
	local _restart_at="${1}" _configure_host="";
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) 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 (arab, vxp) f9882b
		ex_rtl_fetch_urls_git "${PKG_BASE_DIR}" "cbb-gcc-${PKG_VERSION}=${PKG_GITROOT}/cbb/cbb-gcc-${PKG_VERSION}";
Lucio Andrés Illanes Albornoz (arab, vxp) 0580af
		ex_pkg_state_set "${PKG_NAME}" 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 (arab, vxp) 0580af
			patch -b -d "${PKG_BASE_DIR}" -p0 < "${MIDIPIX_BUILD_PWD}/patches/${PKG_NAME}.local.patch";
Lucio Andrés Illanes Albornoz (arab, vxp) 0580af
		fi;
Lucio Andrés Illanes Albornoz (arab, vxp) 0580af
		ex_pkg_state_set "${PKG_NAME}" patch -configure;
Lucio Andrés Illanes Albornoz (arab, vxp) 0580af
	fi;
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
	pkgp_gcc_setup_env "${PKG_VERSION}";
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) ec19f0
		ex_rtl_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) ec19f0
			ex_rtl_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) ec19f0
		ex_rtl_fileop cd "${PKG_BASE_DIR}/${PKG_BUILD_DIR}";
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 (arab, vxp) 981a63
		make ${PKG_MAKEFLAGS_BUILD} all-gcc;
Lucio Andrés Illanes Albornoz (arab, vxp) 981a63
		make ${PKG_MAKEFLAGS_BUILD} all-target-libgcc;
Lucio Andrés Illanes Albornoz (arab, vxp) 981a63
		make ${PKG_MAKEFLAGS_BUILD} all-target-libstdc++-v3;
Lucio Andrés Illanes Albornoz (arab, vxp) 981a63
		make ${PKG_MAKEFLAGS_BUILD} all;
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
		ex_pkg_state_set "${PKG_NAME}" build -install;
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 (arab, vxp) ec19f0
		pkg_install_subdirs;
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
		ex_pkg_state_set "${PKG_NAME}" 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) ec19f0
		make ${PKG_MAKEFLAGS_BUILD} "prefix=${PKG_DESTDIR}" install;
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
		ex_pkg_state_set "${PKG_NAME}" 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 (arab, vxp) ec19f0
		pkg_install;
Lucio Andrés Illanes Albornoz (arab, vxp) ec19f0
		ex_pkg_state_set "${PKG_NAME}" 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
# vim:filetype=sh