cross_tools: allow specifying a custom sysroot path

* Use with --sysroot /path/to/sysroot; useful for CI
  environments and cross-building.

Change-Id: I27a93a5d209cd5324591587e85fce9b47c18172d
Reviewed-on: https://review.haiku-os.org/c/haiku/+/5318
Tested-by: Commit checker robot <[email protected]>
Reviewed-by: Adrien Destugues <[email protected]>
This commit is contained in:
Jessica Hamilton
2022-06-05 09:08:20 +00:00
committed by Adrien Destugues
parent 8a30322767
commit e9e00b80c0
2 changed files with 15 additions and 2 deletions
+6 -2
View File
@@ -161,7 +161,7 @@ binutilsObjDir="$objDir/binutils"
gccObjDir="$objDir/gcc" gccObjDir="$objDir/gcc"
gdbObjDir="$objDir/gdb" gdbObjDir="$objDir/gdb"
stdcxxObjDir="$objDir/stdcxx" stdcxxObjDir="$objDir/stdcxx"
sysrootDir="$installDir/sysroot" sysrootDir=${HAIKU_USE_SYSROOT:-"$installDir/sysroot"}
tmpIncludeDir="$sysrootDir/boot/system/develop/headers" tmpIncludeDir="$sysrootDir/boot/system/develop/headers"
tmpLibDir="$sysrootDir/boot/system/develop/lib" tmpLibDir="$sysrootDir/boot/system/develop/lib"
@@ -279,7 +279,11 @@ mv "$installDir/$haikuMachine/lib/libstdc++.a" \
"$installDir/$haikuMachine/lib/libstdc++-static.a" "$installDir/$haikuMachine/lib/libstdc++-static.a"
# remove the sysroot dir # remove the sysroot dir
rm -rf "$sysrootDir" if [ -n "$HAIKU_USE_SYSROOT" ]; then
rm -rf "$sysrootDir"/boot/system/*
else
rm -rf "$sysrootDir"
fi
# remove the objects dir # remove the objects dir
rm -rf "$objDir" rm -rf "$objDir"
Vendored
+9
View File
@@ -67,6 +67,9 @@ options:
on to the make building the build tools. on to the make building the build tools.
--no-downloads Do not download anything. Useful when trying to --no-downloads Do not download anything. Useful when trying to
bootstrap and build Haiku from source only. bootstrap and build Haiku from source only.
--sysroot The location of the cross-compiler sysroot,
primarily for CI environments or cross-compilers
used outside of the Haiku build system.
--target-arch <arch> Haiku only: Specify the target architecture to --target-arch <arch> Haiku only: Specify the target architecture to
build for. Must be one of the architectures of the build for. Must be one of the architectures of the
host system. The installed build tools for that host system. The installed build tools for that
@@ -688,6 +691,11 @@ supportedTargetArchs="
# #
while [ $# -gt 0 ] ; do while [ $# -gt 0 ] ; do
case "$1" in case "$1" in
--sysroot)
assertparam "$1" $#
crossToolsSysroot=$2
shift 2
;;
--bootstrap) --bootstrap)
assertparams "$1" 3 $# assertparams "$1" 3 $#
HOST_HAIKU_PORTER="`absolute_path $2`" HOST_HAIKU_PORTER="`absolute_path $2`"
@@ -1006,6 +1014,7 @@ else
HAIKU_USE_GCC_GRAPHITE_$targetArch` \ HAIKU_USE_GCC_GRAPHITE_$targetArch` \
HAIKU_USE_GCC_PIPE=$HAIKU_USE_GCC_PIPE \ HAIKU_USE_GCC_PIPE=$HAIKU_USE_GCC_PIPE \
HAIKU_USE_GDB="$gdbSources" \ HAIKU_USE_GDB="$gdbSources" \
HAIKU_USE_SYSROOT="$crossToolsSysroot" \
"$script" $scriptArgs "$sourceDir" "$buildCrossTools" \ "$script" $scriptArgs "$sourceDir" "$buildCrossTools" \
"$crossToolsDir" $buildCrossToolsJobs || exit 1 "$crossToolsDir" $buildCrossToolsJobs || exit 1
else else