Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Yann E. MORIN <yann.morin.1998@free.fr>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH 7/8] Turn the static lib option into a choice with more options
Date: Thu, 11 Dec 2014 21:46:49 +0100	[thread overview]
Message-ID: <20141211204649.GJ4199@free.fr> (raw)
In-Reply-To: <1417642895-29606-8-git-send-email-thomas.petazzoni@free-electrons.com>

Thomas, All,

On 2014-12-03 22:41 +0100, Thomas Petazzoni spake thusly:
> This commit turns the single static option into a choice, which offers
> various possibilities:
> 
>  1. Build and use static libraries only;
>  2. Build both shared and static libraries, but used shared libraries;

s/used/use/

>  3. Build and use shared libraries only.
> 
> On most platforms, (2) is currently the default, and kept as the
> default in this commit. Of course, on certain platforms (Blackfin,
> m68k), only option (1) will be available.
> 
> In addition to the introduction of the Config.in options, this commit
> also:
> 
>  * Remove the 'select BR2_STATIC_LIBS' from 'BR2_BINFMT_FLAT', since

Remove_s_

>    with the use of a choice, we are guaranteed that BR2_STATIC_LIBS
>    will be selected when the binary format is BR2_BINFMT_FLAT, since
>    BR2_STATIC_LIBS will be the only possible solution in the choice.
> 
>  * Changes package/Makefile.in to use the proper
>    --{enable,disable}-{shared,static} options for autotools packages.
> 
>  * Changes the ncurses package to use the proper combination of
>    --{with,without}-shared and --{with,without}-normal.
> 
> Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
> ---
>  Config.in                  | 39 ++++++++++++++++++++++++++++++---------
>  arch/Config.in             |  1 -
>  package/Makefile.in        |  4 +++-
>  package/ncurses/ncurses.mk |  9 ++++++++-
>  4 files changed, 41 insertions(+), 12 deletions(-)
> 
> diff --git a/Config.in b/Config.in
> index fefa54e..e31f820 100644
> --- a/Config.in
> +++ b/Config.in
> @@ -525,19 +525,40 @@ config BR2_ENABLE_SSP
>  comment "enabling Stack Smashing Protection requires support in the toolchain"
>  	depends on !BR2_TOOLCHAIN_HAS_SSP
>  
> +choice
> +

I guess this is missing a 'bool' type. ;-)

> +	prompt "libraries"
> +	default BR2_SHARED_STATIC_LIBS if BR2_BINFMT_SUPPORTS_SHARED
> +	default BR2_STATIC_LIBS if !BR2_BINFMT_SUPPORTS_SHARED
> +
>  config BR2_STATIC_LIBS
> -	bool "build statically linked applications, no dynamic libraries"
> +	bool "static libraries only"

Please be consistent in the prompt: here you have "libraries", but in
the two next ones, you have "libs".

Since the prompt of the choice already is "libraries", I'd make the
prompt of options be just:
    "static only"
    "shared only"
    "both shared and static"

>  	help
> -	  Build all applications for the target statically linked.
> -	  This potentially increases your filesystem size and should only be
> -	  used if you know what you do.
> +	  Build and use only static libraries. No shared libraries
> +	  will be instaled on the target. This potentially increases
> +	  your code size and should only be used if you know what you
> +	  do.

...what you are doing.


>          The default is to build dynamic libraries and use those
> +	  on the target filesystem.

I think this part whould be in the help text of the choice itself:

    choice
        bool "Libraries"
        default ...
        help
          Select the type of libraries you want to use on the target.

          The default is to build both shared and static libraries, but
          only use shared libraries.

          [ More stuff like you know how to write so well! ;-) ]


>                               Note that some packages may not be
> +	  available when this option is enabled, due to their need of

...need for...

> +	  dynamic library support.
> -	  Note that some applications cannot be build statically and so are
> -	  intentionally disabled.
> +config BR2_SHARED_LIBS
> +	bool "shared libs only"
> +	depends on BR2_BINFMT_SUPPORTS_SHARED
> +	help
> +	  Build and use only shared libraries. This is the recommended
> +	  solution as it saves space and build time.
>  
> -	  The default (if this option is disabled) is to build dynamic
> -	  libraries and dynamically link applications to use those on the
> -	  target filesystem.
> +config BR2_SHARED_STATIC_LIBS
> +	bool "static and shared libs"
> +	depends on BR2_BINFMT_SUPPORTS_SHARED
> +	help
> +	  Build both shared and static libraries, but link executables
> +	  dynamically. While building both shared and static libraries
> +	  take more time and more disk space, having static libraries
> +	  may be useful to link some of the applications statically.
> +
> +endchoice
>  
>  
>  config BR2_PACKAGE_OVERRIDE_FILE
> diff --git a/arch/Config.in b/arch/Config.in
> index c7bef5d..2f98237 100644
> --- a/arch/Config.in
> +++ b/arch/Config.in
> @@ -284,7 +284,6 @@ config BR2_BINFMT_FDPIC
>  config BR2_BINFMT_FLAT
>  	bool "FLAT"
>  	depends on BR2_bfin || BR2_m68k
> -	select BR2_STATIC_LIBS
>  	help
>  	  FLAT binary is a relatively simple and lightweight executable format
>  	  based on the original a.out format. It is widely used in environment
> diff --git a/package/Makefile.in b/package/Makefile.in
> index 49a158e..dbaa8af 100644
> --- a/package/Makefile.in
> +++ b/package/Makefile.in
> @@ -394,7 +394,9 @@ SHARED_STATIC_LIBS_OPTS = --enable-static --disable-shared
>  TARGET_CFLAGS += -static
>  TARGET_CXXFLAGS += -static
>  TARGET_LDFLAGS += -static
> -else
> +else ifeq ($(BR2_SHARED_LIBS),y)
> +SHARED_STATIC_LIBS_OPTS = --disable-static --enable-shared
> +else ifeq ($(BR2_SHARED_STATIC_LIBS),y)
>  SHARED_STATIC_LIBS_OPTS = --enable-static --enable-shared
>  endif
>  
> diff --git a/package/ncurses/ncurses.mk b/package/ncurses/ncurses.mk

