From patchwork Wed Oct 15 14:10:25 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexey Mednyy X-Patchwork-Id: 399998 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from hemlock.osuosl.org (hemlock.osuosl.org [140.211.166.133]) by ozlabs.org (Postfix) with ESMTP id 70C22140119 for ; Thu, 16 Oct 2014 01:10:35 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id AD53395829; Wed, 15 Oct 2014 14:10:34 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from hemlock.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id F+JOo2fEgEgT; Wed, 15 Oct 2014 14:10:33 +0000 (UTC) Received: from ash.osuosl.org (ash.osuosl.org [140.211.166.34]) by hemlock.osuosl.org (Postfix) with ESMTP id C904D95830; Wed, 15 Oct 2014 14:10:33 +0000 (UTC) X-Original-To: buildroot@lists.busybox.net Delivered-To: buildroot@osuosl.org Received: from hemlock.osuosl.org (hemlock.osuosl.org [140.211.166.133]) by ash.osuosl.org (Postfix) with ESMTP id 5A61E1C26D4 for ; Wed, 15 Oct 2014 14:10:32 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by hemlock.osuosl.org (Postfix) with ESMTP id 5651995830 for ; Wed, 15 Oct 2014 14:10:32 +0000 (UTC) X-Virus-Scanned: amavisd-new at osuosl.org Received: from hemlock.osuosl.org ([127.0.0.1]) by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Bk0SvhGLBJkX for ; Wed, 15 Oct 2014 14:10:31 +0000 (UTC) X-Greylist: domain auto-whitelisted by SQLgrey-1.7.6 Received: from mail-la0-f46.google.com (mail-la0-f46.google.com [209.85.215.46]) by hemlock.osuosl.org (Postfix) with ESMTPS id D35B895829 for ; Wed, 15 Oct 2014 14:10:30 +0000 (UTC) Received: by mail-la0-f46.google.com with SMTP id gi9so1121380lab.5 for ; Wed, 15 Oct 2014 07:10:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id; bh=Fj1rtJ3GFhMBVO7u9xZnwBxGm2ipevTe3cR9z4YHvFc=; b=DfyExS9NR6mv6U0CXmFhA0qNoVvYvWx6xirL1Be8Vl4LeAl2ZcPNMquswj0KvLrnXM wbNe6z76lN7E9KK/ZImRt3ACCP8HFaHh9Y92DaDDycYtm4udf9MhOm7f/LGsNP5Jq86v 8gfh4rcQdva7njyb1mYjt1RrRRwnXANaMhPOAcmHQHW+WU5ebnhHfcn6KJskjitS8bjL d8+4tikcDjKi2fnGAxgqF5VMG60eqApKf24CtlZVb+P3c7k1recGXvNbBa9WJGd1q9n1 o1/k0uVF75bAzCw0GWtDFWYuVo7V1T8VvDW4G4XiLXG+YRY62MqbyVxtTnV+ocem6D3y z/+Q== X-Received: by 10.152.45.105 with SMTP id l9mr12635161lam.69.1413382227652; Wed, 15 Oct 2014 07:10:27 -0700 (PDT) Received: from spc ([2001:0:53aa:64c:2cd1:1900:7fbb:4804]) by mx.google.com with ESMTPSA id p4sm6514762laj.35.2014.10.15.07.10.26 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 15 Oct 2014 07:10:26 -0700 (PDT) Received: by spc (Postfix, from userid 1000) id 2B23F4C2C1A; Wed, 15 Oct 2014 18:10:28 +0400 (MSK) From: Alexey Mednyy To: buildroot@buildroot.org Date: Wed, 15 Oct 2014 18:10:25 +0400 Message-Id: <1413382225-31276-1-git-send-email-swexru@gmail.com> X-Mailer: git-send-email 1.9.1 Subject: [Buildroot] [PATCH 1/1 v4] ubus: new package X-BeenThere: buildroot@busybox.net X-Mailman-Version: 2.1.18-1 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" Signed-off-by: Alexey Mednyy --- package/Config.in | 1 + ...c-dependency-Werror-off-build-examples-of.patch | 49 ++++++++++++++++++++++ package/ubus/Config.in | 14 +++++++ package/ubus/ubus-01-json-definition-fix.patch | 27 ++++++++++++ package/ubus/ubus.mk | 28 +++++++++++++ 5 files changed, 119 insertions(+) create mode 100644 package/ubus/0001-fixed-json-c-dependency-Werror-off-build-examples-of.patch create mode 100644 package/ubus/Config.in create mode 100644 package/ubus/ubus-01-json-definition-fix.patch create mode 100644 package/ubus/ubus.mk diff --git a/package/Config.in b/package/Config.in index 19bb9bf..16d4901 100644 --- a/package/Config.in +++ b/package/Config.in @@ -896,6 +896,7 @@ menu "Other" source "package/startup-notification/Config.in" source "package/tz/Config.in" source "package/tzdata/Config.in" + source "package/ubus/Config.in" endmenu menu "Security" diff --git a/package/ubus/0001-fixed-json-c-dependency-Werror-off-build-examples-of.patch b/package/ubus/0001-fixed-json-c-dependency-Werror-off-build-examples-of.patch new file mode 100644 index 0000000..9c46a63 --- /dev/null +++ b/package/ubus/0001-fixed-json-c-dependency-Werror-off-build-examples-of.patch @@ -0,0 +1,49 @@ +From ea67d1fc6621abee5451e343e2d1a2303b4176f9 Mon Sep 17 00:00:00 2001 +From: Alexey Mednyy +Date: Wed, 15 Oct 2014 03:58:17 +0400 +Subject: [PATCH 1/1] fixed json-c dependency, Werror-off, build examples-off + +Signed-off-by: Alexey Mednyy +--- + CMakeLists.txt | 14 ++++++++++---- + 1 file changed, 10 insertions(+), 4 deletions(-) + +diff --git a/CMakeLists.txt b/CMakeLists.txt +index cb2f420..bd47c37 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -1,10 +1,10 @@ + cmake_minimum_required(VERSION 2.6) + + PROJECT(ubus C) +-ADD_DEFINITIONS(-Os -Wall -Werror --std=gnu99 -g3 -Wmissing-declarations) ++ADD_DEFINITIONS(-Os -Wall --std=gnu99 -g3 -Wmissing-declarations) + + OPTION(BUILD_LUA "build Lua plugin" ON) +-OPTION(BUILD_EXAMPLES "build examples" ON) ++OPTION(BUILD_EXAMPLES "build examples" OFF) + OPTION(ENABLE_SYSTEMD "systemd support" ON) + + SET(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS "") +@@ -25,10 +25,16 @@ TARGET_LINK_LIBRARIES(ubus ubox) + ADD_EXECUTABLE(ubusd ubusd.c ubusd_id.c ubusd_obj.c ubusd_proto.c ubusd_event.c) + TARGET_LINK_LIBRARIES(ubusd ubox) + +-find_library(json NAMES json-c json) ++ ++find_package(PkgConfig REQUIRED) ++PKG_CHECK_MODULES(JSONC REQUIRED json-c) ++ADD_DEFINITIONS(-DJSONC) ++INCLUDE_DIRECTORIES(${JSONC_INCLUDE_DIRS}) ++ ++ + ADD_EXECUTABLE(cli cli.c) + SET_TARGET_PROPERTIES(cli PROPERTIES OUTPUT_NAME ubus) +-TARGET_LINK_LIBRARIES(cli ubus ubox blobmsg_json ${json}) ++TARGET_LINK_LIBRARIES(cli ubus ubox blobmsg_json ${JSONC_LIBRARIES}) + + ADD_SUBDIRECTORY(lua) + ADD_SUBDIRECTORY(examples) +-- +1.9.1 + diff --git a/package/ubus/Config.in b/package/ubus/Config.in new file mode 100644 index 0000000..b0f5de9 --- /dev/null +++ b/package/ubus/Config.in @@ -0,0 +1,14 @@ +config BR2_PACKAGE_UBUS + bool "ubus" + select BR2_PACKAGE_LIBUBOX + select BR2_PACKAGE_JSON_C + depends on !BR2_PREFER_STATIC_LIB + help + OpenWrt micro bus architecture, project + provide communication between various + daemons and applications. + + http://wiki.openwrt.org/doc/techref/ubus + +comment "ubus needs toolchain w/ dynamic library" + depends on BR2_PREFER_STATIC_LIB diff --git a/package/ubus/ubus-01-json-definition-fix.patch b/package/ubus/ubus-01-json-definition-fix.patch new file mode 100644 index 0000000..50f9096 --- /dev/null +++ b/package/ubus/ubus-01-json-definition-fix.patch @@ -0,0 +1,27 @@ +diff --git a/CMakeLists.txt b/CMakeLists.txt +index cb2f420..86c4c4d 100644 +--- a/CMakeLists.txt ++++ b/CMakeLists.txt +@@ -25,10 +25,20 @@ TARGET_LINK_LIBRARIES(ubus ubox) + ADD_EXECUTABLE(ubusd ubusd.c ubusd_id.c ubusd_obj.c ubusd_proto.c ubusd_event.c) + TARGET_LINK_LIBRARIES(ubusd ubox) + +-find_library(json NAMES json-c json) ++ ++find_package(PkgConfig) ++PKG_CHECK_MODULES(JSONC json-c) ++IF(JSONC_FOUND) ++ ADD_DEFINITIONS(-DJSONC) ++ INCLUDE_DIRECTORIES(${JSONC_INCLUDE_DIRS}) ++ENDIF() ++ + ADD_EXECUTABLE(cli cli.c) + SET_TARGET_PROPERTIES(cli PROPERTIES OUTPUT_NAME ubus) +-TARGET_LINK_LIBRARIES(cli ubus ubox blobmsg_json ${json}) ++TARGET_LINK_LIBRARIES(cli ubus ubox blobmsg_json) ++IF(JSONC_FOUND) ++ TARGET_LINK_LIBRARIES(cli ${JSONC_LIBRARIES}) ++ENDIF() + + ADD_SUBDIRECTORY(lua) + ADD_SUBDIRECTORY(examples) diff --git a/package/ubus/ubus.mk b/package/ubus/ubus.mk new file mode 100644 index 0000000..7728a0c --- /dev/null +++ b/package/ubus/ubus.mk @@ -0,0 +1,28 @@ +################################################################################ +# +# UBUS +# +################################################################################ + +UBUS_VERSION = 4c4f35cf2230d70b9ddd87638ca911e8a563f2f3 +UBUS_SITE = git://nbd.name/luci2/ubus.git +UBUS_LICENSE = LGPLv2.1 +UBUS_DEPENDENCIES = json-c libubox + +ifeq ($(BR2_PACKAGE_LUA_5_1),y) +UBUS_DEPENDENCIES += lua +UBUS_CONF_OPTS += -DLUAPATH=$(STAGING_DIR)/usr/lib/lua/5.1 \ + -DLUA_CFLAGS=-I$(STAGING_DIR)/usr/include \ + -DBUILD_LUA=ON +else +UBUS_CONF_OPTS += -DBUILD_LUA=OFF +endif + +ifeq ($(BR2_PACKAGE_SYSTEMD),y) +UBUS_DEPENDENCIES += systemd +UBUS_CONF_OPTS += -DENABLE_SYSTEMD=ON +else +UBUS_CONF_OPTS += -DENABLE_SYSTEMD=OFF +endif + +$(eval $(cmake-package))