summaryrefslogtreecommitdiff
path: root/scripts/build/debug
diff options
context:
space:
mode:
authorYann E. MORIN" <yann.morin.1998@free.fr>2013-03-03 15:21:51 (GMT)
committerYann E. MORIN" <yann.morin.1998@free.fr>2013-03-03 15:21:51 (GMT)
commitea899b676787ecad79fa7aafbbfb8e24e7312155 (patch)
tree03084c1ac15269f45a349d3e7f151354e305cf55 /scripts/build/debug
parent71d2f41cf97c07734cff6210a2406ff12fb97f48 (diff)
debug/gdb: move the ncurses build to a backend
This cleans up the code a bit. Signed-off-by: "Yann E. MORIN" <yann.morin.1998@free.fr>
Diffstat (limited to 'scripts/build/debug')
-rw-r--r--scripts/build/debug/300-gdb.sh138
1 files changed, 82 insertions, 56 deletions
diff --git a/scripts/build/debug/300-gdb.sh b/scripts/build/debug/300-gdb.sh
index 55050df..8532eab 100644
--- a/scripts/build/debug/300-gdb.sh
+++ b/scripts/build/debug/300-gdb.sh
@@ -214,62 +214,12 @@ do_debug_gdb_build() {
if [ "${CT_MINGW32}" != "y" ]; then
CT_DoLog EXTRA "Building static target ncurses"
- [ "${CT_CC_LANG_CXX}" = "y" ] || ncurses_opts+=("--without-cxx" "--without-cxx-binding")
- [ "${CT_CC_LANG_ADA}" = "y" ] || ncurses_opts+=("--without-ada")
-
- mkdir -p "${CT_BUILD_DIR}/build-ncurses-build-tic"
- cd "${CT_BUILD_DIR}/build-ncurses-build-tic"
-
- # Use build = CT_REAL_BUILD so that configure thinks it is
- # cross-compiling, and thus will use the ${CT_BUILD}-*
- # tools instead of searching for the native ones...
- CT_DoExecLog CFG \
- "${CT_SRC_DIR}/ncurses-${CT_DEBUG_GDB_NCURSES_VERSION}/configure" \
- --build=${CT_BUILD} \
- --host=${CT_BUILD} \
- --prefix=/usr \
- --enable-symlinks \
- --with-build-cc=${CT_REAL_BUILD}-gcc \
- --with-build-cpp=${CT_REAL_BUILD}-gcc \
- --with-build-cflags="${CT_CFLAGS_FOR_HOST}" \
- "${ncurses_opts[@]}"
-
- # ncurses insists on linking tic statically. It does not work
- # on some OSes (eg. MacOS-X/Darwin/whatever-you-call-it).
- CT_DoExecLog DEBUG sed -r -i -e 's/-static//g;' "progs/Makefile"
-
- # Under some operating systems (eg. Winblows), there is an
- # extension appended to executables. Find that.
- tic_ext=$(grep -E '^x[[:space:]]*=' progs/Makefile |sed -r -e 's/^.*=[[:space:]]*//;')
-
- CT_DoExecLog ALL make ${JOBSFLAGS} -C include
- CT_DoExecLog ALL make ${JOBSFLAGS} -C progs "tic${tic_ext}"
-
- CT_DoExecLog ALL install -d -m 0755 "${CT_BUILDTOOLS_PREFIX_DIR}/bin"
- CT_DoExecLog ALL install -m 0755 "progs/tic${tic_ext}" "${CT_BUILDTOOLS_PREFIX_DIR}/bin"
-
- mkdir -p "${CT_BUILD_DIR}/build-ncurses"
- cd "${CT_BUILD_DIR}/build-ncurses"
-
- CT_DoExecLog CFG \
- TIC_PATH="${CT_BUILDTOOLS_PREFIX_DIR}/bin/tic${tic_ext}" \
- "${CT_SRC_DIR}/ncurses-${CT_DEBUG_GDB_NCURSES_VERSION}/configure" \
- --build=${CT_BUILD} \
- --host=${CT_TARGET} \
- --with-build-cc=${CT_BUILD}-gcc \
- --with-build-cpp=${CT_BUILD}-gcc \
- --with-build-cflags="${CT_CFLAGS_FOR_HOST}" \
- --prefix="${CT_BUILD_DIR}/static-target" \
- --without-shared \
- --without-sysmouse \
- --without-progs \
- --enable-termcap \
- "${ncurses_opts[@]}"
-
- CT_DoExecLog ALL make ${JOBSFLAGS}
-
- CT_DoExecLog ALL make install
-
+ CT_mkdir_pushd "${CT_BUILD_DIR}/build-ncurses-target-${CT_TARGET}"
+ do_gdb_ncurses_backend host="${CT_TARGET}" \
+ prefix="${CT_BUILD_DIR}/static-target" \
+ cflags="${CT_CFLAGS_FOR_HOST}" \
+ ldflags=""
+ CT_Popd
native_extra_config+=("--with-curses")
# There's no better way to tell gdb where to find -lcurses... :-(
gdb_native_CFLAGS+=("-I${CT_BUILD_DIR}/static-target/include")
@@ -406,6 +356,82 @@ do_debug_gdb_build() {
fi
}
+# Build libncurses
+# Parameter : description : type : default
+# host : machine to run on : tuple : (none)
+# prefix : prefix to install into : dir : (none)
+# cflags : cflags to use : string : (empty)
+# ldflags : ldflags to use : string : (empty)
+do_gdb_ncurses_backend() {
+ local host
+ local prefix
+ local cflags
+ local ldflags
+ local arg
+
+ for arg in "$@"; do
+ eval "${arg// /\\ }"
+ done
+
+ [ "${CT_CC_LANG_CXX}" = "y" ] || ncurses_opts+=("--without-cxx" "--without-cxx-binding")
+ [ "${CT_CC_LANG_ADA}" = "y" ] || ncurses_opts+=("--without-ada")
+
+ CT_mkdir_pushd "build-tic"
+
+ # We need a tic that runs on build, not on host nor on target
+ # Use build = CT_REAL_BUILD so that configure thinks it is
+ # cross-compiling, and thus will use the ${CT_BUILD}-*
+ # tools instead of searching for the native ones...
+ CT_DoExecLog CFG \
+ "${CT_SRC_DIR}/ncurses-${CT_DEBUG_GDB_NCURSES_VERSION}/configure" \
+ --build=${CT_BUILD} \
+ --host=${CT_BUILD} \
+ --prefix=/usr \
+ --enable-symlinks \
+ --with-build-cc=${CT_REAL_BUILD}-gcc \
+ --with-build-cpp=${CT_REAL_BUILD}-gcc \
+ --with-build-cflags="${CT_CFLAGS_FOR_HOST}" \
+ "${ncurses_opts[@]}"
+
+ # ncurses insists on linking tic statically. It does not work
+ # on some OSes (eg. MacOS-X/Darwin/whatever-you-call-it).
+ CT_DoExecLog DEBUG sed -r -i -e 's/-static//g;' "progs/Makefile"
+
+ # Under some operating systems (eg. Winblows), there is an
+ # extension appended to executables. Find that.
+ tic_ext=$(grep -E '^x[[:space:]]*=' progs/Makefile |sed -r -e 's/^.*=[[:space:]]*//;')
+
+ CT_DoExecLog ALL make ${JOBSFLAGS} -C include
+ CT_DoExecLog ALL make ${JOBSFLAGS} -C progs "tic${tic_ext}"
+
+ CT_DoExecLog ALL install -d -m 0755 "${CT_BUILDTOOLS_PREFIX_DIR}/bin"
+ CT_DoExecLog ALL install -m 0755 "progs/tic${tic_ext}" "${CT_BUILDTOOLS_PREFIX_DIR}/bin"
+
+ CT_Popd
+
+ CT_mkdir_pushd "ncurses"
+
+ CT_DoExecLog CFG \
+ TIC_PATH="${CT_BUILDTOOLS_PREFIX_DIR}/bin/tic${tic_ext}" \
+ "${CT_SRC_DIR}/ncurses-${CT_DEBUG_GDB_NCURSES_VERSION}/configure" \
+ --build=${CT_BUILD} \
+ --host=${host} \
+ --with-build-cc=${CT_BUILD}-gcc \
+ --with-build-cpp=${CT_BUILD}-gcc \
+ --with-build-cflags="${CT_CFLAGS_FOR_HOST}" \
+ --prefix="${prefix}" \
+ --without-shared \
+ --without-sysmouse \
+ --without-progs \
+ --enable-termcap \
+ "${ncurses_opts[@]}"
+
+ CT_DoExecLog ALL make ${JOBSFLAGS}
+ CT_DoExecLog ALL make install
+
+ CT_Popd
+}
+
# Build libexpat
# Parameter : description : type : default
# host : machine to run on : tuple : (none)