I was wondering if this should not be part of a spearate patch.

Without that ncurses bit, but the above applied, the behaviour of
ncurses does not change, does it?  If indeed it does not, then that
changes to ncurses is not required to tintroduce the new shared/static
choice.

Regards,
Yann E. MORIN.

> index 645c25c..f54f379 100644
> --- a/package/ncurses/ncurses.mk
> +++ b/package/ncurses/ncurses.mk
> @@ -15,7 +15,6 @@ NCURSES_LICENSE_FILES = README
>  NCURSES_CONFIG_SCRIPTS = ncurses$(NCURSES_LIB_SUFFIX)5-config
>  
>  NCURSES_CONF_OPTS = \
> -	$(if $(BR2_STATIC_LIBS),--without-shared,--with-shared) \
>  	--without-cxx \
>  	--without-cxx-binding \
>  	--without-ada \
> @@ -36,6 +35,14 @@ ifeq ($(BR2_PACKAGE_BUSYBOX),y)
>  	NCURSES_DEPENDENCIES += busybox
>  endif
>  
> +ifeq ($(BR2_STATIC_LIBS),y)
> +NCURSES_CONF_OPTS += --without-shared --with-normal
> +else ifeq ($(BR2_SHARED_LIBS),y)
> +NCURSES_CONF_OPTS += --with-shared --without-normal
> +else ifeq ($(BR2_SHARED_STATIC_LIBS),y)
> +NCURSES_CONF_OPTS += --with-shared --with-normal
> +endif
> +
>  ifeq ($(BR2_PACKAGE_NCURSES_WCHAR),y)
>  NCURSES_CONF_OPTS += --enable-widec
>  NCURSES_LIB_SUFFIX = w
> -- 
> 2.1.0
> 
> _______________________________________________
> buildroot mailing list
> buildroot at busybox.net
> http://lists.busybox.net/mailman/listinfo/buildroot

-- 
.-----------------.--------------------.------------------.--------------------.
|  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.  |
'------------------------------^-------^------------------^--------------------'

  reply	other threads:[~2014-12-11 20:46 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-12-03 21:41 [Buildroot] [PATCH 0/8] Improving static/shared library selection Thomas Petazzoni
2014-12-03 21:41 ` [Buildroot] [PATCH 1/8] docs: fix typo in cmake-package documentation Thomas Petazzoni
2014-12-03 21:49   ` Samuel Martin
2014-12-03 22:11   ` Yann E. MORIN
2014-12-07 20:54   ` Thomas Petazzoni
2014-12-03 21:41 ` [Buildroot] [PATCH 2/8] Rename BR2_PREFER_STATIC_LIB to BR2_STATIC_LIBS Thomas Petazzoni
2014-12-11 18:44   ` Yann E. MORIN
2014-12-11 18:49     ` Thomas Petazzoni
2014-12-11 20:08       ` Yann E. MORIN
2014-12-03 21:41 ` [Buildroot] [PATCH 3/8] arch: FDPIC is not supported on m68k Thomas Petazzoni
2014-12-11 18:49   ` Yann E. MORIN
2014-12-11 19:01     ` Thomas Petazzoni
2014-12-11 20:05   ` Yann E. MORIN
2014-12-03 21:41 ` [Buildroot] [PATCH 4/8] arch: ensure BR2_BINFMT_ELF is really used Thomas Petazzoni
2014-12-11 20:07   ` Yann E. MORIN
2014-12-11 21:50     ` Thomas Petazzoni
2014-12-03 21:41 ` [Buildroot] [PATCH 5/8] arch: introduce BR2_BINFMT_SUPPORTS_SHARED Thomas Petazzoni
2014-12-11 20:12   ` Yann E. MORIN
2014-12-11 21:53     ` Thomas Petazzoni
2014-12-03 21:41 ` [Buildroot] [PATCH 6/8] ncurses: speed up host build by disabling static library building Thomas Petazzoni
2014-12-11 20:24   ` Yann E. MORIN
2014-12-03 21:41 ` [Buildroot] [PATCH 7/8] Turn the static lib option into a choice with more options Thomas Petazzoni
2014-12-11 20:46   ` Yann E. MORIN [this message]
2014-12-03 21:41 ` [Buildroot] [PATCH 8/8] Build shared libraries only as the default Thomas Petazzoni
2014-12-11 20:49   ` Yann E. MORIN
2014-12-11 21:54 ` [Buildroot] [PATCH 0/8] Improving static/shared library selection Thomas Petazzoni

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=20141211204649.GJ4199@free.fr \
    --to=yann.morin.1998@free.fr \
    --cc=buildroot@busybox.net \
    /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