public inbox for crossgcc@sourceware.org
 help / color / mirror / Atom feed
From: "Yann E. MORIN" <yann.morin.1998@anciens.enib.fr>
To: crossgcc@sourceware.org
Cc: Zhenqiang Chen <zhenqiang.chen@linaro.org>
Subject: Re: [zlib PATCH 1 of 3] complibs/zlib: Add zlib support for binutils and gdb
Date: Tue, 22 Nov 2011 17:38:00 -0000	[thread overview]
Message-ID: <201111221838.08697.yann.morin.1998@anciens.enib.fr> (raw)
In-Reply-To: <4ECB8FBC.3000101@linaro.org>

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.

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

  reply	other threads:[~2011-11-22 17:38 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-22 12:04 Zhenqiang Chen
2011-11-22 17:38 ` Yann E. MORIN [this message]
2011-11-23 20:17   ` Khem Raj
2011-11-23 20:54     ` Michael Hope
2011-11-23 21:01       ` Khem Raj
2011-11-23 22:00       ` Yann E. MORIN
2011-11-23 22:20         ` Khem Raj
2011-11-23 22:53         ` Michael Hope
2011-11-24  5:31         ` Zhenqiang Chen
2011-11-24  5:47           ` Ralf Corsepius
2011-11-24  6:59             ` Zhenqiang Chen
2011-11-24  7:13               ` Ralf Corsepius
2011-11-24  7:21                 ` Zhenqiang Chen
2011-11-24 15:41                   ` Ralf Corsepius
2011-11-24 20:35                     ` Michael Hope
2011-11-22 17:50 ` Yann E. MORIN
     [not found]   ` <CACgzC7AnOW+umLpoD+Hwv1i1z_WF=rD2hJ7AJkWO-x86fHVMFg@mail.gmail.com>
2011-11-23  7:40     ` Yann E. MORIN
2011-11-23  8:23       ` Zhenqiang Chen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=201111221838.08697.yann.morin.1998@anciens.enib.fr \
    --to=yann.morin.1998@anciens.enib.fr \
    --cc=crossgcc@sourceware.org \
    --cc=zhenqiang.chen@linaro.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).