freecwmp
[Top] [All Lists]

[PATCH] freecwmp: use buildvariants for libcurl/libzstream

To: freecwmp@linux-mips.org
Subject: [PATCH] freecwmp: use buildvariants for libcurl/libzstream
From: Jonas Gorski <jonas.gorski@gmail.com>
Date: Sat, 9 Jun 2012 13:16:24 +0200
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:subject:date:message-id:x-mailer; bh=vz/ZPSbsZ6x5Vqsl7xO7xlBv2V06eiRDIaqD13WpNiY=; b=tEUzuQqE6lETlsG6ORqCt7ZPBcT6LUh62yZrd60d+8qnm9Rf3cCkDE8u/yd2ZZDmWf dgXwFooKsmOrgpTbbg/WPrUxtCl64EQXmayyO4W4IV2vbws4yxGfUKeZLw3UP7dxTCa/ 8kphO4IyMI8QlAxuDG2rbDJVBR/bYJqbJUIDcd8GXkcye5oJFRFdpQsOqMjFKhb4TVbS IgHfpInxw34b8E/S6o3vXu150uKTGUgZFLbVK/uMfjZKgqGCQT+iQxPfJgcjB8Bo09kp TCyAzQeHeZ15NtYpKuLilOxfhmcP38OaopTPwi3UAIJDCDSO12zxGcsnDgNb0/x9HK5U S75Q==
Original-recipient: rfc822;freecwmp@linux-mips.org
Sender: freecwmp-bounce@linux-mips.org
Build freecwmp using build variants for easier inclusion as a default
package with the desired http library.

Since there are then two freecwmp packages, it does not make sense using
a menu, so convert the menu to inline options. Also make the package
configuration depend on the config options, so changing them triggers
a rebuild of freecwmp.

Contributed by T-Labs, Deutsche Telekom Innovation Laboratories

Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
---

The latest change is currently ineffective as freecwmp itself does not
rebuild obsolete object files even if configure changed options.

 freecwmp/Config.in |   18 ++----------------
 freecwmp/Makefile  |   46 ++++++++++++++++++++++++++++++++++------------
 2 files changed, 36 insertions(+), 28 deletions(-)

diff --git a/freecwmp/Config.in b/freecwmp/Config.in
index 47ff609..95f3583 100644
--- a/freecwmp/Config.in
+++ b/freecwmp/Config.in
@@ -1,24 +1,10 @@
-menu "Configuration"
-       depends on PACKAGE_freecwmp
+if PACKAGE_freecwmp-curl || PACKAGE_freecwmp-zstream
 
 config FREECWMP_SCRIPTS_FULL
        bool "Install all freecwmp scripts"
        default y
 
 choice
-       prompt "Select HTTP library"
-       default FREECWMP_HTTP_ZSTREAM
-
-       config FREECWMP_HTTP_ZSTREAM
-       bool "libzstream"
-       select PACKAGE_libzstream
-
-       config FREECWMP_HTTP_CURL
-       bool "libcurl"
-       select PACKAGE_libcurl
-endchoice
-
-choice
        prompt "Select ACS sever"
        default FREECWMP_ACS_MULTI
 
@@ -37,4 +23,4 @@ config FREECWMP_DEVEL_DEBUG
        bool "Compile with development debug options"
        default n
 
-endmenu
+endif
diff --git a/freecwmp/Makefile b/freecwmp/Makefile
index 510c94e..0996417 100644
--- a/freecwmp/Makefile
+++ b/freecwmp/Makefile
@@ -19,24 +19,45 @@ 
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
 
 PKG_FIXUP:=autoreconf
 
+PKG_CONFIG_DEPENDS:= \
+       CONFIG_FREECWMP_ACS_MULTI \
+       CONFIG_FREECWMP_ACS_HDM \
+       CONFIG_FREECWMP_DEBUG \
+       CONFIG_FREECWMP_DEVEL_DEBUG
+
+PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION)
+
 include $(INCLUDE_DIR)/package.mk
 
-define Package/freecwmp
+define Package/freecwmp/Default
   SECTION:=utils
   CATEGORY:=Utilities
   TITLE:=CWMP client
-  DEPENDS:=+libubox +libmicroxml +shflags 
+CONFIG_FREECWMP_HTTP_ZSTREAM:libzstream +CONFIG_FREECWMP_HTTP_CURL:libcurl
-  MENU:=1
-endef
-
-define Package/freecwmp/config
-       source "$(SOURCE)/Config.in"
+  DEPENDS:=+libubox +libmicroxml +shflags
 endef
 
 define Package/freecwmp/description
   A free client implementation of CWMP (TR-069) protocol.
 endef
 
+define Package/freecwmp-curl
+  $(call Package/freecwmp/Default)
+  TITLE+= (using libcurl)
+  DEPENDS += +libcurl
+  VARIANT:=curl
+endef
+
+define Package/freecwmp-zstream
+  $(call Package/freecwmp/Default)
+  TITLE += (using libzstream)
+  DEPENDS += +libzstream
+  VARIANT:=zstream
+endef
+
+define Package/freecwmp-zstream/config
+       source "$(SOURCE)/Config.in"
+endef
+
 USE_LOCAL=$(shell ls ./src/ 2>/dev/null >/dev/null && echo 1)
 ifneq ($(USE_LOCAL),)
 define Build/Prepare
@@ -53,13 +74,13 @@ TARGET_LDFLAGS += \
 CONFIGURE_ARGS += \
        --with-uci-include-path=$(STAGING_DIR)/usr/include
 
-ifeq ($(CONFIG_FREECWMP_HTTP_ZSTREAM),y)
+ifeq ($(BUILD_VARIANT),zstream)
 CONFIGURE_ARGS += \
        --enable-http=zstream \
        --with-zstream-include-path=$(STAGING_DIR)/usr/include
 endif
 
-ifeq ($(CONFIG_FREECWMP_HTTP_CURL),y)
+ifeq ($(BUILD_VARIANT),curl)
 CONFIGURE_ARGS += \
        --enable-http=curl
 endif
@@ -84,12 +105,12 @@ CONFIGURE_ARGS += \
        --enable-devel-debug
 endif
 
-define Package/freecwmp/conffiles
+define Package/freecwmp-$(BUILD_VARIANT)/conffiles
 /etc/config/freecwmp
 /usr/share/freecwmp/defaults
 endef
 
-define Package/freecwmp/install
+define Package/freecwmp-$(BUILD_VARIANT)/install
        $(INSTALL_DIR) $(1)/usr/sbin
        $(CP) $(PKG_BUILD_DIR)/bin/freecwmpd $(1)/usr/sbin
        $(INSTALL_DIR) $(1)/etc/config
@@ -105,4 +126,5 @@ ifeq ($(CONFIG_FREECWMP_SCRIPTS_FULL),y)
 endif
 endef
 
-$(eval $(call BuildPackage,freecwmp))
+$(eval $(call BuildPackage,freecwmp-curl))
+$(eval $(call BuildPackage,freecwmp-zstream))
-- 
1.7.10


<Prev in Thread] Current Thread [Next in Thread>