# Template file for 'cross-powerpc64-linux-gnu'
_binutils_version=2.44
_gcc_version=14.2.1+20250405
_glibc_version=2.41
_linux_version=6.14
pkgname=cross-powerpc64-linux-gnu
version=0.37
revision=2
build_style=void-cross
configure_args="--enable-secureplt --disable-vtable-verify --with-abi=elfv2
 --enable-targets=powerpc-linux --enable-autolink-libatomic"
hostmakedepends="texinfo tar gcc-objc gcc-go gcc-gdc flex perl python3 pkg-config"
makedepends="isl-devel libmpc-devel gmp-devel mpfr-devel
 zlib-devel libzstd-devel"
depends="${pkgname}-libc-${version}_${revision}"
short_desc="Void cross toolchain for ${pkgname/cross-}"
maintainer="Orphaned <orphan@voidlinux.org>"
license="GPL-2.0-or-later, GPL-3.0-or-later, LGPL-2.1-or-later"
homepage="https://www.voidlinux.org/"
case "${_gcc_version}" in
	*+*) distfiles="https://gcc.gnu.org/pub/gcc/snapshots/${_gcc_version%%.*}-${_gcc_version#*+}/gcc-${_gcc_version%%.*}-${_gcc_version#*+}.tar.xz" ;;
	*) distfiles="${GNU_SITE}/gcc/gcc-${_gcc_version}/gcc-${_gcc_version}.tar.xz" ;;
esac
distfiles+=" ${GNU_SITE}/binutils/binutils-${_binutils_version}.tar.xz"
distfiles+=" ${GNU_SITE}/glibc/glibc-${_glibc_version}.tar.xz"
distfiles+=" ${KERNEL_SITE}/kernel/v${_linux_version%%.*}.x/linux-${_linux_version}.tar.xz"
checksum="9a84b0947d8fb18197eef3fce8e255e30a61f7f382cebb961b1705c1d99214a3
 ce2017e059d63e67ddb9240e9d4ec49c2893605035cd60e92ad53177f4377237
 a5a26b22f545d6b7d7b3dd828e11e428f24f4fac43c934fb071b6a7d0828e901
 a294b683e7b161bb0517bb32ec7ed1d2ea7603dfbabad135170ed12d00c47670"
nocross=yes

cross_binutils_configure_args="--enable-secureplt"
cross_gcc_bootstrap_configure_args="--with-long-double-128"
cross_glibc_cflags="-O2"

if [ "$XBPS_TARGET_MACHINE" = "ppc64" ]; then
	broken="Can't build crosstoolchain to itself"
fi

case "$XBPS_MACHINE" in
	ppc64*) ;;
	ppc*|mips*) broken="no gccgo support";;
esac

cross-powerpc64-linux-gnu-libc_package() {
	short_desc+=" - glibc files"
	nostrip=yes
	noverifyrdeps=yes
	noshlibprovides=yes

	pkg_install() {
		vmove usr/${sourcepkg/cross-}
	}
}
