1.1 --- a/scripts/build/debug/300-gdb.sh Sun Mar 03 16:19:32 2013 +0100
1.2 +++ b/scripts/build/debug/300-gdb.sh Sun Mar 03 16:21:51 2013 +0100
1.3 @@ -214,62 +214,12 @@
1.4 if [ "${CT_MINGW32}" != "y" ]; then
1.5 CT_DoLog EXTRA "Building static target ncurses"
1.6
1.7 - [ "${CT_CC_LANG_CXX}" = "y" ] || ncurses_opts+=("--without-cxx" "--without-cxx-binding")
1.8 - [ "${CT_CC_LANG_ADA}" = "y" ] || ncurses_opts+=("--without-ada")
1.9 -
1.10 - mkdir -p "${CT_BUILD_DIR}/build-ncurses-build-tic"
1.11 - cd "${CT_BUILD_DIR}/build-ncurses-build-tic"
1.12 -
1.13 - # Use build = CT_REAL_BUILD so that configure thinks it is
1.14 - # cross-compiling, and thus will use the ${CT_BUILD}-*
1.15 - # tools instead of searching for the native ones...
1.16 - CT_DoExecLog CFG \
1.17 - "${CT_SRC_DIR}/ncurses-${CT_DEBUG_GDB_NCURSES_VERSION}/configure" \
1.18 - --build=${CT_BUILD} \
1.19 - --host=${CT_BUILD} \
1.20 - --prefix=/usr \
1.21 - --enable-symlinks \
1.22 - --with-build-cc=${CT_REAL_BUILD}-gcc \
1.23 - --with-build-cpp=${CT_REAL_BUILD}-gcc \
1.24 - --with-build-cflags="${CT_CFLAGS_FOR_HOST}" \
1.25 - "${ncurses_opts[@]}"
1.26 -
1.27 - # ncurses insists on linking tic statically. It does not work
1.28 - # on some OSes (eg. MacOS-X/Darwin/whatever-you-call-it).
1.29 - CT_DoExecLog DEBUG sed -r -i -e 's/-static//g;' "progs/Makefile"
1.30 -
1.31 - # Under some operating systems (eg. Winblows), there is an
1.32 - # extension appended to executables. Find that.
1.33 - tic_ext=$(grep -E '^x[[:space:]]*=' progs/Makefile |sed -r -e 's/^.*=[[:space:]]*//;')
1.34 -
1.35 - CT_DoExecLog ALL make ${JOBSFLAGS} -C include
1.36 - CT_DoExecLog ALL make ${JOBSFLAGS} -C progs "tic${tic_ext}"
1.37 -
1.38 - CT_DoExecLog ALL install -d -m 0755 "${CT_BUILDTOOLS_PREFIX_DIR}/bin"
1.39 - CT_DoExecLog ALL install -m 0755 "progs/tic${tic_ext}" "${CT_BUILDTOOLS_PREFIX_DIR}/bin"
1.40 -
1.41 - mkdir -p "${CT_BUILD_DIR}/build-ncurses"
1.42 - cd "${CT_BUILD_DIR}/build-ncurses"
1.43 -
1.44 - CT_DoExecLog CFG \
1.45 - TIC_PATH="${CT_BUILDTOOLS_PREFIX_DIR}/bin/tic${tic_ext}" \
1.46 - "${CT_SRC_DIR}/ncurses-${CT_DEBUG_GDB_NCURSES_VERSION}/configure" \
1.47 - --build=${CT_BUILD} \
1.48 - --host=${CT_TARGET} \
1.49 - --with-build-cc=${CT_BUILD}-gcc \
1.50 - --with-build-cpp=${CT_BUILD}-gcc \
1.51 - --with-build-cflags="${CT_CFLAGS_FOR_HOST}" \
1.52 - --prefix="${CT_BUILD_DIR}/static-target" \
1.53 - --without-shared \
1.54 - --without-sysmouse \
1.55 - --without-progs \
1.56 - --enable-termcap \
1.57 - "${ncurses_opts[@]}"
1.58 -
1.59 - CT_DoExecLog ALL make ${JOBSFLAGS}
1.60 -
1.61 - CT_DoExecLog ALL make install
1.62 -
1.63 + CT_mkdir_pushd "${CT_BUILD_DIR}/build-ncurses-target-${CT_TARGET}"
1.64 + do_gdb_ncurses_backend host="${CT_TARGET}" \
1.65 + prefix="${CT_BUILD_DIR}/static-target" \
1.66 + cflags="${CT_CFLAGS_FOR_HOST}" \
1.67 + ldflags=""
1.68 + CT_Popd
1.69 native_extra_config+=("--with-curses")
1.70 # There's no better way to tell gdb where to find -lcurses... :-(
1.71 gdb_native_CFLAGS+=("-I${CT_BUILD_DIR}/static-target/include")
1.72 @@ -406,6 +356,82 @@
1.73 fi
1.74 }
1.75
1.76 +# Build libncurses
1.77 +# Parameter : description : type : default
1.78 +# host : machine to run on : tuple : (none)
1.79 +# prefix : prefix to install into : dir : (none)
1.80 +# cflags : cflags to use : string : (empty)
1.81 +# ldflags : ldflags to use : string : (empty)
1.82 +do_gdb_ncurses_backend() {
1.83 + local host
1.84 + local prefix
1.85 + local cflags
1.86 + local ldflags
1.87 + local arg
1.88 +
1.89 + for arg in "$@"; do
1.90 + eval "${arg// /\\ }"
1.91 + done
1.92 +
1.93 + [ "${CT_CC_LANG_CXX}" = "y" ] || ncurses_opts+=("--without-cxx" "--without-cxx-binding")
1.94 + [ "${CT_CC_LANG_ADA}" = "y" ] || ncurses_opts+=("--without-ada")
1.95 +
1.96 + CT_mkdir_pushd "build-tic"
1.97 +
1.98 + # We need a tic that runs on build, not on host nor on target
1.99 + # Use build = CT_REAL_BUILD so that configure thinks it is
1.100 + # cross-compiling, and thus will use the ${CT_BUILD}-*
1.101 + # tools instead of searching for the native ones...
1.102 + CT_DoExecLog CFG \
1.103 + "${CT_SRC_DIR}/ncurses-${CT_DEBUG_GDB_NCURSES_VERSION}/configure" \
1.104 + --build=${CT_BUILD} \
1.105 + --host=${CT_BUILD} \
1.106 + --prefix=/usr \
1.107 + --enable-symlinks \
1.108 + --with-build-cc=${CT_REAL_BUILD}-gcc \
1.109 + --with-build-cpp=${CT_REAL_BUILD}-gcc \
1.110 + --with-build-cflags="${CT_CFLAGS_FOR_HOST}" \
1.111 + "${ncurses_opts[@]}"
1.112 +
1.113 + # ncurses insists on linking tic statically. It does not work
1.114 + # on some OSes (eg. MacOS-X/Darwin/whatever-you-call-it).
1.115 + CT_DoExecLog DEBUG sed -r -i -e 's/-static//g;' "progs/Makefile"
1.116 +
1.117 + # Under some operating systems (eg. Winblows), there is an
1.118 + # extension appended to executables. Find that.
1.119 + tic_ext=$(grep -E '^x[[:space:]]*=' progs/Makefile |sed -r -e 's/^.*=[[:space:]]*//;')
1.120 +
1.121 + CT_DoExecLog ALL make ${JOBSFLAGS} -C include
1.122 + CT_DoExecLog ALL make ${JOBSFLAGS} -C progs "tic${tic_ext}"
1.123 +
1.124 + CT_DoExecLog ALL install -d -m 0755 "${CT_BUILDTOOLS_PREFIX_DIR}/bin"
1.125 + CT_DoExecLog ALL install -m 0755 "progs/tic${tic_ext}" "${CT_BUILDTOOLS_PREFIX_DIR}/bin"
1.126 +
1.127 + CT_Popd
1.128 +
1.129 + CT_mkdir_pushd "ncurses"
1.130 +
1.131 + CT_DoExecLog CFG \
1.132 + TIC_PATH="${CT_BUILDTOOLS_PREFIX_DIR}/bin/tic${tic_ext}" \
1.133 + "${CT_SRC_DIR}/ncurses-${CT_DEBUG_GDB_NCURSES_VERSION}/configure" \
1.134 + --build=${CT_BUILD} \
1.135 + --host=${host} \
1.136 + --with-build-cc=${CT_BUILD}-gcc \
1.137 + --with-build-cpp=${CT_BUILD}-gcc \
1.138 + --with-build-cflags="${CT_CFLAGS_FOR_HOST}" \
1.139 + --prefix="${prefix}" \
1.140 + --without-shared \
1.141 + --without-sysmouse \
1.142 + --without-progs \
1.143 + --enable-termcap \
1.144 + "${ncurses_opts[@]}"
1.145 +
1.146 + CT_DoExecLog ALL make ${JOBSFLAGS}
1.147 + CT_DoExecLog ALL make install
1.148 +
1.149 + CT_Popd
1.150 +}
1.151 +
1.152 # Build libexpat
1.153 # Parameter : description : type : default
1.154 # host : machine to run on : tuple : (none)