scripts/build/debug/300-gdb.sh
author "Yann E. MORIN" <yann.morin.1998@free.fr>
Sun Mar 03 16:19:32 2013 +0100 (2013-03-03)
changeset 3190 22556c14a09c
parent 3189 9fa7078581b3
child 3191 992b592dc03a
permissions -rw-r--r--
debug/gdb: always enable expat for the cross-gdb

There's no point in not supporting XML in the cross-gdb.
I mean, come on... ;-)

It's still the responsibility of the user to have the necessary
devel expat packages installed for his/her distro.

Reported-by: Trevor Woerner <twoerner@gmail.com>
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
yann@479
     1
# Build script for the gdb debug facility
yann@479
     2
yann@1743
     3
# The version of ncurses to use. Yes, it's hard-coded.
yann@1743
     4
# It's used only internally by crosstool-NG, and is
yann@1743
     5
# not exposed outside, so we don't care about providing
yann@1743
     6
# config options for this.
yann@2616
     7
CT_DEBUG_GDB_NCURSES_VERSION="5.9"
yann@1743
     8
yann@2101
     9
# Ditto for the expat library
bryanhundven@3036
    10
CT_DEBUG_GDB_EXPAT_VERSION="2.1.0"
yann@2101
    11
yann@821
    12
do_debug_gdb_parts() {
yann@3187
    13
    need_gdb_src=
yann@3187
    14
    need_ncurses_src=
yann@3187
    15
    need_expat_src=
yann@821
    16
yann@821
    17
    if [ "${CT_GDB_CROSS}" = y ]; then
yann@3187
    18
        need_gdb_src=y
yann@821
    19
    fi
yann@821
    20
yann@821
    21
    if [ "${CT_GDB_GDBSERVER}" = "y" ]; then
yann@3187
    22
        need_gdb_src=y
yann@821
    23
    fi
yann@821
    24
yann@821
    25
    if [ "${CT_GDB_NATIVE}" = "y" ]; then
yann@3187
    26
        need_gdb_src=y
linux@2021
    27
        # GDB on Mingw depends on PDcurses, not ncurses
linux@2021
    28
        if [ "${CT_MINGW32}" != "y" ]; then
yann@3187
    29
            need_ncurses_src=y
linux@2021
    30
        fi
yann@3187
    31
        need_expat_src=y
yann@821
    32
    fi
yann@821
    33
}
yann@821
    34
yann@479
    35
do_debug_gdb_get() {
yann@2303
    36
    local linaro_version
yann@2303
    37
    local linaro_series
yann@2303
    38
    local linaro_base_url="http://launchpad.net/gdb-linaro"
yann@2303
    39
yann@2303
    40
    # Account for the Linaro versioning
yann@2303
    41
    linaro_version="$( echo "${CT_GDB_VERSION}"      \
yann@2303
    42
                       |sed -r -e 's/^linaro-//;'   \
yann@2303
    43
                     )"
yann@2303
    44
    linaro_series="$( echo "${linaro_version}"      \
yann@2303
    45
                      |sed -r -e 's/-.*//;'         \
yann@2303
    46
                    )"
yann@2303
    47
yann@821
    48
    do_debug_gdb_parts
yann@821
    49
yann@3187
    50
    if [ "${need_gdb_src}" = "y" ]; then
david@3091
    51
        if [ "${CT_GDB_CUSTOM}" = "y" ]; then
david@3091
    52
            CT_GetCustom "gdb" "${CT_GDB_VERSION}" "${CT_GDB_CUSTOM_LOCATION}"
david@3091
    53
        else
david@3091
    54
            CT_GetFile "gdb-${CT_GDB_VERSION}"                          \
david@3091
    55
                       {ftp,http}://ftp.gnu.org/pub/gnu/gdb             \
david@3091
    56
                       ftp://sources.redhat.com/pub/gdb/{,old-}releases \
david@3091
    57
                       "${linaro_base_url}/${linaro_series}/${linaro_version}/+download"
david@3091
    58
        fi
yann@821
    59
    fi
yann@821
    60
yann@3187
    61
    if [ "${need_ncurses_src}" = "y" ]; then
