summaryrefslogtreecommitdiff
path: root/scripts/build/debug
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/build/debug')
-rw-r--r--scripts/build/debug/000-template.sh34
-rw-r--r--scripts/build/debug/200-duma.sh23
-rw-r--r--scripts/build/debug/300-gdb.sh530
-rw-r--r--scripts/build/debug/400-ltrace.sh47
-rw-r--r--scripts/build/debug/500-strace.sh34
5 files changed, 306 insertions, 362 deletions
diff --git a/scripts/build/debug/000-template.sh b/scripts/build/debug/000-template.sh
deleted file mode 100644
index 47d2cae..0000000
--- a/scripts/build/debug/000-template.sh
+++ /dev/null
@@ -1,34 +0,0 @@
-# Template file for a debug utility
-
-# Put your download code here
-do_debug_foobar_get() {
- # For example:
- # CT_GetFile "foobar-${CT_FOOBAR_VERSION}" http://foobar.com/releases/
- :
-}
-
-# Put your extract code here
-do_debug_foobar_extract() {
- # For example:
- # CT_Extract "foobar-${CT_FOOBAR_VERSION}"
- # CT_Patch "foobar" "${CT_FOOBAR_VERSION}"
- :
-}
-
-# Put your build code here
-do_debug_foobar_build() {
- # For example:
- # mkdir -p "${CT_BUILD_DIR}/build-foobar"
- # CT_Pushd "${CT_BUILD_DIR}/build-foobar"
- # CT_DoExecLog CFG \
- # "${CT_SRC_DIR}/foobar-${CT_FOOBAR_VERSION}/configure" \
- # --build=${CT_BUILD} \
- # --host=${CT_TARGET} \
- # --prefix=/usr \
- # --foobar-options
- # CT_DoExecLog ALL make
- # CT_DoExecLog ALL make DESTDIR="${CT_SYSROOT_DIR}" install
- # CT_Popd
- :
-}
-
diff --git a/scripts/build/debug/200-duma.sh b/scripts/build/debug/200-duma.sh
index 2a9b01f..9e2379e 100644
--- a/scripts/build/debug/200-duma.sh
+++ b/scripts/build/debug/200-duma.sh
@@ -1,24 +1,11 @@
# Build script for D.U.M.A.
do_debug_duma_get() {
- local dl_base
-
- dl_base="http://downloads.sourceforge.net/project/duma/duma"
- dl_base+="/${CT_DUMA_VERSION//_/.}"
-
- # Downloading an non-existing file from sourceforge will give you an
- # HTML file containing an error message, instead of returning a 404.
- # Sigh...
- CT_GetFile "duma_${CT_DUMA_VERSION}" .tar.gz "${dl_base}"
- # Downloading from sourceforge may leave garbage, cleanup
- CT_DoExecLog ALL rm -f "${CT_TARBALLS_DIR}/showfiles.php"*
+ CT_Fetch DUMA
}
do_debug_duma_extract() {
- CT_Extract "duma_${CT_DUMA_VERSION}"
- CT_Pushd "${CT_SRC_DIR}/duma_${CT_DUMA_VERSION}"
- CT_Patch nochdir "duma" "${CT_DUMA_VERSION}"
- CT_Popd
+ CT_ExtractPatch DUMA
}
do_debug_duma_build() {
@@ -26,14 +13,14 @@ do_debug_duma_build() {
CT_DoStep INFO "Installing D.U.M.A."
CT_DoLog EXTRA "Copying sources"
- cp -a "${CT_SRC_DIR}/duma_${CT_DUMA_VERSION}/." "${CT_BUILD_DIR}/build-duma"
+ cp -a "${CT_SRC_DIR}/duma/." "${CT_BUILD_DIR}/build-duma"
CT_Pushd "${CT_BUILD_DIR}/build-duma"
make_args=(
prefix="${CT_DEBUGROOT_DIR}/usr"
HOSTCC="${CT_BUILD}-gcc"
- CC="${CT_TARGET}-${CT_CC}"
- CXX="${CT_TARGET}-g++"
+ CC="${CT_TARGET}-${CT_CC} ${CT_ALL_TARGET_CFLAGS}"
+ CXX="${CT_TARGET}-g++ ${CT_ALL_TARGET_CFLAGS}"
RANLIB="${CT_TARGET}-ranlib"
OS="${CT_KERNEL}"
)
diff --git a/scripts/build/debug/300-gdb.sh b/scripts/build/debug/300-gdb.sh
index a5ac7f9..4afaba4 100644
--- a/scripts/build/debug/300-gdb.sh
+++ b/scripts/build/debug/300-gdb.sh
@@ -1,190 +1,150 @@
# Build script for the gdb debug facility
-do_debug_gdb_get() {
- local linaro_version=""
- local linaro_series=""
-
- if [ "${CT_GDB_CUSTOM}" = "y" ]; then
- CT_GetCustom "gdb" "${CT_GDB_CUSTOM_VERSION}" \
- "${CT_GDB_CUSTOM_LOCATION}"
- else
- case "${CT_GDB_VERSION}" in
- linaro-*)
- CT_GetLinaro "gdb" "${CT_GDB_VERSION}"
- ;;
- *)
- CT_GetFile "gdb-${CT_GDB_VERSION}" \
- http://mirrors.kernel.org/sourceware/gdb \
- {http,ftp,https}://ftp.gnu.org/pub/gnu/gdb \
- ftp://{sourceware.org,gcc.gnu.org}/pub/gdb/releases
- ;;
- esac
- fi
+do_debug_gdb_get()
+{
+ CT_Fetch GDB
}
-do_debug_gdb_extract() {
- CT_Extract "gdb-${CT_GDB_VERSION}"
- CT_Patch "gdb" "${CT_GDB_VERSION}"
-
- if [ -n "${CT_ARCH_XTENSA_CUSTOM_NAME}" ]; then
- CT_ConfigureXtensa "gdb" "${CT_GDB_VERSION}"
- fi
+do_debug_gdb_extract()
+{
+ CT_ExtractPatch GDB
}
-do_debug_gdb_build() {
- local -a extra_config
-
- gdb_src_dir="${CT_SRC_DIR}/gdb-${CT_GDB_VERSION}"
-
- # Version 6.3 and below behave badly with gdbmi
- case "${CT_GDB_VERSION}" in
- 6.2*|6.3) extra_config+=("--disable-gdbmi");;
- esac
-
- if [ "${CT_GDB_HAS_PKGVERSION_BUGURL}" = "y" ]; then
- extra_config+=("--with-pkgversion=${CT_PKGVERSION}")
- [ -n "${CT_TOOLCHAIN_BUGURL}" ] && extra_config+=("--with-bugurl=${CT_TOOLCHAIN_BUGURL}")
- fi
-
+do_debug_gdb_build()
+{
if [ "${CT_GDB_CROSS}" = "y" ]; then
+ local gcc_version p _p
local -a cross_extra_config
- local gcc_version
CT_DoStep INFO "Installing cross-gdb"
- CT_DoLog EXTRA "Configuring cross-gdb"
-
- mkdir -p "${CT_BUILD_DIR}/build-gdb-cross"
- cd "${CT_BUILD_DIR}/build-gdb-cross"
-
- cross_extra_config=("${extra_config[@]}")
-
- # For gdb-cross this combination of flags forces
- # gdb configure to fall back to default '-lexpat' flag
- # which is acceptable.
- #
- # NOTE: DO NOT USE --with-libexpat-prefix (until GDB configure is smarter)!!!
- # It conflicts with a static build: GDB's configure script will find the shared
- # version of expat and will attempt to link that, despite the -static flag.
- # The link will fail, and configure will abort with "expat missing or unusable"
- # message.
- cross_extra_config+=("--with-expat")
- cross_extra_config+=("--without-libexpat-prefix")
+ CT_mkdir_pushd "${CT_BUILD_DIR}/build-gdb-cross"
- case "${CT_THREADS}" in
- none) cross_extra_config+=("--disable-threads");;
- *) cross_extra_config+=("--enable-threads");;
- esac
+ cross_extra_config=( "${CT_GDB_CROSS_EXTRA_CONFIG_ARRAY[@]}" )
if [ "${CT_GDB_CROSS_PYTHON}" = "y" ]; then
- cross_extra_config+=( "--with-python=yes" )
+ if [ -z "${CT_GDB_CROSS_PYTHON_BINARY}" ]; then
+ if [ "${CT_CANADIAN}" = "y" -o "${CT_CROSS_NATIVE}" = "y" ]; then
+ CT_Abort "For canadian build, Python wrapper runnable on the build machine must be provided. Set CT_GDB_CROSS_PYTHON_BINARY."
+ elif [ "${CT_CONFIGURE_has_python}" = "y" ]; then
+ cross_extra_config+=("--with-python=${python}")
+ else
+ CT_Abort "Python support requested in GDB, but Python not found. Set CT_GDB_CROSS_PYTHON_BINARY."
+ fi
+ else
+ cross_extra_config+=("--with-python=${CT_GDB_CROSS_PYTHON_BINARY}")
+ fi
else
- cross_extra_config+=( "--with-python=no" )
+ cross_extra_config+=("--with-python=no")
fi
+
if [ "${CT_GDB_CROSS_SIM}" = "y" ]; then
- cross_extra_config+=( "--enable-sim" )
+ cross_extra_config+=("--enable-sim")
else
- cross_extra_config+=( "--disable-sim" )
- fi
- if [ "${CT_TOOLCHAIN_ENABLE_NLS}" != "y" ]; then
- cross_extra_config+=("--disable-nls")
+ cross_extra_config+=("--disable-sim")
fi
- CPP_for_gdb="${CT_HOST}-cpp ${CT_CFLAGS_FOR_HOST}"
- CC_for_gdb="${CT_HOST}-gcc ${CT_CFLAGS_FOR_HOST} ${CT_LDFLAGS_FOR_HOST}"
- CXX_for_gdb="${CT_HOST}-g++ ${CT_CFLAGS_FOR_HOST} ${CT_LDFLAGS_FOR_HOST}"
- LD_for_gdb="${CT_HOST}-ld ${CT_LDFLAGS_FOR_HOST}"
- if [ "${CT_GDB_CROSS_STATIC}" = "y" ]; then
- CC_for_gdb+=" -static"
- CXX_for_gdb+=" -static"
- LD_for_gdb+=" -static"
+ if ${CT_HOST}-gcc --version 2>&1 | grep clang; then
+ # clang detects the line from gettext's _ macro as format string
+ # not being a string literal and produces a lot of warnings - which
+ # ct-ng's logger faithfully relays to user if this happens in the
+ # error() function. Suppress them.
+ cross_extra_config+=("--enable-build-warnings=,-Wno-format-nonliteral,-Wno-format-security")
fi
- case "${CT_HOST}" in
- *darwin*)
- # FIXME: Really, we should be testing for host compiler being clang.
- CC_for_gdb+=" -Qunused-arguments"
- CXX_for_gdb+=" -Qunused-arguments"
- ;;
- esac
- # Fix up whitespace. Some older GDB releases (e.g. 6.8a) get confused if there
- # are multiple consecutive spaces: sub-configure scripts replace them with a
- # single space and then complain that $CC value changed from that in
- # the master directory.
- CPP_for_gdb=`echo $CPP_for_gdb`
- CC_for_gdb=`echo $CC_for_gdb`
- CXX_for_gdb=`echo $CXX_for_gdb`
- LD_for_gdb=`echo $LD_for_gdb`
-
- # Disable binutils options when building from the binutils-gdb repo.
- cross_extra_config+=("--disable-binutils")
- cross_extra_config+=("--disable-ld")
- cross_extra_config+=("--disable-gas")
-
- CT_DoLog DEBUG "Extra config passed: '${cross_extra_config[*]}'"
-
- CT_DoExecLog CFG \
- CPP="${CPP_for_gdb}" \
- CC="${CC_for_gdb}" \
- CXX="${CXX_for_gdb}" \
- LD="${LD_for_gdb}" \
- ${CONFIG_SHELL} \
- "${gdb_src_dir}/configure" \
- --build=${CT_BUILD} \
- --host=${CT_HOST} \
- --target=${CT_TARGET} \
- --prefix="${CT_PREFIX_DIR}" \
- --with-build-sysroot="${CT_SYSROOT_DIR}" \
+ # Target libexpat resides in sysroot and does not have
+ # any dependencies, so just passing '-lexpat' to gcc is enough.
+ #
+ # By default gdb configure looks for expat in '$prefix/lib'
+ # directory. In our case '$prefix/lib' resolves to '/usr/lib'
+ # where libexpat for build platform lives, which is
+ # unacceptable for cross-compiling.
+ #
+ # To prevent this '--without-libexpat-prefix' flag must be passed.
+ # Thus configure falls back to '-lexpat', which is exactly what we want.
+ #
+ # NOTE: DO NOT USE --with-libexpat-prefix (until GDB configure is smarter)!!!
+ # It conflicts with a static build: GDB's configure script will find the shared
+ # version of expat and will attempt to link that, despite the -static flag.
+ # The link will fail, and configure will abort with "expat missing or unusable"
+ # message.
+ extra_config+=("--with-expat")
+ extra_config+=("--without-libexpat-prefix")
+
+ do_gdb_backend \
+ buildtype=cross \
+ host="${CT_HOST}" \
+ cflags="${CT_CFLAGS_FOR_HOST}" \
+ ldflags="${CT_LDFLAGS_FOR_HOST}" \
+ prefix="${CT_PREFIX_DIR}" \
+ static="${CT_GDB_CROSS_STATIC}" \
--with-sysroot="${CT_SYSROOT_DIR}" \
- --disable-werror \
- "${cross_extra_config[@]}" \
- "${CT_GDB_CROSS_EXTRA_CONFIG_ARRAY[@]}"
-
- CT_DoLog EXTRA "Building cross-gdb"
- CT_DoExecLog ALL make ${JOBSFLAGS}
-
- CT_DoLog EXTRA "Installing cross-gdb"
- CT_DoExecLog ALL make install
+ "${cross_extra_config[@]}"
if [ "${CT_BUILD_MANUALS}" = "y" ]; then
CT_DoLog EXTRA "Building and installing the cross-GDB manuals"
- CT_DoExecLog ALL make ${JOBSFLAGS} pdf html
+ CT_DoExecLog ALL make ${CT_JOBSFLAGS} pdf html
CT_DoExecLog ALL make install-{pdf,html}-gdb
fi
- if [ "${CT_GDB_INSTALL_GDBINIT}" = "y" ]; then
- CT_DoLog EXTRA "Installing '.gdbinit' template"
- # See in scripts/build/internals.sh for why we do this
- if [ -f "${CT_SRC_DIR}/gcc-${CT_CC_GCC_VERSION}/gcc/BASE-VER" ]; then
- gcc_version=$( cat "${CT_SRC_DIR}/gcc-${CT_CC_GCC_VERSION}/gcc/BASE-VER" )
- else
- gcc_version=$(sed -r -e '/version_string/!d; s/^.+= "([^"]+)".*$/\1/;' \
- "${CT_SRC_DIR}/gcc-${CT_CC_GCC_VERSION}/gcc/version.c" \
- )
- fi
- sed -r \
- -e "s:@@PREFIX@@:${CT_PREFIX_DIR}:;" \
- -e "s:@@VERSION@@:${gcc_version}:;" \
- "${CT_LIB_DIR}/scripts/build/debug/gdbinit.in" \
- >"${CT_PREFIX_DIR}/share/gdb/gdbinit"
- fi # Install gdbinit sample
+ CT_DoLog EXTRA "Installing '.gdbinit' template"
+ # See in scripts/build/internals.sh for why we do this
+ # TBD GCC 3.x and older not supported
+ if [ -f "${CT_SRC_DIR}/gcc/gcc/BASE-VER" ]; then
+ gcc_version=$(cat "${CT_SRC_DIR}/gcc/gcc/BASE-VER")
+ else
+ gcc_version=$(sed -r -e '/version_string/!d; s/^.+= "([^"]+)".*$/\1/;' \
+ "${CT_SRC_DIR}/gcc/gcc/version.c" \
+ )
+ fi
+ sed -r \
+ -e "s:@@PREFIX@@:${CT_PREFIX_DIR}:;" \
+ -e "s:@@VERSION@@:${gcc_version}:;" \
+ "${CT_LIB_DIR}/scripts/build/debug/gdbinit.in" \
+ >"${CT_PREFIX_DIR}/share/gdb/gdbinit"
+ CT_Popd
CT_EndStep
fi
if [ "${CT_GDB_NATIVE}" = "y" ]; then
local -a native_extra_config
+ local subdir
CT_DoStep INFO "Installing native gdb"
+ CT_mkdir_pushd "${CT_BUILD_DIR}/build-gdb-native"
- native_extra_config=("${extra_config[@]}")
+ native_extra_config+=("--program-prefix=")
- # We may not have C++ language configured for target
- native_extra_config+=("--disable-build-with-cxx")
+ # gdbserver gets enabled by default with gdb
+ # since gdbserver was promoted to top-level
+ if [ "${CT_GDB_GDBSERVER_TOPLEVEL}" = "y" ]; then
+ native_extra_config+=("--disable-gdbserver")
+ fi
# GDB on Mingw depends on PDcurses, not ncurses
if [ "${CT_MINGW32}" != "y" ]; then
native_extra_config+=("--with-curses")
fi
+ if [ "${CT_GDB_NATIVE_BUILD_IPA_LIB}" = "y" ]; then
+ native_extra_config+=("--enable-inprocess-agent")
+ else
+ native_extra_config+=("--disable-inprocess-agent")
+ fi
+
+ export ac_cv_func_strncmp_works=yes
+
+ # TBD do we need all these?
+ native_extra_config+=(
+ --without-uiout
+ --disable-gdbtk
+ --without-x
+ --disable-sim
+ --without-included-gettext
+ --without-develop
+ --sysconfdir=/etc
+ --localstatedir=/var
+ )
+
# Target libexpat resides in sysroot and does not have
# any dependencies, so just passing '-lexpat' to gcc is enough.
#
@@ -201,146 +161,194 @@ do_debug_gdb_build() {
# version of expat and will attempt to link that, despite the -static flag.
# The link will fail, and configure will abort with "expat missing or unusable"
# message.
- native_extra_config+=("--with-expat")
- native_extra_config+=("--without-libexpat-prefix")
+ extra_config+=("--with-expat")
+ extra_config+=("--without-libexpat-prefix")
+
+ do_gdb_backend \
+ buildtype=native \
+ subdir=${subdir} \
+ host="${CT_TARGET}" \
+ cflags="${CT_ALL_TARGET_CFLAGS}" \
+ ldflags="${CT_ALL_TARGET_LDFLAGS}" \
+ static="${CT_GDB_NATIVE_STATIC}" \
+ static_libstdc="${CT_GDB_NATIVE_STATIC_LIBSTDC}" \
+ prefix=/usr \
+ destdir="${CT_DEBUGROOT_DIR}" \
+ "${native_extra_config[@]}"
- CT_DoLog EXTRA "Configuring native gdb"
+ unset ac_cv_func_strncmp_works
- mkdir -p "${CT_BUILD_DIR}/build-gdb-native"
- cd "${CT_BUILD_DIR}/build-gdb-native"
+ CT_Popd
+ CT_EndStep # native gdb build
+ fi
- case "${CT_THREADS}" in
- none) native_extra_config+=("--disable-threads");;
- *) native_extra_config+=("--enable-threads");;
- esac
+ if [ "${CT_GDB_GDBSERVER}" = "y" ]; then
+ local -a native_extra_config
+ local subdir
- [ "${CT_TOOLCHAIN_ENABLE_NLS}" != "y" ] && \
- native_extra_config+=("--disable-nls")
-
- CPP_for_gdb="${CT_TARGET}-cpp"
- CC_for_gdb="${CT_TARGET}-${CT_CC}"
- CXX_for_gdb="${CT_TARGET}-g++"
- LD_for_gdb="${CT_TARGET}-ld"
- if [ "${CT_GDB_NATIVE_STATIC}" = "y" ]; then
- CC_for_gdb+=" -static"
- CXX_for_gdb+=" -static"
- LD_for_gdb+=" -static"
+ if [ "${CT_GDB_GDBSERVER_TOPLEVEL}" != "y" ]; then
+ subdir=gdb/gdbserver/
+ else
+ native_extra_config+=("--disable-gdb")
fi
- export ac_cv_func_strncmp_works=yes
+ CT_DoStep INFO "Installing gdb server"
+ CT_mkdir_pushd "${CT_BUILD_DIR}/build-gdb-server"
- # Disable binutils options when building from the binutils-gdb repo.
- native_extra_config+=("--disable-binutils")
- native_extra_config+=("--disable-ld")
- native_extra_config+=("--disable-gas")
-
- CT_DoLog DEBUG "Extra config passed: '${native_extra_config[*]}'"
-
- CT_DoExecLog CFG \
- CPP="${CPP_for_gdb}" \
- CC="${CC_for_gdb}" \
- CXX="${CXX_for_gdb}" \
- LD="${LD_for_gdb}" \
- ${CONFIG_SHELL} \
- "${gdb_src_dir}/configure" \
- --build=${CT_BUILD} \
- --host=${CT_TARGET} \
- --target=${CT_TARGET} \
- --prefix=/usr \
- --with-build-sysroot="${CT_SYSROOT_DIR}" \
- --without-uiout \
- --disable-tui \
- --disable-gdbtk \
- --without-x \
- --disable-sim \
- --disable-werror \
- --without-included-gettext \
- --without-develop \
- "${native_extra_config[@]}"
+ native_extra_config+=("--program-prefix=")
+ native_extra_config+=("--enable-gdbserver")
- CT_DoLog EXTRA "Building native gdb"
- CT_DoExecLog ALL make ${JOBSFLAGS}
+ if [ "${CT_GDB_NATIVE_BUILD_IPA_LIB}" = "y" ]; then
+ native_extra_config+=("--enable-inprocess-agent")
+ else
+ native_extra_config+=("--disable-inprocess-agent")
+ fi
- CT_DoLog EXTRA "Installing native gdb"
- CT_DoExecLog ALL make DESTDIR="${CT_DEBUGROOT_DIR}" install
+ export ac_cv_func_strncmp_works=yes
- # Building a native gdb also builds a gdbserver
- find "${CT_DEBUGROOT_DIR}" -type f -name gdbserver -exec rm -fv {} \; 2>&1 |CT_DoLog ALL
+ # TBD do we need all these?
+ native_extra_config+=(
+ --without-uiout
+ --disable-gdbtk
+ --without-x
+ --disable-sim
+ --without-included-gettext
+ --without-develop
+ --sysconfdir=/etc
+ --localstatedir=/var
+ )
+
+ do_gdb_backend \
+ buildtype=native \
+ subdir=${subdir} \
+ host="${CT_TARGET}" \
+ cflags="${CT_ALL_TARGET_CFLAGS}" \
+ ldflags="${CT_ALL_TARGET_LDFLAGS}" \
+ static="${CT_GDB_NATIVE_STATIC}" \
+ static_libstdcxx="${CT_GDB_NATIVE_STATIC_LIBSTDCXX}" \
+ prefix=/usr \
+ destdir="${CT_DEBUGROOT_DIR}" \
+ "${native_extra_config[@]}"
unset ac_cv_func_strncmp_works
- CT_EndStep # native gdb build
+ CT_Popd
+ CT_EndStep # gdb server build
fi
+}
- if [ "${CT_GDB_GDBSERVER}" = "y" ]; then
- local -a gdbserver_extra_config
- local gdbserver_LDFLAGS
+do_gdb_backend()
+{
+ local host prefix destdir cflags ldflags static buildtype subdir
+ local -a extra_config
- CT_DoStep INFO "Installing gdbserver"
- CT_DoLog EXTRA "Configuring gdbserver"
+ for arg in "$@"; do
+ case "$arg" in
+ --*)
+ extra_config+=("${arg}")
+ ;;
+ *)
+ eval "${arg// /\\ }"
+ ;;
+ esac
+ done
+
+ # Starting with glibc 2.25, it now provides a <proc_service.h> header. The
+ # problem is that GDB releases prior to 7.12 used to implement one of the
+ # interfaces, ps_get_thread_are with a const qualifier on one of the arguments.
+ # Therefore, such older versions cannot be compiled against a newer glibc.
+ # If we detect such a combination, mitigate by creating a local proc_service.h
+ # with a prototype adjusted for GDB requirements.
+ if [ -r "${CT_HEADERS_DIR}/proc_service.h" -a "${CT_GDB_CONST_GET_THREAD_AREA}" = "y" ]; then
+ CT_DoLog DEBUG "Fixing up the prototype in <proc_service.h>"
+ CT_DoExecLog ALL mkdir -p gdb/gdbserver
+ CT_DoExecLog ALL cp "${CT_HEADERS_DIR}/proc_service.h" gdb/proc_service.h
+ CT_DoExecLog ALL sed -i \
+ "s/\(ps_get_thread_area *(\).*\(struct ps_prochandle\)/\1const \2/" \
+ gdb/proc_service.h
+ CT_DoExecLog ALL cp gdb/proc_service.h gdb/gdbserver/proc_service.h
+ fi
- mkdir -p "${CT_BUILD_DIR}/build-gdb-gdbserver"
- cd "${CT_BUILD_DIR}/build-gdb-gdbserver"
+ [ -n "${CT_PKGVERSION}" ] && extra_config+=("--with-pkgversion=${CT_PKGVERSION}")
+ [ -n "${CT_TOOLCHAIN_BUGURL}" ] && extra_config+=("--with-bugurl=${CT_TOOLCHAIN_BUGURL}")
- # Workaround for bad versions, where the configure
- # script for gdbserver is not executable...
- # Bah, GNU folks strike again... :-(
- chmod +x "${gdb_src_dir}/gdb/gdbserver/configure"
+ # Disable binutils options when building from the binutils-gdb repo.
+ extra_config+=("--disable-binutils")
+ extra_config+=("--disable-ld")
+ extra_config+=("--disable-gas")
- gdbserver_LDFLAGS=
- if [ "${CT_GDB_GDBSERVER_STATIC}" = "y" ]; then
- gdbserver_LDFLAGS=-static
- fi
+ if [ "${CT_GDB_HAS_DISABLE_CXX_BUILD}" = "y" ]; then
+ extra_config+=("--disable-build-with-cxx")
+ fi
- gdbserver_extra_config=("${extra_config[@]}")
+ case "${CT_THREADS}" in
+ none) extra_config+=("--disable-threads");;
+ *) extra_config+=("--enable-threads");;
+ esac
- # We may not have C++ language configured for target
- gdbserver_extra_config+=("--disable-build-with-cxx")
+ if [ "${CT_TOOLCHAIN_ENABLE_NLS}" != "y" ]; then
+ extra_config+=("--disable-nls")
+ fi
- if [ "${CT_GDB_GDBSERVER_HAS_IPA_LIB}" = "y" ]; then
- if [ "${CT_GDB_GDBSERVER_BUILD_IPA_LIB}" = "y" ]; then
- gdbserver_extra_config+=( --enable-inprocess-agent )
- else
- gdbserver_extra_config+=( --disable-inprocess-agent )
- fi
- fi
+ if [ "${static}" = "y" ]; then
+ cflags+=" -static"
+ ldflags+=" -static"
+ # There is no static libsource-highlight
+ extra_config+=("--disable-source-highlight")
+ fi
+ if [ "${static_libstdcxx}" = "y" ]; then
+ ldflags+=" -static-libgcc"
+ ldflags+=" -static-libstdc++"
+ # libsource-highlight is a dynamic library that uses exception
+ # exceptions are handled by libstdc++
+ # this combination is very buggy, so configure don't use it and abort
+ extra_config+=("--disable-source-highlight")
+ fi
- # Disable binutils options when building from the binutils-gdb repo.
- gdbserver_extra_config+=("--disable-binutils")
- gdbserver_extra_config+=("--disable-ld")
- gdbserver_extra_config+=("--disable-gas")
-
- CT_DoExecLog CFG \
- CC="${CT_TARGET}-${CT_CC}" \
- CPP="${CT_TARGET}-cpp" \
- LD="${CT_TARGET}-ld" \
- LDFLAGS="${gdbserver_LDFLAGS}" \
- ${CONFIG_SHELL} \
- "${gdb_src_dir}/gdb/gdbserver/configure" \
- --build=${CT_BUILD} \
- --host=${CT_TARGET} \
- --target=${CT_TARGET} \
- --prefix=/usr \
- --sysconfdir=/etc \
- --localstatedir=/var \
- --includedir="${CT_HEADERS_DIR}" \
- --with-build-sysroot="${CT_SYSROOT_DIR}" \
- --program-prefix= \
- --without-uiout \
- --disable-tui \
- --disable-gdbtk \
- --without-x \
- --without-included-gettext \
- --without-develop \
- --disable-werror \
- "${gdbserver_extra_config[@]}"
-
- CT_DoLog EXTRA "Building gdbserver"
- CT_DoExecLog ALL make ${JOBSFLAGS} CC=${CT_TARGET}-${CT_CC}
-
- CT_DoLog EXTRA "Installing gdbserver"
- CT_DoExecLog ALL make DESTDIR="${CT_DEBUGROOT_DIR}" install
- CT_EndStep
+ # Fix up whitespace. Some older GDB releases (e.g. 6.8a) get confused if there
+ # are multiple consecutive spaces: sub-configure scripts replace them with a
+ # single space and then complain that $CC value changed from that in
+ # the master directory.
+ cflags=`echo ${cflags}`
+ ldflags=`echo ${ldflags}`
+
+ CT_DoLog EXTRA "Configuring ${buildtype} gdb"
+ CT_DoLog DEBUG "Extra config passed: '${extra_config[*]}'"
+
+ # Run configure/make in the matching subdirectory so that any fixups
+ # prepared in a given subdirectory apply.
+ if [ -n "${subdir}" ]; then
+ CT_mkdir_pushd "${subdir}"
+ fi
+
+ # TBD: is passing CPP/CC/CXX/LD needed? GCC should be determining this automatically from the triplets
+ CT_DoExecLog CFG \
+ CPP="${host}-cpp" \
+ CC="${host}-gcc" \
+ CXX="${host}-g++" \
+ LD="${host}-ld" \
+ CFLAGS="${cflags}" \
+ CXXFLAGS="${cflags}" \
+ LDFLAGS="${ldflags}" \
+ ${CONFIG_SHELL} \
+ "${CT_SRC_DIR}/gdb/${subdir}configure" \
+ --build=${CT_BUILD} \
+ --host=${host} \
+ --target=${CT_TARGET} \
+ --prefix="${prefix}" \
+ --with-build-sysroot="${CT_SYSROOT_DIR}" \
+ --includedir="${CT_HEADERS_DIR}" \
+ --disable-werror \
+ "${extra_config[@]}" \
+
+ CT_DoLog EXTRA "Building ${buildtype} gdb"
+ CT_DoExecLog ALL make ${CT_JOBSFLAGS}
+
+ CT_DoLog EXTRA "Installing ${buildtype} gdb"
+ CT_DoExecLog ALL make install ${destdir:+DESTDIR="${destdir}"}
+
+ if [ -n "${subdir}" ]; then
+ CT_Popd
fi
}
diff --git a/scripts/build/debug/400-ltrace.sh b/scripts/build/debug/400-ltrace.sh
index 6b860e9..9c9052a 100644
--- a/scripts/build/debug/400-ltrace.sh
+++ b/scripts/build/debug/400-ltrace.sh
@@ -1,19 +1,11 @@
# Build script for ltrace
do_debug_ltrace_get() {
- CT_GetFile "ltrace_${CT_LTRACE_VERSION}.orig" .tar.gz \
- {http,ftp}://ftp.debian.org/debian/pool/main/l/ltrace/
- # Create a link so that the following steps are easier to do:
- CT_Pushd "${CT_TARBALLS_DIR}"
- ltrace_ext=$(CT_GetFileExtension "ltrace_${CT_LTRACE_VERSION}.orig")
- ln -sf "ltrace_${CT_LTRACE_VERSION}.orig${ltrace_ext}" \
- "ltrace-${CT_LTRACE_VERSION}${ltrace_ext}"
- CT_Popd
+ CT_Fetch LTRACE
}
do_debug_ltrace_extract() {
- CT_Extract "ltrace-${CT_LTRACE_VERSION}"
- CT_Patch "ltrace" "${CT_LTRACE_VERSION}"
+ CT_ExtractPatch LTRACE
}
do_debug_ltrace_build() {
@@ -22,37 +14,17 @@ do_debug_ltrace_build() {
CT_DoStep INFO "Installing ltrace"
CT_DoLog EXTRA "Copying sources to build dir"
- CT_DoExecLog ALL cp -av "${CT_SRC_DIR}/ltrace-${CT_LTRACE_VERSION}/." \
+ CT_DoExecLog ALL cp -av "${CT_SRC_DIR}/ltrace/." \
"${CT_BUILD_DIR}/build-ltrace"
CT_Pushd "${CT_BUILD_DIR}/build-ltrace"
CT_DoLog EXTRA "Configuring ltrace"
- # ltrace-0.5.3 has a unique hand-crafted configure script. Releases
- # 0.5.2 and earlier as well as 0.6.0 and later use GNU autotools.
- if [ "${LTRACE_0_5_3_CONFIGURE}" = "y" ]; then
- case "${CT_ARCH}:${CT_ARCH_BITNESS}" in
- x86:32) ltrace_host="i386";;
- x86:64) ltrace_host="x86_64";;
- powerpc:*) ltrace_host="ppc";;
- mips:*) ltrace_host="mipsel";;
- *) ltrace_host="${CT_ARCH}";;
- esac
- CT_DoExecLog CFG \
- CC="${CT_TARGET}-${CT_CC}" \
- AR="${CT_TARGET}-ar" \
- HOST="${ltrace_host}" \
- HOST_OS="${CT_TARGET_KERNEL}" \
- CFLAGS="${CT_TARGET_CFLAGS}" \
- ${CONFIG_SHELL} \
- ./configure --prefix=/usr
- else
- CT_DoExecLog CFG \
- ${CONFIG_SHELL} \
- ./configure \
- --build=${CT_BUILD} \
- --host=${CT_TARGET} \
- --prefix=/usr
- fi
+ CT_DoExecLog CFG \
+ ${CONFIG_SHELL} \
+ ./configure \
+ --build=${CT_BUILD} \
+ --host=${CT_TARGET} \
+ --prefix=/usr
CT_DoLog EXTRA "Building ltrace"
CT_DoExecLog ALL make
@@ -63,4 +35,3 @@ do_debug_ltrace_build() {
CT_Popd
CT_EndStep
}
-
diff --git a/scripts/build/debug/500-strace.sh b/scripts/build/debug/500-strace.sh
index 6eb2357..c28af35 100644
--- a/scripts/build/debug/500-strace.sh
+++ b/scripts/build/debug/500-strace.sh
@@ -1,32 +1,44 @@
# Build script for strace
-do_debug_strace_get() {
- local base_url="http://downloads.sourceforge.net/project/strace/strace"
- CT_GetFile "strace-${CT_STRACE_VERSION}" "${base_url}/${CT_STRACE_VERSION}"
- # Downloading from sourceforge leaves garbage, cleanup
- CT_DoExecLog ALL rm -f "${CT_TARBALLS_DIR}/showfiles.php"*
+do_debug_strace_get()
+{
+ CT_Fetch STRACE
}
-do_debug_strace_extract() {
- CT_Extract "strace-${CT_STRACE_VERSION}"
- CT_Patch "strace" "${CT_STRACE_VERSION}"
+do_debug_strace_extract()
+{
+ CT_ExtractPatch STRACE
}
-do_debug_strace_build() {
+do_debug_strace_build()
+{
+ local cflags="${CT_ALL_TARGET_CFLAGS}"
+
CT_DoStep INFO "Installing strace"
+ if [ "${CT_LIBC_MUSL}" = "y" ]; then
+ # Otherwise kernel headers cause errors when included, e.g.
+ # <netinet/in.h> and <linux/in6.h>. Kernel's libc-compat.h
+ # only cares about GLIBC. uClibc-ng does the same
+ # internally, pretending it's GLIBC for kernel headers inclusion.
+ cflags+=" -D__GLIBC__ -D__USE_MISC"
+ fi
+
CT_mkdir_pushd "${CT_BUILD_DIR}/build-strace"
CT_DoLog EXTRA "Configuring strace"
CT_DoExecLog CFG \
CC="${CT_TARGET}-${CT_CC}" \
+ CFLAGS="${cflags}" \
+ LDFLAGS="${CT_ALL_TARGET_LDFLAGS}" \
CPP="${CT_TARGET}-cpp" \
LD="${CT_TARGET}-ld" \
${CONFIG_SHELL} \
- "${CT_SRC_DIR}/strace-${CT_STRACE_VERSION}/configure" \
+ "${CT_SRC_DIR}/strace/configure" \
--build=${CT_BUILD} \
--host=${CT_TARGET} \
- --prefix=/usr
+ --prefix=/usr \
+ --enable-mpers=check
CT_DoLog EXTRA "Building strace"
CT_DoExecLog ALL make