mirror of
https://review.haiku-os.org/haiku
synced 2024-11-23 07:18:40 +01:00
configure: allow building GDB along with the buildtools
from a stock GDB source tree. I was getting tired of doing it manually. Note the prefix is not exactly the same as the buildtools since the machine triplet is different, but it's not an issue. Tested with arm and ppc with GDB 7.8. Might need patching gdbTarget for other archs, as stock GDB doesn't know about Haiku.
This commit is contained in:
parent
96c72d6933
commit
4da6cf8403
@ -15,15 +15,18 @@ buildToolsDir=$3
|
||||
installDir=$4
|
||||
shift 4
|
||||
additionalMakeArgs=$*
|
||||
gdbSourceDir="$HAIKU_USE_GDB"
|
||||
|
||||
ccFlags="-O2"
|
||||
cxxFlags="-O2"
|
||||
binutilsTargets="$haikuMachine"
|
||||
gdbTarget="$haikuMachine"
|
||||
case $haikuMachine in
|
||||
i586-*)
|
||||
binutilsConfigureArgs="--disable-multilib"
|
||||
gccConfigureArgs="--disable-multilib"
|
||||
binutilsTargets="$binutilsTargets,i386-efi-pe,x86_64-efi-pe"
|
||||
gdbConfigureArgs="--disable-multilib"
|
||||
;;
|
||||
x86_64-*)
|
||||
# GCC's default is to enable multilib, but there is a bug when
|
||||
@ -31,10 +34,12 @@ x86_64-*)
|
||||
# failure
|
||||
binutilsConfigureArgs=""
|
||||
binutilsTargets="$binutilsTargets,i386-efi-pe,x86_64-efi-pe"
|
||||
gdbConfigureArgs="--disable-multilib"
|
||||
;;
|
||||
m68k-*)
|
||||
binutilsConfigureArgs="--enable-multilib"
|
||||
gccConfigureArgs="--enable-multilib"
|
||||
gdbConfigureArgs="--disable-multilib"
|
||||
;;
|
||||
arm-*)
|
||||
# Multilib creates a lot of confusion as the wrong libs end up being linked.
|
||||
@ -47,15 +52,20 @@ arm-*)
|
||||
# TODO: Disable building with TLS support for ARM until implemented.
|
||||
binutilsConfigureArgs="$binutilsConfigureArgs --disable-tls"
|
||||
gccConfigureArgs="$gccConfigureArgs --disable-tls"
|
||||
gdbConfigureArgs="--disable-multilib --disable-werror -enable-interwork"
|
||||
gdbTarget="arm-unknown-elf"
|
||||
;;
|
||||
powerpc-*)
|
||||
binutilsConfigureArgs="--disable-multilib"
|
||||
gccConfigureArgs="--disable-multilib"
|
||||
binutilsTargets="$binutilsTargets,powerpc-apple-linux,powerpc-apple-freebsd,powerpc-apple-vxworks"
|
||||
gdbConfigureArgs="--disable-multilib --disable-werror"
|
||||
gdbTarget="powerpc-unknown-elf"
|
||||
;;
|
||||
*)
|
||||
binutilsConfigureArgs="--disable-multilib"
|
||||
gccConfigureArgs="--disable-multilib"
|
||||
gdbConfigureArgs="--disable-multilib"
|
||||
;;
|
||||
esac
|
||||
|
||||
@ -75,6 +85,11 @@ if [ ! -d "$buildToolsDir" ]; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -n "$gdbSourceDir" -a ! -d "$gdbSourceDir" ]; then
|
||||
echo "No such directory: \"$gdbSourceDir\"" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
|
||||
# create the output dir
|
||||
mkdir -p "$installDir" || exit 1
|
||||
@ -95,6 +110,12 @@ cd "$installDir"
|
||||
installDir=$(pwd)
|
||||
cd "$currentDir"
|
||||
|
||||
if [ -n "$gdbSourceDir" ]; then
|
||||
cd "$gdbSourceDir"
|
||||
gdbSourceDir=$(pwd)
|
||||
cd "$currentDir"
|
||||
fi
|
||||
|
||||
binutilsSourceDir="$buildToolsDir/binutils"
|
||||
gccSourceDir="$buildToolsDir/gcc"
|
||||
|
||||
@ -117,6 +138,7 @@ find "$binutilsSourceDir" "$gccSourceDir" -name \*.info -print0 | xargs -0 touch
|
||||
objDir="${installDir}-build"
|
||||
binutilsObjDir="$objDir/binutils"
|
||||
gccObjDir="$objDir/gcc"
|
||||
gdbObjDir="$objDir/gdb"
|
||||
stdcxxObjDir="$objDir/stdcxx"
|
||||
sysrootDir="$installDir/sysroot"
|
||||
tmpIncludeDir="$sysrootDir/boot/system/develop/headers"
|
||||
@ -124,8 +146,8 @@ tmpLibDir="$sysrootDir/boot/system/develop/lib"
|
||||
|
||||
rm -rf "$installDir" "$objDir"
|
||||
|
||||
mkdir -p "$installDir" "$objDir" "$binutilsObjDir" "$gccObjDir" "$stdcxxObjDir" \
|
||||
"$tmpIncludeDir" "$tmpLibDir" || exit 1
|
||||
mkdir -p "$installDir" "$objDir" "$binutilsObjDir" "$gccObjDir" "$gdbObjDir" \
|
||||
"$stdcxxObjDir" "$tmpIncludeDir" "$tmpLibDir" || exit 1
|
||||
mkdir -p "$installDir/lib/gcc/$haikuMachine/$gccVersion"
|
||||
|
||||
if [ "$HAIKU_USE_GCC_GRAPHITE" = 1 ]; then
|
||||
@ -155,6 +177,17 @@ fi
|
||||
# force the POSIX locale, as the build (makeinfo) might choke otherwise
|
||||
export LC_ALL=POSIX
|
||||
|
||||
# build gdb
|
||||
if [ -n "$HAIKU_USE_GDB" ]; then
|
||||
cd "$gdbObjDir"
|
||||
"$gdbSourceDir/configure" \
|
||||
--prefix="$installDir" --target=$gdbTarget \
|
||||
$gdbConfigureArgs \
|
||||
|| exit 1
|
||||
$MAKE $additionalMakeArgs || exit 1
|
||||
$MAKE $additionalMakeArgs install || exit 1
|
||||
fi
|
||||
|
||||
# build binutils
|
||||
cd "$binutilsObjDir"
|
||||
CFLAGS="$ccFlags" CXXFLAGS="$cxxFlags" "$binutilsSourceDir/configure" \
|
||||
|
6
configure
vendored
6
configure
vendored
@ -103,6 +103,9 @@ options:
|
||||
Linux xattr respectively *BSD extattr support to
|
||||
make it more robust (i.e. attribute mix-ups become
|
||||
less likely).
|
||||
--with-gdb <gdb sources dir>
|
||||
specify the path to a GDB source dir, to build
|
||||
GDB for each arch we build the cross-tools for.
|
||||
|
||||
environment variables:
|
||||
CC The host compiler. Defaults to "gcc".
|
||||
@ -410,6 +413,7 @@ useClang=0
|
||||
useGccGraphiteDefault=0
|
||||
unknownArchIndex=1
|
||||
haikuTargetArchs=
|
||||
gdbSources=
|
||||
|
||||
if [ -z "$CC" ]; then
|
||||
CC=gcc
|
||||
@ -618,6 +622,7 @@ while [ $# -gt 0 ] ; do
|
||||
--use-32bit) HAIKU_HOST_USE_32BIT=1; shift 1;;
|
||||
--use-xattr) HAIKU_HOST_USE_XATTR=1; shift 1;;
|
||||
--use-xattr-ref) HAIKU_HOST_USE_XATTR_REF=1; shift 1;;
|
||||
--with-gdb) gdbSources=$2; shift 2;;
|
||||
*) echo Invalid argument: \`$1\'; exit 1;;
|
||||
esac
|
||||
done
|
||||
@ -778,6 +783,7 @@ else
|
||||
HAIKU_USE_GCC_GRAPHITE=`get_variable \
|
||||
HAIKU_USE_GCC_GRAPHITE_$targetArch` \
|
||||
HAIKU_USE_GCC_PIPE=$HAIKU_USE_GCC_PIPE \
|
||||
HAIKU_USE_GDB="$gdbSources" \
|
||||
"$script" $scriptArgs "$sourceDir" "$buildCrossTools" \
|
||||
"$crossToolsDir" $buildCrossToolsJobs || exit 1
|
||||
crossToolsPrefix="$crossToolsDir/bin/${targetMachine}-"
|
||||
|
Loading…
Reference in New Issue
Block a user