yann@1743
    62
        CT_GetFile "ncurses-${CT_DEBUG_GDB_NCURSES_VERSION}" .tar.gz  \
yann@573
    63
                   {ftp,http}://ftp.gnu.org/pub/gnu/ncurses \
yann@573
    64
                   ftp://invisible-island.net/ncurses
yann@573
    65
    fi
yann@2101
    66
yann@3187
    67
    if [ "${need_expat_src}" = "y" ]; then
yann@2101
    68
        CT_GetFile "expat-${CT_DEBUG_GDB_EXPAT_VERSION}" .tar.gz    \
bryanhundven@3035
    69
                   http://downloads.sourceforge.net/project/expat/expat/${CT_DEBUG_GDB_EXPAT_VERSION}
yann@2101
    70
    fi
yann@479
    71
}
yann@479
    72
yann@479
    73
do_debug_gdb_extract() {
yann@821
    74
    do_debug_gdb_parts
yann@821
    75
yann@3187
    76
    if [ "${need_gdb_src}" = "y" ]; then
david@3091
    77
        # If using custom directory location, nothing to do
david@3091
    78
        if [    "${CT_GDB_CUSTOM}" = "y" \
david@3091
    79
             -a -d "${CT_SRC_DIR}/gdb-${CT_GDB_VERSION}" ]; then
david@3091
    80
            return 0
david@3091
    81
        fi
yann@1899
    82
        CT_Extract "gdb-${CT_GDB_VERSION}"
yann@1901
    83
        CT_Patch "gdb" "${CT_GDB_VERSION}"
yann@821
    84
    fi
yann@821
    85
yann@3187
    86
    if [ "${need_ncurses_src}" = "y" ]; then
yann@1743
    87
        CT_Extract "ncurses-${CT_DEBUG_GDB_NCURSES_VERSION}"
yann@2326
    88
        CT_DoExecLog ALL chmod -R u+w "${CT_SRC_DIR}/ncurses-${CT_DEBUG_GDB_NCURSES_VERSION}"
yann@1901
    89
        CT_Patch "ncurses" "${CT_DEBUG_GDB_NCURSES_VERSION}"
yann@598
    90
    fi
yann@2101
    91
yann@3187
    92
    if [ "${need_expat_src}" = "y" ]; then
yann@2101
    93
        CT_Extract "expat-${CT_DEBUG_GDB_EXPAT_VERSION}"
yann@2101
    94
        CT_Patch "expat" "${CT_DEBUG_GDB_EXPAT_VERSION}"
yann@2101
    95
    fi
yann@479
    96
}
yann@479
    97
yann@479
    98
do_debug_gdb_build() {
yann@1481
    99
    local -a extra_config
yann@1481
   100
linux@2021
   101
    do_debug_gdb_parts
linux@2021
   102
yann@1899
   103
    gdb_src_dir="${CT_SRC_DIR}/gdb-${CT_GDB_VERSION}"
yann@479
   104
yann@479
   105
    # Version 6.3 and below behave badly with gdbmi
yann@479
   106
    case "${CT_GDB_VERSION}" in
yann@1481
   107
        6.2*|6.3)   extra_config+=("--disable-gdbmi");;
yann@479
   108
    esac
yann@479
   109
benoit@2490
   110
    if [ "${CT_GDB_HAS_PKGVERSION_BUGURL}" = "y" ]; then
benoit@2503
   111
        extra_config+=("--with-pkgversion=${CT_PKGVERSION}")
benoit@2503
   112
        [ -n "${CT_TOOLCHAIN_BUGURL}" ] && extra_config+=("--with-bugurl=${CT_TOOLCHAIN_BUGURL}")
benoit@2490
   113
    fi
benoit@2490
   114
yann@479
   115
    if [ "${CT_GDB_CROSS}" = "y" ]; then
yann@1481
   116
        local -a cross_extra_config
yann@2570
   117
        local gcc_version
yann@1481
   118
yann@479
   119
        CT_DoStep INFO "Installing cross-gdb"
yann@479
   120
        CT_DoLog EXTRA "Configuring cross-gdb"
yann@479
   121
yann@479
   122
        mkdir -p "${CT_BUILD_DIR}/build-gdb-cross"
yann@479
   123
        cd "${CT_BUILD_DIR}/build-gdb-cross"
yann@479
   124
yann@1481
   125
        cross_extra_config=("${extra_config[@]}")
yann@583
   126
        case "${CT_THREADS}" in
yann@1481
   127
            none)   cross_extra_config+=("--disable-threads");;
yann@1481
   128
            *)      cross_extra_config+=("--enable-threads");;
yann@583
   129
        esac
yann@2703
   130
        if [ "${CT_GDB_CROSS_PYTHON}" = "y" ]; then
yann@2703
   131
            cross_extra_config+=( "--with-python=yes" )
yann@2703
   132
        else
yann@2703
   133
            cross_extra_config+=( "--with-python=no" )
yann@2703
   134
        fi
zhenqiang@2856
   135
        if [ "${CT_GDB_CROSS_SIM}" = "y" ]; then
zhenqiang@2856
   136
            cross_extra_config+=( "--enable-sim" )
zhenqiang@2856
   137
        else
zhenqiang@2856
   138
            cross_extra_config+=( "--disable-sim" )
zhenqiang@2856
   139
        fi
yann@583
   140
yann@479
   141
        CC_for_gdb=
yann@479
   142
        LD_for_gdb=
yann@583
   143
        if [ "${CT_GDB_CROSS_STATIC}" = "y" ]; then
yann@479
   144
            CC_for_gdb="gcc -static"
yann@479
   145
            LD_for_gdb="ld -static"
yann@479
   146
        fi
yann@479
   147
yann@3190
   148
        cross_extra_config+=("--enable-expat")
yann@3190
   149
        cross_extra_config+=("--with-expat=yes")
david@3071
   150
zhenqiang@3072
   151
        [ "${CT_TOOLCHAIN_ENABLE_NLS}" != "y" ] &&    \
zhenqiang@3072
   152
        cross_extra_config+=("--disable-nls")
zhenqiang@3072
   153
yann@821
   154
        gdb_cross_configure="${gdb_src_dir}/configure"
yann@821
   155
yann@1481
   156
        CT_DoLog DEBUG "Extra config passed: '${cross_extra_config[*]}'"
yann@602
   157
yann@2344
   158
        CT_DoExecLog CFG                                \
yann@479
   159
        CC="${CC_for_gdb}"                              \
yann@583
   160
        LD="${LD_for_gdb}"                              \
yann@821
   161
        "${gdb_cross_configure}"                        \
yann@479
   162
            --build=${CT_BUILD}                         \
yann@479
   163
            --host=${CT_HOST}                           \
yann@479
   164
            --target=${CT_TARGET}                       \
yann@479
   165
            --prefix="${CT_PREFIX_DIR}"                 \
yann@479
   166
            --with-build-sysroot="${CT_SYSROOT_DIR}"    \
benoit@2476
   167
            --with-sysroot="${CT_SYSROOT_DIR}"          \
yann@801
   168
            --disable-werror                            \
zhenqiang@2784
   169
            "${cross_extra_config[@]}"                  \
zhenqiang@2784
   170
            "${CT_GDB_CROSS_EXTRA_CONFIG_ARRAY[@]}"
yann@479
   171
yann@479
   172
        CT_DoLog EXTRA "Building cross-gdb"
yann@2275
   173
        CT_DoExecLog ALL make ${JOBSFLAGS}
yann@479
   174
yann@479
   175
        CT_DoLog EXTRA "Installing cross-gdb"
yann@669
   176
        CT_DoExecLog ALL make install
yann@479
   177
michael@2765
   178
        if [ "${CT_BUILD_MANUALS}" = "y" ]; then
michael@2765
   179
            CT_DoLog EXTRA "Building and installing the cross-GDB manuals"
michael@2765
   180
            CT_DoExecLog ALL make ${JOBSFLAGS} pdf html
michael@2765
   181
            CT_DoExecLog ALL make install-{pdf,html}-gdb
michael@2765
   182
        fi
michael@2765
   183
yann@2575
   184
        if [ "${CT_GDB_INSTALL_GDBINIT}" = "y" ]; then
yann@2575
   185
            CT_DoLog EXTRA "Install '.gdbinit' template"
yann@2575
   186
            # See in scripts/build/internals.sh for why we do this
yann@2575
   187
            if [ -f "${CT_SRC_DIR}/gcc-${CT_CC_VERSION}/gcc/BASE-VER" ]; then
yann@2575
   188
                gcc_version=$( cat "${CT_SRC_DIR}/gcc-${CT_CC_VERSION}/gcc/BASE-VER" )
yann@2575
   189
            else
yann@2575
   190
                gcc_version=$( sed -r -e '/version_string/!d; s/^.+= "([^"]+)".*$/\1/;' \
yann@2575
   191
                                   "${CT_SRC_DIR}/gcc-${CT_CC_VERSION}/gcc/version.c"   \
yann@2575
   192
                             )
yann@2575
   193
            fi
yann@2575
   194
            ${sed} -r                                               \
yann@2575
   195
                   -e "s:@@PREFIX@@:${CT_PREFIX_DIR}:;"             \
yann@2575
   196
                   -e "s:@@VERSION@@:${gcc_version}:;"              \
yann@2575
   197
                   "${CT_LIB_DIR}/scripts/build/debug/gdbinit.in"   \
yann@2575
   198
                   >"${CT_PREFIX_DIR}/share/gdb/gdbinit"
yann@2575
   199
        fi # Install gdbinit sample
yann@2570
   200
yann@479
   201
        CT_EndStep
yann@479
   202
    fi
yann@479
   203
yann@479
   204
    if [ "${CT_GDB_NATIVE}" = "y" ]; then
yann@1481
   205
        local -a native_extra_config
yann@1481
   206
        local -a ncurses_opt
yann@2100
   207
        local -a gdb_native_CFLAGS
yann@1481
   208
yann@573
   209
        CT_DoStep INFO "Installing native gdb"
yann@573
   210
yann@2100
   211
        native_extra_config=("${extra_config[@]}")
yann@2100
   212
linux@2021
   213
        # GDB on Mingw depends on PDcurses, not ncurses
yann@3188
   214
        if [ "${CT_MINGW32}" != "y" ]; then
linux@2021
   215
            CT_DoLog EXTRA "Building static target ncurses"
yann@1281
   216
linux@2021
   217
            [ "${CT_CC_LANG_CXX}" = "y" ] || ncurses_opts+=("--without-cxx" "--without-cxx-binding")
linux@2021
   218
            [ "${CT_CC_LANG_ADA}" = "y" ] || ncurses_opts+=("--without-ada")
yann@1281
   219
linux@2021
   220
            mkdir -p "${CT_BUILD_DIR}/build-ncurses-build-tic"
linux@2021
   221
            cd "${CT_BUILD_DIR}/build-ncurses-build-tic"
yann@1264
   222
linux@2021
   223
            # Use build = CT_REAL_BUILD so that configure thinks it is
linux@2021
   224
            # cross-compiling, and thus will use the ${CT_BUILD}-*
linux@2021
   225
            # tools instead of searching for the native ones...
anthony@2154
   226
            CT_DoExecLog CFG                                                    \
linux@2021
   227
            "${CT_SRC_DIR}/ncurses-${CT_DEBUG_GDB_NCURSES_VERSION}/configure"   \
linux@2021
   228
                --build=${CT_BUILD}                                             \
linux@2021
   229
                --host=${CT_BUILD}                                              \
linux@2021
   230
                --prefix=/usr                                                   \
linux@2021
   231
                --enable-symlinks                                               \
linux@2021
   232
                --with-build-cc=${CT_REAL_BUILD}-gcc                            \
linux@2021
   233
                --with-build-cpp=${CT_REAL_BUILD}-gcc                           \
linux@2021
   234
                --with-build-cflags="${CT_CFLAGS_FOR_HOST}"                     \
linux@2021
   235
                "${ncurses_opts[@]}"
yann@1264
   236
yann@2617
   237
            # ncurses insists on linking tic statically. It does not work
yann@2617
   238
            # on some OSes (eg. MacOS-X/Darwin/whatever-you-call-it).
yann@2617
   239
            CT_DoExecLog DEBUG sed -r -i -e 's/-static//g;' "progs/Makefile"
yann@2617
   240
linux@2021
   241
            # Under some operating systems (eg. Winblows), there is an
linux@2021
   242
            # extension appended to executables. Find that.
linux@2021
   243
            tic_ext=$(grep -E '^x[[:space:]]*=' progs/Makefile |sed -r -e 's/^.*=[[:space:]]*//;')
yann@1267
   244
yann@2275
   245
            CT_DoExecLog ALL make ${JOBSFLAGS} -C include
yann@2275
   246
            CT_DoExecLog ALL make ${JOBSFLAGS} -C progs "tic${tic_ext}"
yann@1264
   247
w@2751
   248
            CT_DoExecLog ALL install -d -m 0755 "${CT_BUILDTOOLS_PREFIX_DIR}/bin"
w@2751
   249
            CT_DoExecLog ALL install -m 0755 "progs/tic${tic_ext}" "${CT_BUILDTOOLS_PREFIX_DIR}/bin"
yann@1264
   250
linux@2021
   251
            mkdir -p "${CT_BUILD_DIR}/build-ncurses"
linux@2021
   252
            cd "${CT_BUILD_DIR}/build-ncurses"
yann@573
   253
anthony@2154
   254
            CT_DoExecLog CFG                                                    \
w@2751
   255
            TIC_PATH="${CT_BUILDTOOLS_PREFIX_DIR}/bin/tic${tic_ext}"            \
linux@2021
   256
            "${CT_SRC_DIR}/ncurses-${CT_DEBUG_GDB_NCURSES_VERSION}/configure"   \
linux@2021
   257
                --build=${CT_BUILD}                                             \
linux@2021
   258
                --host=${CT_TARGET}                                             \
linux@2021
   259
                --with-build-cc=${CT_BUILD}-gcc                                 \
linux@2021
   260
                --with-build-cpp=${CT_BUILD}-gcc                                \
linux@2021
   261
                --with-build-cflags="${CT_CFLAGS_FOR_HOST}"                     \
yann@2100
   262
                --prefix="${CT_BUILD_DIR}/static-target"                        \
linux@2021
   263
                --without-shared                                                \
linux@2021
   264
                --without-sysmouse                                              \
linux@2021
   265
                --without-progs                                                 \
linux@2021
   266
                --enable-termcap                                                \
linux@2021
   267
                "${ncurses_opts[@]}"
yann@573
   268
yann@2275
   269
            CT_DoExecLog ALL make ${JOBSFLAGS}
yann@573
   270
linux@2021
   271
            CT_DoExecLog ALL make install
yann@573
   272
yann@2100
   273
            native_extra_config+=("--with-curses")
yann@2100
   274
            # There's no better way to tell gdb where to find -lcurses... :-(
yann@2100
   275
            gdb_native_CFLAGS+=("-I${CT_BUILD_DIR}/static-target/include")
yann@2100
   276
            gdb_native_CFLAGS+=("-L${CT_BUILD_DIR}/static-target/lib")
yann@3187
   277
        fi # need_ncurses_src
yann@1281
   278
yann@3189
   279
        # Build libexpat
yann@3189
   280
        CT_DoLog EXTRA "Building static target expat"
yann@3189
   281
        CT_mkdir_pushd "${CT_BUILD_DIR}/build-expat-target-${CT_TARGET}"
yann@3190
   282
        do_gdb_expat_backend host="${CT_TARGET}"                    \
yann@3190
   283
                             prefix="${CT_BUILD_DIR}/static-target" \
yann@3190
   284
                             cflags=""                              \
yann@3190
   285
                             ldflags=""
yann@3189
   286
        CT_Popd
yann@3189
   287
        native_extra_config+=("--with-expat")
yann@3189
   288
        native_extra_config+=("--with-libexpat-prefix=${CT_BUILD_DIR}/static-target")
yann@2101
   289
yann@479
   290
        CT_DoLog EXTRA "Configuring native gdb"
yann@479
   291
yann@479
   292
        mkdir -p "${CT_BUILD_DIR}/build-gdb-native"
yann@479
   293
        cd "${CT_BUILD_DIR}/build-gdb-native"
yann@479
   294
yann@583
   295
        case "${CT_THREADS}" in
yann@1481
   296
            none)   native_extra_config+=("--disable-threads");;
yann@1481
   297
            *)      native_extra_config+=("--enable-threads");;
yann@583
   298
        esac
yann@583
   299
zhenqiang@3072
   300
        [ "${CT_TOOLCHAIN_ENABLE_NLS}" != "y" ] &&    \
zhenqiang@3072
   301
        native_extra_config+=("--disable-nls")
zhenqiang@3072
   302
yann@583
   303
        if [ "${CT_GDB_NATIVE_STATIC}" = "y" ]; then
yann@583
   304
            CC_for_gdb="${CT_TARGET}-gcc -static"
yann@583
   305
            LD_for_gdb="${CT_TARGET}-ld -static"
yann@626
   306
        else
yann@626
   307
            CC_for_gdb="${CT_TARGET}-gcc"
yann@626
   308
            LD_for_gdb="${CT_TARGET}-ld"
yann@583
   309
        fi
yann@583
   310
yann@583
   311
        export ac_cv_func_strncmp_works=yes
yann@583
   312
yann@1481
   313
        CT_DoLog DEBUG "Extra config passed: '${native_extra_config[*]}'"
yann@602
   314
yann@2344
   315
        CT_DoExecLog CFG                                \
yann@583
   316
        CC="${CC_for_gdb}"                              \
yann@583
   317
        LD="${LD_for_gdb}"                              \
yann@2344
   318
        CFLAGS="${gdb_native_CFLAGS[*]}"                \
yann@479
   319
        "${gdb_src_dir}/configure"                      \
yann@479
   320
            --build=${CT_BUILD}                         \
yann@479
   321
            --host=${CT_TARGET}                         \
yann@479
   322
            --target=${CT_TARGET}                       \
yann@479
   323
            --prefix=/usr                               \
yann@479
   324
            --with-build-sysroot="${CT_SYSROOT_DIR}"    \
yann@479
   325
            --without-uiout                             \
yann@479
   326
            --disable-tui                               \
yann@479
   327
            --disable-gdbtk                             \
yann@479
   328
            --without-x                                 \
yann@479
   329
            --disable-sim                               \
yann@583
   330
            --disable-werror                            \
yann@479
   331
            --without-included-gettext                  \
yann@583
   332
            --without-develop                           \
yann@1481
   333
            "${native_extra_config[@]}"
yann@479
   334
yann@479
   335
        CT_DoLog EXTRA "Building native gdb"
yann@2275
   336
        CT_DoExecLog ALL make ${JOBSFLAGS} CC=${CT_TARGET}-${CT_CC}
yann@479
   337
yann@479
   338
        CT_DoLog EXTRA "Installing native gdb"
yann@1219
   339
        CT_DoExecLog ALL make DESTDIR="${CT_DEBUGROOT_DIR}" install
yann@479
   340
yann@583
   341
        # Building a native gdb also builds a gdbserver
yann@1219
   342
        find "${CT_DEBUGROOT_DIR}" -type f -name gdbserver -exec rm -fv {} \; 2>&1 |CT_DoLog ALL
yann@583
   343
yann@583
   344
        unset ac_cv_func_strncmp_works
yann@583
   345
yann@1281
   346
        CT_EndStep # native gdb build
yann@583
   347
    fi
yann@583
   348
yann@583
   349
    if [ "${CT_GDB_GDBSERVER}" = "y" ]; then
yann@1481
   350
        local -a gdbserver_extra_config
yann@1481
   351
yann@583
   352
        CT_DoStep INFO "Installing gdbserver"
yann@583
   353
        CT_DoLog EXTRA "Configuring gdbserver"
yann@583
   354
yann@583
   355
        mkdir -p "${CT_BUILD_DIR}/build-gdb-gdbserver"
yann@583
   356
        cd "${CT_BUILD_DIR}/build-gdb-gdbserver"
yann@583
   357
yann@583
   358
        # Workaround for bad versions, where the configure
yann@583
   359
        # script for gdbserver is not executable...
yann@583
   360
        # Bah, GNU folks strike again... :-(
yann@583
   361
        chmod +x "${gdb_src_dir}/gdb/gdbserver/configure"
yann@583
   362
yann@583
   363
        gdbserver_LDFLAGS=
yann@583
   364
        if [ "${CT_GDB_GDBSERVER_STATIC}" = "y" ]; then
