This is the mail archive of the crossgcc@sourceware.org mailing list for the crossgcc project.

See the CrossGCC FAQ for lots more information.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [zlib PATCH 1 of 3] complibs/zlib: Add zlib support for binutils and gdb


On Tue, Nov 22, 2011 at 9:38 AM, Yann E. MORIN
<yann.morin.1998@anciens.enib.fr> wrote:
> Zhenqiang, All,
>
> On Tuesday 22 November 2011 13:04:12 Zhenqiang Chen wrote:
>> # HG changeset patch
>> # User Zhenqiang Chen <zhenqiang.chen@linaro.org>
>> # Date 1321943491 -28800
>> # Node ID a7e34002ac6dcab9dded1c0b04391637b23e2e82
>> # Parent Âa6c68712024f406df7d2da4af377f51982615833
>> complibs/zlib: Add zlib support to remove the dependence on system zlib
>> for binutils and gdb.
>
> Why don't you want to use the system zlib? What's the use-case? zlib has
> a history of many security holes, and using static means you won't get
> bug-fixes.

I guess if you are building on systems which has either no zlib or
different version of zlib
but I am looking for better use case from Zhenqiang here

>
> Note that the other complibs are needed because older distros do not have
> the needed versions, and using shared libs or static would have the same
> issue for crostool-NG: updating those libs would probably need a full
> re-build of the toolchain.
>
> Too long description line. Use:
> Â Âcomplibs/zlib: add zlib as a companion library
>
> Â ÂUse our own version to remove dependence on system zlib
> Â Âin case blabla...
>
> Â Âsob...
>
>> Reviewed-by: Michael Hope
>> Signed-off-by: Zhenqiang Chen <zhenqiang.chen@linaro.org>
>>
>> diff --git a/config/companion_libs.in b/config/companion_libs.in
>> --- a/config/companion_libs.in
>> +++ b/config/companion_libs.in
>> @@ -37,6 +37,11 @@
>> Â Â Â select LIBELF
>> Â Â Â select COMPLIBS_NEEDED
>>
>> +config ZLIB_NEEDED
>> + Â Âbool
>> + Â Âselect ZLIB
>> + Â Âselect COMPLIBS_NEEDED
>> +
>> Â config COMPLIBS
>> Â Â Â bool
>>
>> @@ -70,6 +75,10 @@
>> Â Â Â bool
>> Â Â Â select COMPLIBS
>>
>> +config ZLIB
>> + Â Âbool
>> + Â Âselect COMPLIBS
>> +
>> Â config LIBELF_TARGET
>> Â Â Â bool
>>
>> @@ -93,6 +102,9 @@
>> Â Â Â depends on !LIBELF
>> Â source "config/companion_libs/libelf.in"
>> Â endif
>> +if ZLIB
>> +source "config/companion_libs/zlib.in"
>> +endif
>>
>> Â config FOO
>> Â Â Â bool
>> diff --git a/config/companion_libs/zlib.in b/config/companion_libs/zlib.in
>> new file mode 100644
>> --- /dev/null
>> +++ b/config/companion_libs/zlib.in
>> @@ -0,0 +1,19 @@
>> +# ZLIB options
>> +
>> +choice
>> + Â Âbool
>> + Â Âprompt "ZLIB version"
>> +# Don't remove next line
>> +# CT_INSERT_VERSION_BELOW
>> +
>> +config ZLIB_V_1_2_5
>> + Â Âbool
>> + Â Âprompt "1.2.5"
>> +
>> +endchoice
>> +
>> +config ZLIB_VERSION
>> + Â Âstring
>> +# Don't remove next line
>> +# CT_INSERT_VERSION_STRING_BELOW
>> + Â Âdefault "1.2.5" if ZLIB_V_1_2_5
>
> Do we really want to expose the zlib version? I believe it should be
> transparent, the way libncurses is managed by gdb (version-wise, I mean,
> keeping the complib build as you submitted).
>
>> diff --git a/patches/zlib/1.2.5/zlib-1.2.5.patch b/patches/zlib/1.2.5/zlib-1.2.5.patch
>> new file mode 100644
>> --- /dev/null
>> +++ b/patches/zlib/1.2.5/zlib-1.2.5.patch
>> @@ -0,0 +1,19 @@
>> +diff --git a/Makefile.in b/Makefile.in
>> +index 5b15bd0..6817b94 100644
>> +--- a/Makefile.in
>> ++++ b/Makefile.in
>> +@@ -167,8 +167,12 @@ install-libs: $(LIBS)
>> + Â Â Â -@if [ ! -d $(DESTDIR)$(sharedlibdir) ]; then mkdir -p $(DESTDIR)$(sharedlibdir); fi
>> + Â Â Â -@if [ ! -d $(DESTDIR)$(man3dir) Â Â Â]; then mkdir -p $(DESTDIR)$(man3dir); fi
>> + Â Â Â -@if [ ! -d $(DESTDIR)$(pkgconfigdir) ]; then mkdir -p $(DESTDIR)$(pkgconfigdir); fi
>> +- Â Â Âcp $(STATICLIB) $(DESTDIR)$(libdir)
>> +- Â Â Âcp $(SHAREDLIBV) $(DESTDIR)$(sharedlibdir)
>> ++ Â Â Âif [ "x$(STATICLIB)" != "x" ] && [ -e $(STATICLIB) ] ; then \
>> ++ Â Â Â Â Â Â Âcp $(STATICLIB) $(DESTDIR)$(libdir) ; \
>> ++ Â Â Âfi
>> ++ Â Â Âif [ "x$(SHAREDLIBV)" != "x" ] && [ -e $(SHAREDLIBV) ] ; then \
>> ++ Â Â Â Â Â Â Âcp $(SHAREDLIBV) $(DESTDIR)$(sharedlibdir) ; \
>> ++ Â Â Âfi
>> + Â Â Â cd $(DESTDIR)$(libdir); chmod u=rw,go=r $(STATICLIB)
>> + Â Â Â -@(cd $(DESTDIR)$(libdir); $(RANLIB) libz.a || true) >/dev/null 2>&1
>> + Â Â Â -@cd $(DESTDIR)$(sharedlibdir); if test "$(SHAREDLIBV)" -a -f $(SHAREDLIBV); then \
>> diff --git a/scripts/build/companion_libs/zlib.sh b/scripts/build/companion_libs/zlib.sh
>> new file mode 100644
>> --- /dev/null
>> +++ b/scripts/build/companion_libs/zlib.sh
>> @@ -0,0 +1,49 @@
>> +# This file adds the functions to build the ZLIB library
>> +# Copyright 2011 Michael Edwards
>> +# Licensed under the GPL v2. See COPYING in the root of this package
>> +
>> +do_zlib_get() { :; }
>> +do_zlib_extract() { :; }
>> +do_zlib() { :; }
>> +
>> +# Overide functions depending on configuration
>> +if [ "${CT_ZLIB}" = "y" ]; then
>> +
>> +do_zlib_get() {
>> +  ÂCT_GetFile "zlib-${CT_ZLIB_VERSION}" .tar.gz  Â\
>> + Â Â Â Âhttp://sourceforge.net/projects/libpng/files
>> +}
>> +
>> +do_zlib_extract() {
>> + Â ÂCT_Extract "zlib-${CT_ZLIB_VERSION}"
>> + Â ÂCT_Patch "zlib" "${CT_ZLIB_VERSION}"
>> +}
>> +
>> +do_zlib() {
>> + Â Âmkdir -p "${CT_BUILD_DIR}/build-zlib"
>> + Â Âcd "${CT_BUILD_DIR}/build-zlib"
>> +
>> + Â ÂCT_DoStep INFO "Installing zlib"
>> +
>> + Â Âcp -a "${CT_SRC_DIR}/zlib-${CT_ZLIB_VERSION}" "${CT_BUILD_DIR}/build-zlib"
>> + Â ÂCT_Pushd "${CT_BUILD_DIR}/build-zlib/zlib-${CT_ZLIB_VERSION}"
>> +
>> + Â ÂCT_DoLog EXTRA "Configuring zlib"
>> +
>> + Â ÂCT_DoExecLog CFG Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â\
>> + Â ÂCFLAGS="${CT_CFLAGS_FOR_HOST}" Â Â Â Â Â Â Â Â Â\
>> + Â ÂCXXFLAGS="${CT_CFLAGS_FOR_HOST}" Â Â Â Â Â Â Â Â\
>> + Â Â./configure Â--prefix="${CT_COMPLIBS_DIR}/zlib" \
>> + Â Â Â Â--static
>> +
>> + Â ÂCT_DoLog EXTRA "Building zlib"
>> + Â ÂCT_DoExecLog ALL make ${JOBSFLAGS}
>> +
>> + Â ÂCT_DoLog EXTRA "Installing zlib"
>> + Â ÂCT_DoExecLog ALL make install
>> +
>> + Â ÂCT_Popd
>> + Â ÂCT_EndStep
>> +}
>> +
>> +fi # CT_ZLIB
>> diff --git a/scripts/crosstool-NG.sh.in b/scripts/crosstool-NG.sh.in
>> --- a/scripts/crosstool-NG.sh.in
>> +++ b/scripts/crosstool-NG.sh.in
>> @@ -117,6 +117,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"
>> @@ -527,6 +528,7 @@
>> Â Â Â do_cloog_get
>> Â Â Â do_mpc_get
>> Â Â Â do_libelf_get
>> + Â Âdo_zlib_get
>> Â Â Â do_binutils_get
>> Â Â Â do_elf2flt_get
>> Â Â Â do_sstrip_get
>> @@ -557,6 +559,7 @@
>> Â Â Â Â Â do_cloog_extract
>> Â Â Â Â Â do_mpc_extract
>> Â Â Â Â Â do_libelf_extract
>> + Â Â Â Âdo_zlib_extract
>> Â Â Â Â Â do_binutils_extract
>> Â Â Â Â Â do_elf2flt_extract
>> Â Â Â Â Â do_sstrip_extract
>> diff --git a/steps.mk b/steps.mk
>> --- a/steps.mk
>> +++ b/steps.mk
>> @@ -23,6 +23,7 @@
>>        cloog        \
>>        mpc         \
>>        libelf       Â\
>> +      Âzlib        Â\
>>        binutils      Â\
>>        elf2flt       \
>>        sstrip       Â\
>>
>> --
>> For unsubscribe information see http://sourceware.org/lists.html#faq
>>
>>
>
> --
> .-----------------.--------------------.------------------.--------------------.
> | ÂYann E. MORIN Â| Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
> | +33 662 376 056 | Software ÂDesigner | \ / CAMPAIGN Â Â | Â___ Â Â Â Â Â Â Â |
> | +33 223 225 172 `------------.-------: ÂX ÂAGAINST Â Â Â| Â\e/ ÂThere is no Â|
> | http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL  Â|  v  conspiracy. Â|
> '------------------------------^-------^------------------^--------------------'
>
> --
> For unsubscribe information see http://sourceware.org/lists.html#faq
>
>

--
For unsubscribe information see http://sourceware.org/lists.html#faq


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]