Convert expat for target into a companion lib.

Expat-for-host to be done.

Signed-off-by: Alexey Neyman <stilor@att.net>
This commit is contained in:
Alexey Neyman 2015-11-06 22:15:11 -08:00
parent 6f7e6b9969
commit ac7ce38475
7 changed files with 109 additions and 57 deletions

View File

@ -53,6 +53,11 @@ config LIBELF_NEEDED
select LIBELF
select COMPLIBS_NEEDED
config EXPAT_NEEDED
bool
select EXPAT
select COMPLIBS_NEEDED
config COMPLIBS
bool
@ -101,6 +106,13 @@ config LIBELF
config LIBELF_TARGET
bool
config EXPAT
bool
select COMPLIBS
config EXPAT_TARGET
bool
if LIBICONV
source "config/companion_libs/libiconv.in"
endif
@ -130,9 +142,11 @@ comment "libelf version needed to build for target"
depends on !LIBELF
source "config/companion_libs/libelf.in"
endif
config FOO
bool
if EXPAT || EXPAT_TARGET
comment "expat version needed to build for target"
depends on !EXPAT
source "config/companion_libs/expat.in"
endif
if COMPLIBS

View File

@ -0,0 +1,19 @@
# expat config file
choice
bool
prompt "expat version"
# Don't remove next line
# CT_INSERT_VERSION_BELOW
config EXPAT_V_2_1_0
bool
prompt "2.1.0"
endchoice
config EXPAT_VERSION
string
# Don't remove next line
# CT_INSERT_VERSION_STRING_BELOW
default "2.1.0" if EXPAT_V_2_1_0

View File

@ -5,6 +5,7 @@ config GDB_NATIVE
prompt "Native gdb"
depends on ! BARE_METAL
depends on ! BACKEND
select EXPAT_TARGET
help
Build and install a native gdb for the target, to run on the target.

View File

@ -18,7 +18,7 @@ doHelp() {
'tool' in one of:
gcc, binutils, glibc, uClibc, newlib, linux, gdb, dmalloc,
duma, strace, ltrace, libelf, gmp, mpfr, ppl, cloog, mpc,
mingw-w64
mingw-w64, expat
Valid options for all tools:
--stable, -s, +x (default)
@ -191,6 +191,7 @@ while [ $# -gt 0 ]; do
--cloog) EXP=; OBS=; cat=CLOOG; tool=cloog; tool_prefix=companion_libs; dot2suffix=;;
--mpc) EXP=; OBS=; cat=MPC; tool=mpc; tool_prefix=companion_libs; dot2suffix=;;
--libelf) EXP=; OBS=; cat=LIBELF; tool=libelf; tool_prefix=companion_libs; dot2suffix=;;
--expat) EXP=; OBS=; cat=EXPAT; tool=expat; tool_prefix=companion_libs; dot2suffix=;;
# Tools options:
-x|--experimental|+s) EXP=1;;

View File

@ -0,0 +1,67 @@
# Build script for expat
do_expat_get() { :; }
do_expat_extract() { :; }
do_expat_for_build() { :; }
do_expat_for_host() { :; }
do_expat_for_target() { :; }
if [ "${CT_EXPAT_TARGET}" = "y" -o "${CT_EXPAT}" = "y" ]; then
do_expat_get() {
CT_GetFile "expat-${CT_EXPAT_VERSION}" .tar.gz \
http://downloads.sourceforge.net/project/expat/expat/${CT_EXPAT_VERSION}
}
do_expat_extract() {
CT_Extract "expat-${CT_EXPAT_VERSION}"
CT_Patch "expat" "${CT_EXPAT_VERSION}"
}
if [ "${CT_EXPAT_TARGET}" = "y" ]; then
do_expat_for_target() {
CT_DoStep INFO "Installing expat for target"
CT_mkdir_pushd "${CT_BUILD_DIR}/build-expat-target-${CT_TARGET}"
do_expat_backend host="${CT_TARGET}" \
prefix="/usr" \
destdir="${CT_SYSROOT_DIR}"
CT_Popd
CT_EndStep
}
fi
# Build libexpat
# Parameter : description : type : default
# host : machine to run on : tuple : (none)
# prefix : prefix to install into : dir : (none)
# destdir : install destination : dir : (none)
do_expat_backend() {
local host
local prefix
local cflags
local ldflags
local arg
for arg in "$@"; do
eval "${arg// /\\ }"
done
CT_DoLog EXTRA "Configuring expat"
CT_DoExecLog CFG \
"${CT_SRC_DIR}/expat-${CT_EXPAT_VERSION}/configure" \
--build=${CT_BUILD} \
--host=${host} \
--prefix="${prefix}" \
--enable-static \
--disable-shared
CT_DoLog EXTRA "Building expat"
CT_DoExecLog ALL make ${JOBSFLAGS}
CT_DoLog EXTRA "Installing expat"
CT_DoExecLog ALL make install INSTALL_ROOT="${destdir}"
}
fi

