Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCH v2] autotools: add with/without and enable/disable helpers
Date: Fri, 19 Nov 2010 12:13:26 +0100	[thread overview]
Message-ID: <20101119121326.3185e990@surf> (raw)
In-Reply-To: <1290162216-30689-1-git-send-email-vapier@gentoo.org>

Hello,

On Fri, 19 Nov 2010 05:23:36 -0500
Mike Frysinger <vapier@gentoo.org> wrote:

> Rather than have to write ugly logic in every package .mk file to check
> a config var and then expand into a --{en,dis}able-foo flag, add helpers
> so code can cleanly expand things.
> 
> A simple example:
> - ifeq ($(BR2_PACKAGE_LIBVORBIS),y)
> - SDL_MIXER_CONF_OPT += --enable-music-ogg
> - else
> - SDL_MIXER_CONF_OPT += --disable-music-ogg
> - endif
> + SDL_MIXER_CONF_OPT += $(call USE_ENABLE,PACKAGE_LIBVORBIS,music-ogg)

So typically, one would do:

SDL_MIXER_CONF_OPT += $(call USE_ENABLE,PACKAGE_LIBVORBIS,music-ogg)
SDL_MIXER_DEPENDENCIES-$(BR2_PACKAGE_LIBVORBIS) += libvorbis

what about doing something more consistent, like:

SDL_MIXER_CONF_OPT     += $(call USE_ENABLE,PACKAGE_LIBVORBIS,music-ogg)
SDL_MIXER_DEPENDENCIES += $(call USE_DEP,PACKAGE_LIBVORBIS,libvorbis)

I know it's a litte bit more characters that the previous solution, but
it looks more consistent to me.

> +# $(call _USE_CONF,enable,disable,LIB_FFMPEG,video,blah) -> --enable-video=blah if LIB_FFMPEG
> +# $(call _USE_CONF,with,without,LIB_FFMPEG,video)        -> --with-video if LIB_FFMPEG
> +_USE_CONF = $(if $(BR2_$(3)), --$(1)-$(4)$(if $(5),=$(5)), --$(2)-$(4))

What about testing directly BR2_PACKAGE_$(3), since all packages are
prefixed by BR2_PACKAGE_ ?

Thanks!

Thomas
-- 
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com

  reply	other threads:[~2010-11-19 11:13 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-19  4:33 [Buildroot] [PATCH] autotools: add with/without and enable/disable helpers Mike Frysinger
2010-11-19  7:55 ` Thomas Petazzoni
2010-11-19  8:20   ` Mike Frysinger
2010-11-19  9:56     ` Thomas Petazzoni
2010-11-19 10:07       ` Mike Frysinger
2010-11-19 10:23 ` [Buildroot] [PATCH v2] " Mike Frysinger
2010-11-19 11:13   ` Thomas Petazzoni [this message]
2010-11-19 11:24     ` Mike Frysinger
2010-11-19 12:49       ` Paulius Zaleckas
2010-11-19 23:25         ` Mike Frysinger
2010-11-20  2:37 ` [Buildroot] [PATCH v3] " Mike Frysinger
2010-11-20  3:47   ` Mike Frysinger

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=20101119121326.3185e990@surf \
    --to=thomas.petazzoni@free-electrons.com \
    --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