scripts/build/debug/300-gdb.sh
author "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
Mon Feb 02 22:00:18 2009 +0000 (2009-02-02)
changeset 1201 c9967a6e3b25
parent 1112 c72aecd1a9ef
child 1219 2b875ed306c2
permissions -rw-r--r--
Add a patchset for glibc 2_9. Vampirised from the gentoo repository.

/trunk/patches/glibc/2_9/500-ppc-glibc-2.9-atomic.patch | 414 414 0 0 ++++++++++
/trunk/patches/glibc/2_9/140-regex-BZ9697.patch | 111 111 0 0 +++
/trunk/patches/glibc/2_9/190-queue-header-updates.patch | 89 89 0 0 ++
/trunk/patches/glibc/2_9/370-hppa_glibc-2.7-hppa-nptl-carlos.patch | 249 249 0 0 ++++++
/trunk/patches/glibc/2_9/450-alpha-glibc-2.5-no-page-header.patch | 32 32 0 0 +
/trunk/patches/glibc/2_9/270-ldbl-nexttowardf.patch | 68 68 0 0 ++
/trunk/patches/glibc/2_9/330-2.3.3-china.patch | 35 35 0 0 +
/trunk/patches/glibc/2_9/340-new-valencian-locale.patch | 120 120 0 0 +++
/trunk/patches/glibc/2_9/410-2.9-fnmatch.patch | 64 64 0 0 ++
/trunk/patches/glibc/2_9/350-2.4-undefine-__i686.patch | 47 47 0 0 +
/trunk/patches/glibc/2_9/160-i386-x86_64-revert-clone-cfi.patch | 53 53 0 0 +
/trunk/patches/glibc/2_9/420-dont-build-timezone.patch | 19 19 0 0 +
/trunk/patches/glibc/2_9/150-regex-BZ697.patch | 28 28 0 0 +
/trunk/patches/glibc/2_9/290-no-inline-gmon.patch | 38 38 0 0 +
/trunk/patches/glibc/2_9/280-section-comments.patch | 29 29 0 0 +
/trunk/patches/glibc/2_9/180-math-tests.patch | 72 72 0 0 ++
/trunk/patches/glibc/2_9/120-_nss_dns_gethostbyaddr2_r-check-and-adjust-the-buffer-alignment.patch | 35 35 0 0 +
/trunk/patches/glibc/2_9/250-resolv-dynamic.patch | 44 44 0 0 +
/trunk/patches/glibc/2_9/300-2.9-check_native-headers.patch | 22 22 0 0 +
/trunk/patches/glibc/2_9/310-2.3.6-fix-pr631.patch | 50 50 0 0 +
/trunk/patches/glibc/2_9/130-add_prio-macros.patch | 26 26 0 0 +
/trunk/patches/glibc/2_9/260-fadvise64_64.patch | 30 30 0 0 +
/trunk/patches/glibc/2_9/440-alpha-glibc-2.4-xstat.patch | 249 249 0 0 ++++++
/trunk/patches/glibc/2_9/170-2.10-dns-no-gethostbyname4.patch | 35 35 0 0 +
/trunk/patches/glibc/2_9/230-2.3.3-localedef-fix-trampoline.patch | 74 74 0 0 ++
/trunk/patches/glibc/2_9/360-2.8-nscd-one-fork.patch | 45 45 0 0 +
/trunk/patches/glibc/2_9/480-alpha-glibc-2.8-cache-shape.patch | 18 18 0 0 +
/trunk/patches/glibc/2_9/210-2.9-strlen-hack.patch | 109 109 0 0 +++
/trunk/patches/glibc/2_9/320-2.9-assume-pipe2.patch | 59 59 0 0 +
/trunk/patches/glibc/2_9/100-ssp-compat.patch | 193 193 0 0 +++++
/trunk/patches/glibc/2_9/110-respect-env-CPPFLAGS.patch | 30 30 0 0 +
/trunk/patches/glibc/2_9/220-manual-no-perl.patch | 29 29 0 0 +
/trunk/patches/glibc/2_9/390-2.3.3_pre20040117-pt_pax.patch | 35 35 0 0 +
/trunk/patches/glibc/2_9/460-alpha-glibc-2.5-no-asm-elf-header.patch | 38 38 0 0 +
/trunk/patches/glibc/2_9/400-tests-sandbox-libdl-paths.patch | 198 198 0 0 +++++
/trunk/patches/glibc/2_9/240-i386-LOAD_PIC_REG.patch | 23 23 0 0 +
/trunk/patches/glibc/2_9/200-awk-in-C-locale.patch | 23 23 0 0 +
/trunk/patches/glibc/2_9/430-2.7-cross-compile-nptl.patch | 57 57 0 0 +
/trunk/patches/glibc/2_9/380-2.3.6-dl_execstack-PaX-support.patch | 71 71 0 0 ++
/trunk/patches/glibc/2_9/490-ptr-mangling.patch | 114 114 0 0 +++
/trunk/patches/glibc/2_9/470-alpha-glibc-2.8-creat.patch | 19 19 0 0 +
41 files changed, 3094 insertions(+)
     1 # Build script for the gdb debug facility
     2 
     3 do_debug_gdb_suffix() {
     4     case "${CT_GDB_VERSION}" in
     5         snapshot)   ;;
     6         *)          echo "-${CT_GDB_VERSION}";;
     7     esac
     8 }
     9 
    10 do_debug_gdb_parts() {
    11     do_gdb=
    12     do_insight=
    13     do_ncurses=
    14 
    15     if [ "${CT_GDB_CROSS}" = y ]; then
    16         if [ "${CT_GDB_CROSS_INSIGHT}" = "y" ]; then
    17             do_insight=y
    18         else
    19             do_gdb=y
    20         fi
    21     fi
    22 
    23     if [ "${CT_GDB_GDBSERVER}" = "y" ]; then
    24         do_gdb=y
    25     fi
    26 
    27     if [ "${CT_GDB_NATIVE}" = "y" ]; then
    28         do_gdb=y
    29         do_ncurses=y
    30     fi
    31 }
    32 
    33 do_debug_gdb_get() {
    34     do_debug_gdb_parts
    35 
    36     if [ "${do_gdb}" = "y" ]; then
    37         CT_GetFile "gdb$(do_debug_gdb_suffix)"              \
    38                    {ftp,http}://ftp.gnu.org/pub/gnu/gdb     \
    39                    ftp://sources.redhat.com/pub/gdb/{{,old-}releases,snapshots/current}
    40     fi
    41 
    42     if [ "${do_insight}" = "y" ]; then
    43         CT_GetFile "insight-${CT_GDB_VERSION}"                                              \
    44                    ftp://sourceware.org/pub/insight/releases                                \
    45                    {ftp,http}://ftp.twaren.net/Unix/Sourceware/insight/releases             \
    46                    {ftp,http}://ftp.gwdg.de/pub/linux/sources.redhat.com/insight/releases
    47     fi
    48 
    49     if [ "${do_ncurses}" = "y" ]; then
    50         CT_GetFile "ncurses-${CT_NCURSES_VERSION}"          \
    51                    {ftp,http}://ftp.gnu.org/pub/gnu/ncurses \
    52                    ftp://invisible-island.net/ncurses
    53     fi
    54 }
    55 
    56 do_debug_gdb_extract() {
    57     do_debug_gdb_parts
    58 
    59     if [ "${do_gdb}" = "y" ]; then
    60         CT_Extract "gdb$(do_debug_gdb_suffix)"
    61         CT_Patch "gdb$(do_debug_gdb_suffix)"
    62     fi
    63 
    64     if [ "${do_insight}" = "y" ]; then
    65         CT_Extract "insight-${CT_GDB_VERSION}"
    66         CT_Patch "insight-${CT_GDB_VERSION}"
    67     fi
    68 
    69     if [ "${do_ncurses}" = "y" ]; then
    70         CT_Extract "ncurses-${CT_NCURSES_VERSION}"
    71         CT_Patch "ncurses-${CT_NCURSES_VERSION}"
    72     fi
    73 }
    74 
    75 do_debug_gdb_build() {
    76     gdb_src_dir="${CT_SRC_DIR}/gdb$(do_debug_gdb_suffix)"
    77     insight_src_dir="${CT_SRC_DIR}/insight-${CT_GDB_VERSION}"
    78 
    79     extra_config=
    80     # Version 6.3 and below behave badly with gdbmi
    81     case "${CT_GDB_VERSION}" in
    82         6.2*|6.3)   extra_config="${extra_config} --disable-gdbmi";;
    83     esac
    84 
    85     if [ "${CT_GDB_CROSS}" = "y" ]; then
    86         CT_DoStep INFO "Installing cross-gdb"
    87         CT_DoLog EXTRA "Configuring cross-gdb"
    88 
    89         mkdir -p "${CT_BUILD_DIR}/build-gdb-cross"
    90         cd "${CT_BUILD_DIR}/build-gdb-cross"
    91 
    92         cross_extra_config="${extra_config}"
    93         if [ "${CT_GMP_MPFR}" = "y" ]; then
    94             cross_extra_config="${cross_extra_config} --with-gmp=${CT_PREFIX_DIR} --with-mpfr=${CT_PREFIX_DIR}"
    95         fi
    96         case "${CT_THREADS}" in
    97             none)   cross_extra_config="${cross_extra_config} --disable-threads";;
    98             *)      cross_extra_config="${cross_extra_config} --enable-threads";;
    99         esac
   100 
   101         CC_for_gdb=
   102         LD_for_gdb=
   103         if [ "${CT_GDB_CROSS_STATIC}" = "y" ]; then
   104             CC_for_gdb="gcc -static"
   105             LD_for_gdb="ld -static"
   106         fi
   107 
   108         gdb_cross_configure="${gdb_src_dir}/configure"
   109         [ "${CT_GDB_CROSS_INSIGHT}" = "y" ] && gdb_cross_configure="${insight_src_dir}/configure"
   110 
   111         CT_DoLog DEBUG "Extra config passed: '${cross_extra_config# }'"
   112 
   113         CC="${CC_for_gdb}"                              \
   114         LD="${LD_for_gdb}"                              \
   115         CT_DoExecLog ALL                                \
   116         "${gdb_cross_configure}"                        \
   117             --build=${CT_BUILD}                         \
   118             --host=${CT_HOST}                           \
   119             --target=${CT_TARGET}                       \
   120             --prefix="${CT_PREFIX_DIR}"                 \
   121             --with-build-sysroot="${CT_SYSROOT_DIR}"    \
   122             --disable-werror                            \
   123             ${cross_extra_config}
   124 
   125         CT_DoLog EXTRA "Building cross-gdb"
   126         CT_DoExecLog ALL make ${PARALLELMFLAGS}
   127 
   128         CT_DoLog EXTRA "Installing cross-gdb"
   129         CT_DoExecLog ALL make install
   130 
   131         CT_EndStep
   132     fi
   133 
   134     if [ "${CT_GDB_NATIVE}" = "y" ]; then
   135         CT_DoStep INFO "Installing native gdb"
   136 
   137         CT_DoStep INFO "Installing ncurses library"
   138         CT_DoLog EXTRA "Configuring ncurses"
   139         mkdir -p "${CT_BUILD_DIR}/build-ncurses"
   140         cd "${CT_BUILD_DIR}/build-ncurses"
   141 
   142         ncurses_opts=
   143         [ "${CT_CC_LANG_CXX}" = "y" ] || ncurses_opts="${ncurses_opts} --without-cxx --without-cxx-binding"
   144         [ "${CT_CC_LANG_ADA}" = "y" ] || ncurses_opts="${ncurses_opts} --without-ada"
   145 
   146         CT_DoExecLog ALL                                        \
   147         "${CT_SRC_DIR}/ncurses-${CT_NCURSES_VERSION}/configure" \
   148             --build=${CT_BUILD}                                 \
   149             --host=${CT_TARGET}                                 \
   150             --with-build-cc=${CT_CC}                            \
   151             --with-build-cpp=${CT_CC}                           \
   152             --with-build-cflags="${CT_CFLAGS_FOR_HOST}"         \
   153             --prefix=/usr                                       \
   154             --with-shared                                       \
   155             --without-sysmouse                                  \
   156             --without-progs                                     \
   157             --enable-termcap                                    \
   158             ${ncurses_opts}
   159 
   160         CT_DoLog EXTRA "Building ncurses"
   161         CT_DoExecLog ALL make ${PARALLELMFLAGS}
   162 
   163         CT_DoLog EXTRA "Installing ncurses"
   164         mkdir -p "${CT_SYSROOT_DIR}/usr/bin"
   165         CT_DoExecLog ALL make DESTDIR="${CT_SYSROOT_DIR}" install
   166 
   167         CT_EndStep
   168 
   169         CT_DoLog EXTRA "Configuring native gdb"
   170 
   171         mkdir -p "${CT_BUILD_DIR}/build-gdb-native"
   172         cd "${CT_BUILD_DIR}/build-gdb-native"
   173 
   174         native_extra_config="${extra_config}"
   175         case "${CT_THREADS}" in
   176             none)   native_extra_config="${native_extra_config} --disable-threads";;
   177             *)      native_extra_config="${native_extra_config} --enable-threads";;
   178         esac
   179         if [ "${CT_GDB_NATIVE_USE_GMP_MPFR}" = "y" ]; then
   180             native_extra_config="${native_extra_config} --with-gmp=${CT_SYSROOT_DIR}/usr --with-mpfr=${CT_SYSROOT_DIR}/usr"
   181         fi
   182 
   183         if [ "${CT_GDB_NATIVE_STATIC}" = "y" ]; then
   184             CC_for_gdb="${CT_TARGET}-gcc -static"
   185             LD_for_gdb="${CT_TARGET}-ld -static"
   186         else
   187             CC_for_gdb="${CT_TARGET}-gcc"
   188             LD_for_gdb="${CT_TARGET}-ld"
   189         fi
   190 
   191         export ac_cv_func_strncmp_works=yes
   192 
   193         CT_DoLog DEBUG "Extra config passed: '${native_extra_config# }'"
   194 
   195         CC="${CC_for_gdb}"                              \
   196         LD="${LD_for_gdb}"                              \
   197         CT_DoExecLog ALL                                \
   198         "${gdb_src_dir}/configure"                      \
   199             --build=${CT_BUILD}                         \
   200             --host=${CT_TARGET}                         \
   201             --target=${CT_TARGET}                       \
   202             --prefix=/usr                               \
   203             --with-build-sysroot="${CT_SYSROOT_DIR}"    \
   204             --without-uiout                             \
   205             --disable-tui                               \
   206             --disable-gdbtk                             \
   207             --without-x                                 \
   208             --disable-sim                               \
   209             --disable-werror                            \
   210             --without-included-gettext                  \
   211             --without-develop                           \
   212             ${native_extra_config}
   213 
   214         CT_DoLog EXTRA "Building native gdb"
   215         CT_DoExecLog ALL make ${PARALLELMFLAGS} CC=${CT_TARGET}-${CT_CC}
   216 
   217         CT_DoLog EXTRA "Installing native gdb"
   218         CT_DoExecLog ALL make DESTDIR="${CT_DEBUG_INSTALL_DIR}" install
   219 
   220         # Building a native gdb also builds a gdbserver
   221         find "${CT_DEBUG_INSTALL_DIR}" -type f -name gdbserver -exec rm -fv {} \; 2>&1 |CT_DoLog ALL
   222 
   223         unset ac_cv_func_strncmp_works
   224 
   225         CT_EndStep
   226     fi
   227 
   228     if [ "${CT_GDB_GDBSERVER}" = "y" ]; then
   229         CT_DoStep INFO "Installing gdbserver"
   230         CT_DoLog EXTRA "Configuring gdbserver"
   231 
   232         mkdir -p "${CT_BUILD_DIR}/build-gdb-gdbserver"
   233         cd "${CT_BUILD_DIR}/build-gdb-gdbserver"
   234 
   235         # Workaround for bad versions, where the configure
   236         # script for gdbserver is not executable...
   237         # Bah, GNU folks strike again... :-(
   238         chmod +x "${gdb_src_dir}/gdb/gdbserver/configure"
   239 
   240         gdbserver_LDFLAGS=
   241         if [ "${CT_GDB_GDBSERVER_STATIC}" = "y" ]; then
   242             gdbserver_LDFLAGS=-static
   243         fi
   244 
   245         gdbserver_extra_config="${extra_config}"
   246 
   247         LDFLAGS="${gdbserver_LDFLAGS}"                  \
   248         CT_DoExecLog ALL                                \
   249         "${gdb_src_dir}/gdb/gdbserver/configure"        \
   250             --build=${CT_BUILD}                         \
   251             --host=${CT_TARGET}                         \
   252             --target=${CT_TARGET}                       \
   253             --prefix=/usr                               \
   254             --sysconfdir=/etc                           \
   255             --localstatedir=/var                        \
   256             --includedir="${CT_HEADERS_DIR}"            \
   257             --with-build-sysroot="${CT_SYSROOT_DIR}"    \
   258             --program-prefix=                           \
   259             --without-uiout                             \
   260             --disable-tui                               \
   261             --disable-gdbtk                             \
   262             --without-x                                 \
   263             --without-included-gettext                  \
   264             --without-develop                           \
   265             --disable-werror                            \
   266             ${gdbserver_extra_config}
   267 
   268         CT_DoLog EXTRA "Building gdbserver"
   269         CT_DoExecLog ALL make ${PARALLELMFLAGS} CC=${CT_TARGET}-${CT_CC}
   270 
   271         CT_DoLog EXTRA "Installing gdbserver"
   272         CT_DoExecLog ALL make DESTDIR="${CT_DEBUG_INSTALL_DIR}" install
   273 
   274         CT_EndStep
   275     fi
   276 }