From patchwork Sat Apr 28 21:16:19 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnout Vandecappelle X-Patchwork-Id: 155695 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from whitealder.osuosl.org (whitealder.osuosl.org [140.211.166.138]) by ozlabs.org (Postfix) with ESMTP id 9F8B2B6FDE for ; Sun, 29 Apr 2012 07:17:31 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 34A168FEBB; Sat, 28 Apr 2012 21:17:24 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id mQhwNTMXnQpY; Sat, 28 Apr 2012 21:17:17 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by whitealder.osuosl.org (Postfix) with ESMTP id EFBF090894; Sat, 28 Apr 2012 21:17:14 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from whitealder.osuosl.org (whitealder.osuosl.org [140.211.166.138]) by ash.osuosl.org (Postfix) with ESMTP id 383048F753 for ; Sat, 28 Apr 2012 21:17:03 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by whitealder.osuosl.org (Postfix) with ESMTP id 25B178F599 for ; Sat, 28 Apr 2012 21:17:03 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from whitealder.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id rVCgVs6Y37f9 for ; Sat, 28 Apr 2012 21:17:01 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from viper.mind.be (132.79-246-81.adsl-static.isp.belgacom.be [81.246.79.132]) by whitealder.osuosl.org (Postfix) with ESMTPS id C05C58F718 for ; Sat, 28 Apr 2012 21:17:00 +0000 (UTC) Received: from [172.16.2.6] (helo=vandecaa-laptop) by viper.mind.be with esmtp (Exim 4.69) (envelope-from ) id 1SOF0Y-0000Z9-Mx; Sat, 28 Apr 2012 23:16:58 +0200 Received: from arnout by vandecaa-laptop with local (Exim 4.77) (envelope-from ) id 1SOF0Y-0004Lm-Cc; Sat, 28 Apr 2012 23:16:46 +0200 From: "Arnout Vandecappelle (Essensium/Mind)" To: buildroot@busybox.net Date: Sat, 28 Apr 2012 23:16:19 +0200 Message-Id: <1335647781-16536-2-git-send-email-arnout@mind.be> X-Mailer: git-send-email 1.7.10 In-Reply-To: <1335647781-16536-1-git-send-email-arnout@mind.be> References: <1335647781-16536-1-git-send-email-arnout@mind.be> Subject: [Buildroot] [PATCH 1/3] pkg-infra: add CONF_ENABLE and CONF_PKG_ENABLE helper functions X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.14 Precedence: list List-Id: Discussion and development of buildroot List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: buildroot-bounces@busybox.net Sender: buildroot-bounces@busybox.net From: "Arnout Vandecappelle (Essensium/Mind)" CONF_ENABLE is shorthand for --enable/--disable options depending on a .config variable. CONF_PKG_ENABLE is shorthand for --enable/--disable options and for a dependency depending on the selection of a package. These macros make it easier to consistently add --enable and --disable options to configure. Signed-off-by: Arnout Vandecappelle (Essensium/Mind) --- package/pkg-autotargets.mk | 57 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) diff --git a/package/pkg-autotargets.mk b/package/pkg-autotargets.mk index c9887c2..3743db3 100644 --- a/package/pkg-autotargets.mk +++ b/package/pkg-autotargets.mk @@ -37,6 +37,63 @@ define CONFIG_UPDATE endef ################################################################################ +# CONFIG_ENABLE -- generates the configure option to enable or disable a +# feature depending on a .config option. +# +# argument 1 is the uppercase package name +# argument 2 is y or empty (i.e. it is the .config option to check) +# argument 3 (optional) are additional dependencies in case the .config option +# is y. +# If the call has four arguments, argument 4 is the name that comes behind +# --enable- resp. --disable- +# If the call has five argument, argument 4 is the ensable option and +# argument 5 is the disable option. +# The call must be done within an $(eval) clause. +# +# Examples: +# $(eval $(call CONF_ENABLE,CAIRO,$(BR2_PACKAGE_CAIRO_SVG),,svg)) +# $(eval $(call CONF_ENABLE,CAIRO,$(BR2_PACKAGE_CAIRO_PNG),libpng,png)) +# $(eval $(call CONF_ENABLE,AVAHI,$(BR2_PACKAGE_AVAHI_DAEMON),expat,--with-xml=expat,--with-xml=none)) +# +################################################################################ +define CONF_ENABLE +ifeq ($(2),y) + $(1)_CONF_OPT += $(if $(5),$(4),--enable-$(4)) + $(1)_DEPENDENCIES += $(3) +else + $(1)_CONF_OPT += $(if $(5),$(5),--disable-$(4)) +endif +endef + +################################################################################ +# CONF_PKG ENABLE -- generates the configure option and dependency for another +# package, depending on whether that package is selected. If the other package +# is selected, an --enable- option and a dependency on the other package is +# added. If the other package is not selected, a --disable- option is added. +# +# argument 1 is the uppercase package name +# argument 2 is the lowercase name of the other package +# If the call has two arguments, the --enable- configure option is added. +# If the call has three arguments, argument 3 is the name that comes after +# --enable- and --disable- (in case this differs from the buildroot package +# name). +# If the call has four arguments, argument 3 is the option to enable the +# other package and argument 4 is the option to disable it. +# +# The call must be done within an $(eval) clause. +# +# Examples: +# $(eval $(call CONF_PKG_ENABLE,AVAHI,dbus)) +# $(eval $(call CONF_PKG_ENABLE,AVAHI,libglade,gtk)) +# $(eval $(call CONF_PKG_ENABLE,AVAHI,libglib2,--enable-glib --enable-gobject,--disable-glib --disable-gobject)) +# +################################################################################ +define CONF_PKG_ENABLE +$(call CONF_ENABLE,$(1),$(BR2_PACKAGE_$(call UPPERCASE,$(2))),$(2),$(if $(3),$(3),$(2)),$(if $(4),$(4),)) +endef + + +################################################################################ # AUTOTARGETS_INNER -- defines how the configuration, compilation and # installation of an autotools package should be done, implements a # few hooks to tune the build process for autotools specifities and