View File

@ -6,13 +6,9 @@
# config options for this.
CT_DEBUG_GDB_NCURSES_VERSION="5.9"
# Ditto for the expat library
CT_DEBUG_GDB_EXPAT_VERSION="2.1.0"
do_debug_gdb_parts() {
need_gdb_src=
need_ncurses_src=
need_expat_src=
if [ "${CT_GDB_CROSS}" = y ]; then
need_gdb_src=y
@ -28,7 +24,6 @@ do_debug_gdb_parts() {
if [ "${CT_MINGW32}" != "y" ]; then
need_ncurses_src=y
fi
need_expat_src=y
fi
}
@ -70,11 +65,6 @@ do_debug_gdb_get() {
{http,ftp,https}://ftp.gnu.org/pub/gnu/ncurses \
ftp://invisible-island.net/ncurses
fi
if [ "${need_expat_src}" = "y" ]; then
CT_GetFile "expat-${CT_DEBUG_GDB_EXPAT_VERSION}" .tar.gz \
http://downloads.sourceforge.net/project/expat/expat/${CT_DEBUG_GDB_EXPAT_VERSION}
fi
}
do_debug_gdb_extract() {
@ -96,11 +86,6 @@ do_debug_gdb_extract() {
CT_Patch "ncurses" "${CT_DEBUG_GDB_NCURSES_VERSION}"
fi
if [ "${need_expat_src}" = "y" ]; then
CT_Extract "expat-${CT_DEBUG_GDB_EXPAT_VERSION}"
CT_Patch "expat" "${CT_DEBUG_GDB_EXPAT_VERSION}"
fi
if [ -n "${CT_ARCH_XTENSA_CUSTOM_NAME}" ]; then
CT_ConfigureXtensa "gdb" "${CT_GDB_VERSION}"
fi
@ -234,16 +219,7 @@ do_debug_gdb_build() {
gdb_native_CFLAGS+=("-L${CT_BUILD_DIR}/static-target/lib")
fi # need_ncurses_src
# Build libexpat
CT_DoLog EXTRA "Building static target expat"
CT_mkdir_pushd "${CT_BUILD_DIR}/build-expat-target-${CT_TARGET}"
do_gdb_expat_backend host="${CT_TARGET}" \
prefix="${CT_BUILD_DIR}/static-target" \
cflags="" \
ldflags=""
CT_Popd
native_extra_config+=("--with-expat")
native_extra_config+=("--with-libexpat-prefix=${CT_BUILD_DIR}/static-target")
CT_DoLog EXTRA "Configuring native gdb"
@ -442,32 +418,3 @@ do_gdb_ncurses_backend() {
CT_Popd
}
# Build libexpat
# 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_expat_backend() {
local host
local prefix
local cflags
local ldflags
local arg
for arg in "$@"; do
eval "${arg// /\\ }"
done
CT_DoExecLog CFG \
"${CT_SRC_DIR}/expat-${CT_DEBUG_GDB_EXPAT_VERSION}/configure" \
--build=${CT_BUILD} \
--host=${host} \
--prefix="${prefix}" \
--enable-static \
--disable-shared
CT_DoExecLog ALL make ${JOBSFLAGS}
CT_DoExecLog ALL make install
}

View File

@ -63,12 +63,14 @@ dump_single_sample() {
-o -n "${CT_CLOOG}" \
-o -n "${CT_MPC}" \
-o -n "${CT_LIBELF}" \
-o -n "${CT_EXPAT}" \
-o -n "${CT_GMP_TARGET}" \
-o -n "${CT_MPFR_TARGET}" \
-o -n "${CT_PPL_TARGET}" \
-o -n "${CT_CLOOG_TARGET}" \
-o -n "${CT_MPC_TARGET}" \
-o -n "${CT_LIBELF_TARGET}" \
-o -n "${CT_EXPAT_TARGET}" \
]; then
printf " %-*s :" ${width} "Companion libs"
complibs=1
@ -79,6 +81,7 @@ dump_single_sample() {
[ -z "${CT_CLOOG}" -a -z "${CT_CLOOG_TARGET}" ] || printf " cloog-ppl-%s" "${CT_CLOOG_VERSION}"
[ -z "${CT_MPC}" -a -z "${CT_MPC_TARGET}" ] || printf " mpc-%s" "${CT_MPC_VERSION}"
[ -z "${CT_LIBELF}" -a -z "${CT_LIBELF_TARGET}" ] || printf " libelf-%s" "${CT_LIBELF_VERSION}"
[ -z "${CT_EXPAT}" -a -z "${CT_EXPAT_TARGET}" ] || printf " expat-%s" "${CT_EXPAT_VERSION}"
[ -z "${complibs}" ] || printf "\n"
printf " %-*s : %s\n" ${width} "binutils" "binutils-${CT_BINUTILS_VERSION}"
printf " %-*s :" ${width} "C compilers"