<?xml version="1.0"?>
<package name="riscv64-linux-gnu">
	<description>riscv64-linux-gnu cross-toolchain</description>
	<releases>
		<release version="20260209" revision="1">
			<settings>
				<variable name="BINUTILSVERSION">2.46</variable>
				<variable name="GCCVERSION">15.2.0</variable>
			</settings>
			<deps>
				<dep name="gmp"/>
				<dep name="mpfr"/>
				<dep name="mpc"/>
			</deps>
			<!-- do not strip ARM files with host binutils -->
			<build strip="no">
				<script>
					<archive name="binutils-with-gold-$BINUTILSVERSION" srcdir="binutils-$BINUTILSVERSION" builddir="binutils-build">
						<!-- don't install libiberty.a from cross-toolchain -->
						<cmd>sed -i -e 's/install_to_$(INSTALL_DEST) //' ../binutils-$BINUTILSVERSION/libiberty/Makefile.in</cmd>
						<!-- don't install bfd plugins from cross-toolchain -->
						<cmd>sed -i -e '/^install/s/ install-bfdpluginLTLIBRARIES//' ../binutils-$BINUTILSVERSION/ld/Makefile.in</cmd>

						<cmd>../binutils-$BINUTILSVERSION/configure --host=$TARGET --target=$NAME --with-lib-path=/lib/$NAME:/usr/lib/$NAME:/usr/local/lib/$NAME --disable-nls --disable-werror --disable-gprofng</cmd>
						<cmd>make configure-host</cmd>
						<cmd>make</cmd>
						<cmd>make infodir=$PWD/noinst mandir=$PWD/noinst install</cmd>
					</archive>

					<archive name="gcc-$GCCVERSION" builddir="gcc-build">
						<!-- default to -ftrivial-auto-var-init=zero -->
						<cmd>sed -i -e '/^Common/s/AUTO_INIT_UNINITIALIZED/AUTO_INIT_ZERO/' ../gcc-$GCCVERSION/gcc/common.opt</cmd>
						<cmd>../gcc-$GCCVERSION/configure --host=$TARGET --target=$NAME --enable-languages=c --without-headers --with-slibdir=/usr/lib/$NAME --disable-threads --disable-shared --disable-decimal-float --disable-multilib --disable-nls --disable-bootstrap --with-linker-hash-style=gnu --enable-default-pie --enable-default-ssp --without-zstd</cmd>
						<cmd>make all-gcc</cmd>
						<cmd>make all-target-libgcc</cmd>
						<cmd>make tooldir=$PWD/noinst infodir=$PWD/noinst mandir=$PWD/noinst install-gcc</cmd>
						<cmd>make tooldir=$PWD/noinst infodir=$PWD/noinst mandir=$PWD/noinst install-target-libgcc</cmd>
					</archive>
				</script>
			</build>
		</release>
	</releases>
</package>
