Compiling HaikuPorts packages for different architecture

I managed to build gcc_bootstrap under Haiku, but some recipe changes were needed. --with-sysroot=/ cause attempting to use Haiku system libraries (mpfr) and fail because of incompatible architecture.

diff --git a/sys-devel/gcc_bootstrap/gcc_bootstrap-8.3.0_2019_05_24.recipe b/sys-devel/gcc_bootstrap/gcc_bootstrap-8.3.0_2019_05_24.recipe
index a44ec01..8d3330a 100644
--- a/sys-devel/gcc_bootstrap/gcc_bootstrap-8.3.0_2019_05_24.recipe
+++ b/sys-devel/gcc_bootstrap/gcc_bootstrap-8.3.0_2019_05_24.recipe
@@ -154,10 +154,10 @@ BUILD()
 		--libexecdir=$installDir/lib --mandir=$manDir --docdir=$docDir \
 		--disable-nls --enable-shared --disable-plugin \
 		--enable-version-specific-runtime-libs \
-		--enable-languages=c,c++ --enable-lto --enable-frame-pointer \
+		--enable-languages=c,c++ --disable-lto --enable-frame-pointer \
 		--enable-threads=posix --enable-tls \
 		--with-pkgversion=$(echo $portVersion | cut -c 7-) \
-		--with-sysroot=/ \
+		--with-sysroot=/boot/data/packages/haiku/generated.riscv64/cross-tools-riscv64 \
 		--with-build-sysroot=$installDestDir/ \
 		--with-threads=posix \
 		--with-default-libstdcxx-abi=gcc4-compatible \
@@ -303,7 +303,7 @@ INSTALL()
 
 	cd $installDestDir$installDir
 	$effectiveTargetMachineTriple-strip --strip-debug bin/*
-	for f in cc1 cc1plus collect2 lto1 lto-wrapper; do
+	for f in cc1 cc1plus collect2 ; do
 		$effectiveTargetMachineTriple-strip --strip-debug \
 			lib/gcc/$effectiveTargetMachineTriple/*/$f
 	done

6 Likes