[haiku-commits] haiku: hrev50605 - build/scripts

  • From: revol@xxxxxxx
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Thu, 20 Oct 2016 11:18:22 +0200 (CEST)

hrev50605 adds 2 changesets to branch 'master'
old head: 9a03f9dcf98d48256b2f3846acd8350a07ae9103
new head: 4da6cf84030728fc2bb07f15a42e631cc827aa9e
overview: 
http://cgit.haiku-os.org/haiku/log/?qt=range&q=4da6cf840307+%5E9a03f9dcf98d

----------------------------------------------------------------------------

96c72d6933c7: typo

4da6cf840307: 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.

                                          [ François Revol <revol@xxxxxxx> ]

----------------------------------------------------------------------------

2 files changed, 42 insertions(+), 3 deletions(-)
build/scripts/build_cross_tools_gcc4 | 39 +++++++++++++++++++++++++++++---
configure                            |  6 +++++

############################################################################

Commit:      96c72d6933c7444eae1343033cfec16ab1fd7605
URL:         http://cgit.haiku-os.org/haiku/commit/?id=96c72d6933c7
Author:      François Revol <revol@xxxxxxx>
Date:        Wed Oct 19 23:43:52 2016 UTC

typo

----------------------------------------------------------------------------

diff --git a/build/scripts/build_cross_tools_gcc4 
b/build/scripts/build_cross_tools_gcc4
index 729540b..9e48b00 100755
--- a/build/scripts/build_cross_tools_gcc4
+++ b/build/scripts/build_cross_tools_gcc4
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# parameters <machine> <haiku sourcedir> <buildtools dir> <isntall dir>
+# parameters <machine> <haiku sourcedir> <buildtools dir> <install dir>
 
 # get and check the parameters
 if [ $# -lt 4 ]; then

############################################################################

Revision:    hrev50605
Commit:      4da6cf84030728fc2bb07f15a42e631cc827aa9e
URL:         http://cgit.haiku-os.org/haiku/commit/?id=4da6cf840307
Author:      François Revol <revol@xxxxxxx>
Date:        Thu Oct 20 00:35:23 2016 UTC

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.

----------------------------------------------------------------------------

diff --git a/build/scripts/build_cross_tools_gcc4 
b/build/scripts/build_cross_tools_gcc4
index 9e48b00..fc46e7b 100755
--- a/build/scripts/build_cross_tools_gcc4
+++ b/build/scripts/build_cross_tools_gcc4
@@ -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" \
diff --git a/configure b/configure
index aadd8f6..1f74243 100755
--- a/configure
+++ b/configure
@@ -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}-"


Other related posts: