debug/gdb: Fix compilation for Mingw hosts
authorRemy Bohmer <linux@bohmer.net>
Sun Jul 11 22:23:34 2010 +0200 (2010-07-11)
changeset 20213e52a1510f87
parent 2020 9f0de857cb05
child 2022 dc167f43e3dc
debug/gdb: Fix compilation for Mingw hosts

GDB requires PDcurses instead of ncurses while running on Windows.
So, do not always compile ncurses in case GDB needs to build.

PDcurses is provided by an earlier build step and is not described in
this file.

Signed-off-by: Remy Bohmer <linux@bohmer.net>
[yann.morin.1998@anciense.nib.fr: we already have a way to detect ncurses usage]
Signed-off-by: "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
scripts/build/debug/300-gdb.sh
     1.1 --- a/scripts/build/debug/300-gdb.sh	Sun Jul 11 21:37:43 2010 +0200
     1.2 +++ b/scripts/build/debug/300-gdb.sh	Sun Jul 11 22:23:34 2010 +0200
     1.3 @@ -20,7 +20,10 @@
     1.4  
     1.5      if [ "${CT_GDB_NATIVE}" = "y" ]; then
     1.6          do_gdb=y
     1.7 -        do_ncurses=y
     1.8 +        # GDB on Mingw depends on PDcurses, not ncurses
     1.9 +        if [ "${CT_MINGW32}" != "y" ]; then
    1.10 +            do_ncurses=y
    1.11 +        fi
    1.12      fi
    1.13  }
    1.14  
    1.15 @@ -57,6 +60,8 @@
    1.16  do_debug_gdb_build() {
    1.17      local -a extra_config
    1.18  
    1.19 +    do_debug_gdb_parts
    1.20 +
    1.21      gdb_src_dir="${CT_SRC_DIR}/gdb-${CT_GDB_VERSION}"
    1.22  
    1.23      # Version 6.3 and below behave badly with gdbmi
    1.24 @@ -124,62 +129,65 @@
    1.25  
    1.26          CT_DoStep INFO "Installing native gdb"
    1.27  
    1.28 -        CT_DoLog EXTRA "Building static target ncurses"
    1.29 +        # GDB on Mingw depends on PDcurses, not ncurses
    1.30 +        if [ "${do_ncurses}" = "y" ]; then
    1.31 +            CT_DoLog EXTRA "Building static target ncurses"
    1.32  
    1.33 -        [ "${CT_CC_LANG_CXX}" = "y" ] || ncurses_opts+=("--without-cxx" "--without-cxx-binding")
    1.34 -        [ "${CT_CC_LANG_ADA}" = "y" ] || ncurses_opts+=("--without-ada")
    1.35 +            [ "${CT_CC_LANG_CXX}" = "y" ] || ncurses_opts+=("--without-cxx" "--without-cxx-binding")
    1.36 +            [ "${CT_CC_LANG_ADA}" = "y" ] || ncurses_opts+=("--without-ada")
    1.37  
    1.38 -        mkdir -p "${CT_BUILD_DIR}/build-ncurses-build-tic"
    1.39 -        cd "${CT_BUILD_DIR}/build-ncurses-build-tic"
    1.40 +            mkdir -p "${CT_BUILD_DIR}/build-ncurses-build-tic"
    1.41 +            cd "${CT_BUILD_DIR}/build-ncurses-build-tic"
    1.42  
    1.43 -        # Use build = CT_REAL_BUILD so that configure thinks it is
    1.44 -        # cross-compiling, and thus will use the ${CT_BUILD}-*
    1.45 -        # tools instead of searching for the native ones...
    1.46 -        CT_DoExecLog ALL                                                    \
    1.47 -        "${CT_SRC_DIR}/ncurses-${CT_DEBUG_GDB_NCURSES_VERSION}/configure"   \
    1.48 -            --build=${CT_BUILD}                                             \
    1.49 -            --host=${CT_BUILD}                                              \
    1.50 -            --prefix=/usr                                                   \
    1.51 -            --without-shared                                                \
    1.52 -            --enable-symlinks                                               \
    1.53 -            --with-build-cc=${CT_REAL_BUILD}-gcc                            \
    1.54 -            --with-build-cpp=${CT_REAL_BUILD}-gcc                           \
    1.55 -            --with-build-cflags="${CT_CFLAGS_FOR_HOST}"                     \
    1.56 -            "${ncurses_opts[@]}"
    1.57 +            # Use build = CT_REAL_BUILD so that configure thinks it is
    1.58 +            # cross-compiling, and thus will use the ${CT_BUILD}-*
    1.59 +            # tools instead of searching for the native ones...
    1.60 +            CT_DoExecLog ALL                                                    \
    1.61 +            "${CT_SRC_DIR}/ncurses-${CT_DEBUG_GDB_NCURSES_VERSION}/configure"   \
    1.62 +                --build=${CT_BUILD}                                             \
    1.63 +                --host=${CT_BUILD}                                              \
    1.64 +                --prefix=/usr                                                   \
    1.65 +                --without-shared                                                \
    1.66 +                --enable-symlinks                                               \
    1.67 +                --with-build-cc=${CT_REAL_BUILD}-gcc                            \
    1.68 +                --with-build-cpp=${CT_REAL_BUILD}-gcc                           \
    1.69 +                --with-build-cflags="${CT_CFLAGS_FOR_HOST}"                     \
    1.70 +                "${ncurses_opts[@]}"
    1.71  
    1.72 -        # Under some operating systems (eg. Winblows), there is an
    1.73 -        # extension appended to executables. Find that.
    1.74 -        tic_ext=$(grep -E '^x[[:space:]]*=' progs/Makefile |sed -r -e 's/^.*=[[:space:]]*//;')
    1.75 +            # Under some operating systems (eg. Winblows), there is an
    1.76 +            # extension appended to executables. Find that.
    1.77 +            tic_ext=$(grep -E '^x[[:space:]]*=' progs/Makefile |sed -r -e 's/^.*=[[:space:]]*//;')
    1.78  
    1.79 -        CT_DoExecLog ALL make ${PARALLELMFLAGS} -C include
    1.80 -        CT_DoExecLog ALL make ${PARALLELMFLAGS} -C progs "tic${tic_ext}"
    1.81 +            CT_DoExecLog ALL make ${PARALLELMFLAGS} -C include
    1.82 +            CT_DoExecLog ALL make ${PARALLELMFLAGS} -C progs "tic${tic_ext}"
    1.83  
    1.84 -        CT_DoExecLog ALL install -d -m 0755 "${CT_PREFIX_DIR}/buildtools"
    1.85 -        CT_DoExecLog ALL install -m 0755 "progs/tic${tic_ext}" "${CT_PREFIX_DIR}/buildtools"
    1.86 +            CT_DoExecLog ALL install -d -m 0755 "${CT_PREFIX_DIR}/buildtools"
    1.87 +            CT_DoExecLog ALL install -m 0755 "progs/tic${tic_ext}" "${CT_PREFIX_DIR}/buildtools"
    1.88  
    1.89 -        mkdir -p "${CT_BUILD_DIR}/build-ncurses"
    1.90 -        cd "${CT_BUILD_DIR}/build-ncurses"
    1.91 +            mkdir -p "${CT_BUILD_DIR}/build-ncurses"
    1.92 +            cd "${CT_BUILD_DIR}/build-ncurses"
    1.93  
    1.94 -        CT_DoExecLog ALL                                                    \
    1.95 -        "${CT_SRC_DIR}/ncurses-${CT_DEBUG_GDB_NCURSES_VERSION}/configure"   \
    1.96 -            --build=${CT_BUILD}                                             \
    1.97 -            --host=${CT_TARGET}                                             \
    1.98 -            --with-build-cc=${CT_BUILD}-gcc                                 \
    1.99 -            --with-build-cpp=${CT_BUILD}-gcc                                \
   1.100 -            --with-build-cflags="${CT_CFLAGS_FOR_HOST}"                     \
   1.101 -            --prefix="${CT_BUILD_DIR}/ncurses"                              \
   1.102 -            --without-shared                                                \
   1.103 -            --without-sysmouse                                              \
   1.104 -            --without-progs                                                 \
   1.105 -            --enable-termcap                                                \
   1.106 -            "${ncurses_opts[@]}"
   1.107 +            CT_DoExecLog ALL                                                    \
   1.108 +            "${CT_SRC_DIR}/ncurses-${CT_DEBUG_GDB_NCURSES_VERSION}/configure"   \
   1.109 +                --build=${CT_BUILD}                                             \
   1.110 +                --host=${CT_TARGET}                                             \
   1.111 +                --with-build-cc=${CT_BUILD}-gcc                                 \
   1.112 +                --with-build-cpp=${CT_BUILD}-gcc                                \
   1.113 +                --with-build-cflags="${CT_CFLAGS_FOR_HOST}"                     \
   1.114 +                --prefix="${CT_BUILD_DIR}/ncurses"                              \
   1.115 +                --without-shared                                                \
   1.116 +                --without-sysmouse                                              \
   1.117 +                --without-progs                                                 \
   1.118 +                --enable-termcap                                                \
   1.119 +                "${ncurses_opts[@]}"
   1.120  
   1.121 -        CT_DoExecLog ALL make ${PARALLELMFLAGS}
   1.122 +            CT_DoExecLog ALL make ${PARALLELMFLAGS}
   1.123  
   1.124 -        CT_DoExecLog ALL make install
   1.125 +            CT_DoExecLog ALL make install
   1.126  
   1.127 -        # We no longer need the temporary tic. Remove it
   1.128 -        CT_DoExecLog DEBUG rm -fv "${CT_PREFIX_DIR}/bin/tic"
   1.129 +            # We no longer need the temporary tic. Remove it
   1.130 +            CT_DoExecLog DEBUG rm -fv "${CT_PREFIX_DIR}/bin/tic"
   1.131 +        fi # do_ncurses
   1.132  
   1.133          CT_DoLog EXTRA "Configuring native gdb"
   1.134  
   1.135 @@ -241,11 +249,14 @@
   1.136  
   1.137          unset ac_cv_func_strncmp_works
   1.138  
   1.139 -        CT_DoLog EXTRA "Cleaning up ncurses"
   1.140 -        cd "${CT_BUILD_DIR}/build-ncurses"
   1.141 -        CT_DoExecLog ALL make DESTDIR="${CT_SYSROOT_DIR}" uninstall
   1.142 +        # GDB on Mingw depends on PDcurses, not ncurses
   1.143 +        if [ "${CT_MINGW32}" != "y" ]; then
   1.144 +            CT_DoLog EXTRA "Cleaning up ncurses"
   1.145 +            cd "${CT_BUILD_DIR}/build-ncurses"
   1.146 +            CT_DoExecLog ALL make DESTDIR="${CT_SYSROOT_DIR}" uninstall
   1.147  
   1.148 -        CT_DoExecLog DEBUG rm -rf "${CT_BUILD_DIR}/ncurses"
   1.149 +            CT_DoExecLog DEBUG rm -rf "${CT_BUILD_DIR}/ncurses"
   1.150 +        fi
   1.151  
   1.152          CT_EndStep # native gdb build
   1.153      fi