# Toolchain packages are built for /usr, not PREFIX: they are build
# layers, which always sit at /usr (BUILD_DESIGN.txt section 13), and
# on the running system gcc finds its parts relative to itself.
# ld also searches /glacier/sys/links/lib, where extra's libraries are.
T=x86_64-everest-linux-musl

configure() {
	mkdir -p build && cd build
	../configure --prefix=/usr --build=$T --host=$T --target=$T \
		--disable-nls --disable-werror --disable-multilib \
		--enable-deterministic-archives --enable-ld=default \
		--enable-plugins --enable-64-bit-bfd --disable-gprofng \
		--disable-gdb --disable-gdbserver --disable-sim \
		--with-system-zlib --without-zstd \
		--with-lib-path=/usr/lib:/glacier/sys/links/lib
}

compile() { make; }

package() {
	make DESTDIR="$DESTDIR" install-strip
	rm -f "$DESTDIR/usr/share/info/dir"
}
