summaryrefslogtreecommitdiff
path: root/scripts/build
diff options
context:
space:
mode:
authorAlexey Neyman <stilor@att.net>2016-12-06 02:24:05 (GMT)
committerGitHub <noreply@github.com>2016-12-06 02:24:05 (GMT)
commitf5a375e4070e484a5fc196f1cb2014f528693ed9 (patch)
treeae42cf48cac90a24dcb4d8994173ddc1974b289d /scripts/build
parent4042269de621e166235308f139e89c92e379040d (diff)
parentee1c04378c471dfea04808963db78a91fc89d62e (diff)
Merge pull request #443 from KirillSmirnov/gdb-native
debug/gdb: properly link with expat
Diffstat (limited to 'scripts/build')
-rw-r--r--scripts/build/companion_libs/200-libelf.sh13
-rwxr-xr-xscripts/build/companion_libs/210-expat.sh11
-rw-r--r--scripts/build/companion_libs/220-ncurses.sh12
-rw-r--r--scripts/build/debug/300-gdb.sh23
4 files changed, 54 insertions, 5 deletions
diff --git a/scripts/build/companion_libs/200-libelf.sh b/scripts/build/companion_libs/200-libelf.sh
index e00fa16..7d01563 100644
--- a/scripts/build/companion_libs/200-libelf.sh
+++ b/scripts/build/companion_libs/200-libelf.sh
@@ -69,13 +69,24 @@ if [ "${CT_LIBELF_TARGET}" = "y" ]; then
do_libelf_for_target() {
local -a libelf_opts
+ local prefix
CT_DoStep INFO "Installing libelf for the target"
CT_mkdir_pushd "${CT_BUILD_DIR}/build-libelf-target-${CT_TARGET}"
+ case "${CT_TARGET}" in
+ *-*-mingw*)
+ prefix="/mingw"
+ ;;
+ *)
+ prefix="/usr"
+ ;;
+ esac
+
libelf_opts+=( "destdir=${CT_SYSROOT_DIR}" )
libelf_opts+=( "host=${CT_TARGET}" )
- libelf_opts+=( "prefix=/usr" )
+
+ libelf_opts+=( "prefix=${prefix}" )
libelf_opts+=( "shared=y" )
do_libelf_backend "${libelf_opts[@]}"
diff --git a/scripts/build/companion_libs/210-expat.sh b/scripts/build/companion_libs/210-expat.sh
index e627673..3a6deb5 100755
--- a/scripts/build/companion_libs/210-expat.sh
+++ b/scripts/build/companion_libs/210-expat.sh
@@ -43,12 +43,21 @@ fi
if [ "${CT_EXPAT_TARGET}" = "y" ]; then
do_expat_for_target() {
local -a expat_opts
+ local prefix
CT_DoStep INFO "Installing expat for target"
CT_mkdir_pushd "${CT_BUILD_DIR}/build-expat-target-${CT_TARGET}"
expat_opts+=( "host=${CT_TARGET}" )
- expat_opts+=( "prefix=/usr" )
+ case "${CT_TARGET}" in
+ *-*-mingw*)
+ prefix="/mingw"
+ ;;
+ *)
+ prefix="/usr"
+ ;;
+ esac
+ expat_opts+=( "prefix=${prefix}" )
expat_opts+=( "destdir=${CT_SYSROOT_DIR}" )
expat_opts+=( "static_build=y" )
diff --git a/scripts/build/companion_libs/220-ncurses.sh b/scripts/build/companion_libs/220-ncurses.sh
index 78a5513..6366049 100644
--- a/scripts/build/companion_libs/220-ncurses.sh
+++ b/scripts/build/companion_libs/220-ncurses.sh
@@ -72,13 +72,23 @@ fi
if [ "${CT_NCURSES_TARGET}" = "y" ]; then
do_ncurses_for_target() {
+ local prefix
+
CT_DoStep INFO "Installing ncurses for target"
CT_mkdir_pushd "${CT_BUILD_DIR}/build-ncurses-target-${CT_TARGET}"
opts=("--without-sysmouse")
[ "${CT_CC_LANG_CXX}" = "y" ] || opts+=("--without-cxx" "--without-cxx-binding")
[ "${CT_CC_LANG_ADA}" = "y" ] || opts+=("--without-ada")
+ case "${CT_TARGET}" in
+ *-*-mingw*)
+ prefix="/mingw"
+ ;;
+ *)
+ prefix="/usr"
+ ;;
+ esac
do_ncurses_backend host="${CT_TARGET}" \
- prefix="/usr" \
+ prefix="${prefix}" \
destdir="${CT_SYSROOT_DIR}" \
"${opts[@]}"
CT_Popd
diff --git a/scripts/build/debug/300-gdb.sh b/scripts/build/debug/300-gdb.sh
index 3396836..ba13591 100644
--- a/scripts/build/debug/300-gdb.sh
+++ b/scripts/build/debug/300-gdb.sh
@@ -68,12 +68,19 @@ do_debug_gdb_build() {
cd "${CT_BUILD_DIR}/build-gdb-cross"
cross_extra_config=("${extra_config[@]}")
- cross_extra_config+=("--with-expat")
+
+ # 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")
+
case "${CT_THREADS}" in
none) cross_extra_config+=("--disable-threads");;
*) cross_extra_config+=("--enable-threads");;
@@ -172,12 +179,24 @@ do_debug_gdb_build() {
native_extra_config+=("--with-curses")
fi
- native_extra_config+=("--with-expat")
+ # 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.
+ native_extra_config+=("--with-expat")
+ native_extra_config+=("--without-libexpat-prefix")
CT_DoLog EXTRA "Configuring native gdb"