[PATCH] Add zlib in case host's version is too old.
Johannes Stezenbach
js@sig21.net
Fri Feb 10 11:53:00 GMT 2012
zlib is used by both binutils and gdb and the build fails
on hosts which have a really old zlib version.
(gcc has its own zlib included)
Signed-off-by: Johannes Stezenbach <js@sig21.net>
diff -r e0d70cf2b396 -r cc5137ade317 config/companion_libs.in
--- a/config/companion_libs.in Thu Feb 09 13:09:08 2012 +0100
+++ b/config/companion_libs.in Fri Feb 10 12:14:16 2012 +0100
@@ -94,6 +94,19 @@
source "config/companion_libs/libelf.in"
endif
+config ZLIB
+ bool
+ prompt "zlib"
+ help
+ While gcc comes with its own zlib version, both binutils
+ and gdb use the zlib provided by the build host, which is
+ usually OK. Select this if the zlib on the build host is
+ really, really old.
+
+config ZLIB_VERSION
+ string
+ default "1.2.5"
+
config FOO
bool
diff -r e0d70cf2b396 -r cc5137ade317 scripts/build/binutils/binutils.sh
--- a/scripts/build/binutils/binutils.sh Thu Feb 09 13:09:08 2012 +0100
+++ b/scripts/build/binutils/binutils.sh Fri Feb 10 12:14:16 2012 +0100
@@ -74,6 +74,7 @@
CT_DoExecLog CFG \
CFLAGS="${CT_CFLAGS_FOR_HOST}" \
CXXFLAGS="${CT_CFLAGS_FOR_HOST}" \
+ CPPFLAGS="-I${CT_COMPLIBS_DIR}/include" \
"${CT_SRC_DIR}/binutils-${CT_BINUTILS_VERSION}/configure" \
--build=${CT_BUILD} \
--host=${CT_HOST} \
@@ -86,9 +87,11 @@
"${CT_BINUTILS_EXTRA_CONFIG_ARRAY[@]}"
if [ "${CT_STATIC_TOOLCHAIN}" = "y" ]; then
- extra_make_flags+=("LDFLAGS=-static -all-static")
+ extra_make_flags+=("LDFLAGS=-static -all-static -L${CT_COMPLIBS_DIR}/lib")
CT_DoLog EXTRA "Prepare binutils for static build"
CT_DoExecLog ALL make ${JOBSFLAGS} configure-host
+ else
+ extra_make_flags+=("LDFLAGS=-L${CT_COMPLIBS_DIR}/lib")
fi
CT_DoLog EXTRA "Building binutils"
diff -r e0d70cf2b396 -r cc5137ade317 scripts/build/companion_libs/zlib.sh
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/scripts/build/companion_libs/zlib.sh Fri Feb 10 12:14:16 2012 +0100
@@ -0,0 +1,45 @@
+# Build script for zlib
+
+do_zlib_get() { :; }
+do_zlib_extract() { :; }
+do_zlib() { :; }
+
+if [ "${CT_ZLIB}" = "y" ]; then
+
+do_zlib_get() {
+ CT_GetFile "zlib-${CT_ZLIB_VERSION}" http://zlib.net/
+}
+
+do_zlib_extract() {
+ CT_Extract "zlib-${CT_ZLIB_VERSION}"
+ CT_Patch "zlib" "${CT_ZLIB_VERSION}"
+}
+
+do_zlib() {
+ CT_DoStep INFO "Installing zlib"
+ mkdir -p "${CT_BUILD_DIR}/build-zlib"
+ CT_Pushd "${CT_BUILD_DIR}/build-zlib"
+
+ CT_DoLog EXTRA "Configuring zlib"
+
+ # zlib has non-standard configure which only works in the src tree
+ CT_DoExecLog ALL \
+ cp -al ${CT_SRC_DIR}/zlib-${CT_ZLIB_VERSION}/* .
+
+ CT_DoExecLog CFG \
+ CC="${CT_HOST}-gcc" \
+ AR="${CT_HOST}-ar" \
+ "./configure" --prefix="${CT_COMPLIBS_DIR}" --static
+
+ CT_DoLog EXTRA "Building zlib"
+ CT_DoExecLog ALL make
+
+ CT_DoLog EXTRA "Installing zlib"
+ CT_DoExecLog ALL cp libz.a ${CT_COMPLIBS_DIR}/lib/
+ CT_DoExecLog ALL cp zlib.h zconf.h ${CT_COMPLIBS_DIR}/include/
+
+ CT_Popd
+ CT_EndStep
+}
+
+fi # CT_ZLIB
diff -r e0d70cf2b396 -r cc5137ade317 scripts/build/debug/300-gdb.sh
--- a/scripts/build/debug/300-gdb.sh Thu Feb 09 13:09:08 2012 +0100
+++ b/scripts/build/debug/300-gdb.sh Fri Feb 10 12:14:16 2012 +0100
@@ -143,6 +143,8 @@
CT_DoExecLog CFG \
CC="${CC_for_gdb}" \
LD="${LD_for_gdb}" \
+ CPPFLAGS="-I${CT_COMPLIBS_DIR}/include" \
+ LDFLAGS="-L${CT_COMPLIBS_DIR}/lib" \
"${gdb_cross_configure}" \
--build=${CT_BUILD} \
--host=${CT_HOST} \
diff -r e0d70cf2b396 -r cc5137ade317 scripts/crosstool-NG.sh.in
--- a/scripts/crosstool-NG.sh.in Thu Feb 09 13:09:08 2012 +0100
+++ b/scripts/crosstool-NG.sh.in Fri Feb 10 12:14:16 2012 +0100
@@ -121,6 +121,7 @@
. "${CT_LIB_DIR}/scripts/build/companion_libs/cloog.sh"
. "${CT_LIB_DIR}/scripts/build/companion_libs/mpc.sh"
. "${CT_LIB_DIR}/scripts/build/companion_libs/libelf.sh"
+. "${CT_LIB_DIR}/scripts/build/companion_libs/zlib.sh"
. "${CT_LIB_DIR}/scripts/build/binutils/binutils.sh"
. "${CT_LIB_DIR}/scripts/build/binutils/elf2flt.sh"
. "${CT_LIB_DIR}/scripts/build/binutils/sstrip.sh"
@@ -531,6 +532,7 @@
do_cloog_get
do_mpc_get
do_libelf_get
+ do_zlib_get
do_binutils_get
do_elf2flt_get
do_sstrip_get
@@ -561,6 +563,7 @@
do_cloog_extract
do_mpc_extract
do_libelf_extract
+ do_zlib_extract
do_binutils_extract
do_elf2flt_extract
do_sstrip_extract
diff -r e0d70cf2b396 -r cc5137ade317 scripts/showSamples.sh
--- a/scripts/showSamples.sh Thu Feb 09 13:09:08 2012 +0100
+++ b/scripts/showSamples.sh Fri Feb 10 12:14:16 2012 +0100
@@ -75,6 +75,7 @@
[ -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_ZLIB}" ] || printf " zlib-%s" "${CT_ZLIB_VERSION}"
[ -z "${complibs}" ] || printf "\n"
printf " %-*s : %s\n" ${t_width} "binutils" "binutils-${CT_BINUTILS_VERSION}"
printf " %-*s : %s" ${t_width} "C compiler" "${CT_CC}-${CT_CC_VERSION} (C"
diff -r e0d70cf2b396 -r cc5137ade317 steps.mk
--- a/steps.mk Thu Feb 09 13:09:08 2012 +0100
+++ b/steps.mk Fri Feb 10 12:14:16 2012 +0100
@@ -23,6 +23,7 @@
cloog \
mpc \
libelf \
+ zlib \
binutils \
elf2flt \
sstrip \
--
For unsubscribe information see http://sourceware.org/lists.html#faq
More information about the crossgcc
mailing list