yann@583
   365
            gdbserver_LDFLAGS=-static
yann@583
   366
        fi
yann@583
   367
yann@1481
   368
        gdbserver_extra_config=("${extra_config[@]}")
yann@602
   369
yann@2986
   370
        if [ "${CT_GDB_GDBSERVER_HAS_IPA_LIB}" = "y" ]; then
yann@2986
   371
            if [ "${CT_GDB_GDBSERVER_BUILD_IPA_LIB}" = "y" ]; then
yann@2986
   372
                gdbserver_extra_config+=( --enable-inprocess-agent )
yann@2986
   373
            else
yann@2986
   374
                gdbserver_extra_config+=( --disable-inprocess-agent )
yann@2986
   375
            fi
yann@2986
   376
        fi
yann@2986
   377
yann@2344
   378
        CT_DoExecLog CFG                                \
yann@583
   379
        LDFLAGS="${gdbserver_LDFLAGS}"                  \
yann@583
   380
        "${gdb_src_dir}/gdb/gdbserver/configure"        \
yann@583
   381
            --build=${CT_BUILD}                         \
yann@583
   382
            --host=${CT_TARGET}                         \
yann@583
   383
            --target=${CT_TARGET}                       \
yann@583
   384
            --prefix=/usr                               \
yann@583
   385
            --sysconfdir=/etc                           \
yann@583
   386
            --localstatedir=/var                        \
yann@583
   387
            --includedir="${CT_HEADERS_DIR}"            \
yann@583
   388
            --with-build-sysroot="${CT_SYSROOT_DIR}"    \
yann@583
   389
            --program-prefix=                           \
yann@583
   390
            --without-uiout                             \
yann@583
   391
            --disable-tui                               \
yann@583
   392
            --disable-gdbtk                             \
yann@583
   393
            --without-x                                 \
yann@583
   394
            --without-included-gettext                  \
yann@583
   395
            --without-develop                           \
yann@801
   396
            --disable-werror                            \
yann@1481
   397
            "${gdbserver_extra_config[@]}"
yann@583
   398
yann@583
   399
        CT_DoLog EXTRA "Building gdbserver"
yann@2275
   400
        CT_DoExecLog ALL make ${JOBSFLAGS} CC=${CT_TARGET}-${CT_CC}
yann@583
   401
yann@583
   402
        CT_DoLog EXTRA "Installing gdbserver"
yann@1219
   403
        CT_DoExecLog ALL make DESTDIR="${CT_DEBUGROOT_DIR}" install
yann@583
   404
yann@479
   405
        CT_EndStep
yann@479
   406
    fi
yann@479
   407
}
yann@3189
   408
yann@3189
   409
# Build libexpat
yann@3189
   410
#   Parameter     : description               : type      : default
yann@3189
   411
#   host          : machine to run on         : tuple     : (none)
yann@3189
   412
#   prefix        : prefix to install into    : dir       : (none)
yann@3189
   413
#   cflags        : cflags to use             : string    : (empty)
yann@3189
   414
#   ldflags       : ldflags to use            : string    : (empty)
yann@3189
   415
do_gdb_expat_backend() {
yann@3189
   416
    local host
yann@3189
   417
    local prefix
yann@3189
   418
    local cflags
yann@3189
   419
    local ldflags
yann@3189
   420
    local arg
yann@3189
   421
yann@3189
   422
    for arg in "$@"; do
yann@3189
   423
        eval "${arg// /\\ }"
yann@3189
   424
    done
yann@3189
   425
yann@3189
   426
    CT_DoExecLog CFG                                                \
yann@3189
   427
    "${CT_SRC_DIR}/expat-${CT_DEBUG_GDB_EXPAT_VERSION}/configure"   \
yann@3189
   428
        --build=${CT_BUILD}                                         \
yann@3189
   429
        --host=${host}                                              \
yann@3189
   430
        --prefix="${prefix}"                                        \
yann@3189
   431
        --enable-static                                             \
yann@3189
   432
        --disable-shared
yann@3189
   433
yann@3189
   434
    CT_DoExecLog ALL make ${JOBSFLAGS}
yann@3189
   435
    CT_DoExecLog ALL make install
yann@3189
   436
}