Skip to contentSkip to conversation

ubus: new package

PATCH Superseded Alexey Mednyy 3 participants 5 messages Oct 14, 2014 – Oct 15, 2014

v3 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

PATCH v3 1/1 ubus: new package

---
 package/Config.in                              |  1 +
 package/ubus/Config.in                         | 14 +++++++++++++
 package/ubus/ubus-01-json-definition-fix.patch | 27 +++++++++++++++++++++++++
 package/ubus/ubus.mk                           | 28 ++++++++++++++++++++++++++
 4 files changed, 70 insertions(+)
 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
package/Config.in +1 -0
index 19bb9bf..16d4901 100644
@@ -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"
package/ubus/Config.in new file +14 -0
new file mode 100644
index 0000000..b0f5de9
@@ -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
package/ubus/ubus-01-json-definition-fix.patch new file +27 -0
new file mode 100644
index 0000000..50f9096
@@ -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)
package/ubus/ubus.mk new file +28 -0
new file mode 100644
index 0000000..652ab48
@@ -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_USE_MMU)$(BR2_PACKAGE_LUA_5_1),yy)
+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_CONF_OPTS += systemd \
+	-DENABLE_SYSTEMD=ON
+else
+UBUS_CONF_OPTS += -DENABLE_SYSTEMD=OFF
+endif
+
+$(eval $(cmake-package))
Signature · 1 line
1.9.1
#1 lore raw

PATCH v3 1/1 ubus: new package

Hi Alexey,

Quoted 50 lines · Alexey Mednyy
---
 package/Config.in                              |  1 +
 package/ubus/Config.in                         | 14 +++++++++++++
 package/ubus/ubus-01-json-definition-fix.patch | 27 +++++++++++++++++++++++++
 package/ubus/ubus.mk                           | 28 ++++++++++++++++++++++++++
 4 files changed, 70 insertions(+)
 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
package/Config.in +1 -0
index 19bb9bf..16d4901 100644
@@ -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"
package/ubus/Config.in new file +14 -0
new file mode 100644
index 0000000..b0f5de9
@@ -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
package/ubus/ubus-01-json-definition-fix.patch new file +1 -0
new file mode 100644
index 0000000..50f9096
@@ -0,0 +1,27 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt

package/ubus/ubus-01-json-definition-fix.patch line 11

Quoted 10 lines
package/ubus/ubus-01-json-definition-fix.patch new file +10 -0
+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)

Here, PkgConfig is mandatory, so add REQUIRED to the find_package args.

package/ubus/ubus-01-json-definition-fix.patch line 12

Quoted 1 line
package/ubus/ubus-01-json-definition-fix.patch new file +1 -0
++PKG_CHECK_MODULES(JSONC json-c)

Here, json-c is mandatory, so add REQUIRED to the pkg_check_modules args.

package/ubus/ubus-01-json-definition-fix.patch line 16

Quoted 4 lines
package/ubus/ubus-01-json-definition-fix.patch new file +4 -0
++IF(JSONC_FOUND)
++  ADD_DEFINITIONS(-DJSONC)
++  INCLUDE_DIRECTORIES(${JSONC_INCLUDE_DIRS})
++ENDIF()

Since json-c in mandatory, there is no need for conditional actions about json-c, so just remove the if() and endif() lines. Sorry, I didn't notice that in the previous review. :-s

package/ubus/ubus-01-json-definition-fix.patch line 21

Quoted 5 lines
package/ubus/ubus-01-json-definition-fix.patch new file +5 -0
++
+ 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)

I didn't check in the previous review, but blobmsg_json is provided by another project, so either it is a required dependency that should be integrated in Buildroot too, or this is an optional dependency and you should disable it (something similar to what you've done for json-c, but always forcing its option to OFF in the _CONF_OPTS).

package/ubus/ubus-01-json-definition-fix.patch line 24

Quoted 3 lines
package/ubus/ubus-01-json-definition-fix.patch new file +3 -0
++IF(JSONC_FOUND)
++  TARGET_LINK_LIBRARIES(cli ${JSONC_LIBRARIES})
++ENDIF()

Same here (no if/endif lines). So, ${JSONC_LIBRARIES} can go back with the others libs (in the first targte_link_library call.

package/ubus/ubus-01-json-definition-fix.patch line 27

Quoted 3 lines
package/ubus/ubus-01-json-definition-fix.patch new file +3 -0
+
+ ADD_SUBDIRECTORY(lua)
+ ADD_SUBDIRECTORY(examples)

Also, while checking the upstream project, I noticed that:
- "-Werror" is added to the cflags.
Please remove it, otherwise it may/will fail in a number of build
configuration.
Usually, -Werror is good during the development but bad/PITA for integration.
- BUILD_EXAMPLES is ON by default, consider disabling it or add an option driving it.

Quoted 8 lines
package/ubus/ubus.mk new file +2 -0
new file mode 100644
index 0000000..652ab48
@@ -0,0 +1,28 @@
+################################################################################
+#

package/ubus/ubus.mk line 12

Quoted 10 lines
package/ubus/ubus.mk new file +10 -0
+# UBUS
+#
+################################################################################
+
+UBUS_VERSION = 4c4f35cf2230d70b9ddd87638ca911e8a563f2f3
+UBUS_SITE = git://nbd.name/luci2/ubus.git
+UBUS_LICENSE = LGPLv2.1
+UBUS_DEPENDENCIES = json-c libubox
+
+ifeq ($(BR2_USE_MMU)$(BR2_PACKAGE_LUA_5_1),yy)

Why BR2_USE_MMU?

package/ubus/ubus.mk line 23

Quoted 11 lines
package/ubus/ubus.mk new file +11 -0
+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_CONF_OPTS += systemd \
+       -DENABLE_SYSTEMD=ON

should be:
UBUS_DEPENDENCIES += systemd
UBUS_CONF_OPTS += -DENABLE_SYSTEMD=ON

Quoted 8 lines
package/ubus/ubus.mk new file +5 -1
+else
+UBUS_CONF_OPTS += -DENABLE_SYSTEMD=OFF
+endif
+
+$(eval $(cmake-package))
--

1.9.1

Quoted 4 lines

_______________________________________________
buildroot mailing list
buildroot at busybox.net
http://lists.busybox.net/mailman/listinfo/buildroot

Regards,

Signature · 1 line
Samuel
#2 lore raw

PATCH v3 1/1 ubus: new package

Thank you for reviews!

Quoted 11 lines · Samuel Martin
Quoted 5 lines

++
+ 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)

I didn't check in the previous review, but blobmsg_json is provided by another project, so either it is a required dependency that should be integrated in Buildroot too, or this is an optional dependency and you should disable it (something similar to what you've done for json-c, but always forcing its option to OFF in the _CONF_OPTS).

No, blobmsg_json provided by libubox which already in Buildroot.

Quoted 28 lines
Quoted 3 lines

++IF(JSONC_FOUND)
++ TARGET_LINK_LIBRARIES(cli ${JSONC_LIBRARIES})
++ENDIF()

Same here (no if/endif lines). So, ${JSONC_LIBRARIES} can go back with the others libs (in the first targte_link_library call.

Quoted 3 lines

+
+ ADD_SUBDIRECTORY(lua)
+ ADD_SUBDIRECTORY(examples)

Also, while checking the upstream project, I noticed that:
- "-Werror" is added to the cflags.
Please remove it, otherwise it may/will fail in a number of build
configuration.
Usually, -Werror is good during the development but bad/PITA for integration.
- BUILD_EXAMPLES is ON by default, consider disabling it or add an option driving it.

Quoted 11 lines
package/ubus/ubus.mk new file +5 -0
new file mode 100644
index 0000000..652ab48
@@ -0,0 +1,28 @@
+################################################################################
+#
+# UBUS
+#
+################################################################################
Quoted 8 lines

package/ubus/ubus.mk line 12

Quoted 7 lines
package/ubus/ubus.mk new file +7 -0
+
+UBUS_VERSION = 4c4f35cf2230d70b9ddd87638ca911e8a563f2f3
+UBUS_SITE = git://nbd.name/luci2/ubus.git
+UBUS_LICENSE = LGPLv2.1
+UBUS_DEPENDENCIES = json-c libubox
+
+ifeq ($(BR2_USE_MMU)$(BR2_PACKAGE_LUA_5_1),yy)

Why BR2_USE_MMU?

Not sure, just took it from libubox.mk which is mandatory dependency.. I think I must disable it. There is no such requirement.

Signature · 2 lines
_________________________________
Best regards, Mednyy Alexey.
#3 lore raw

PATCH v3 1/1 ubus: new package

Hi Alexey,

Quoted 8 lines · Alexey Mednyy

Thank you for reviews!

Quoted 5 lines · Samuel Martin
Quoted 5 lines

++
+ 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)

Quoted 7 lines
Quoted 6 lines

I didn't check in the previous review, but blobmsg_json is provided by another project, so either it is a required dependency that should be integrated in Buildroot too, or this is an optional dependency and you should disable it (something similar to what you've done for json-c, but always forcing its option to OFF in the _CONF_OPTS).

No, blobmsg_json provided by libubox which already in Buildroot.

Ok, my bad, i didn't look at libubox.

Quoted 36 lines
Quoted 28 lines
Quoted 3 lines

++IF(JSONC_FOUND)
++ TARGET_LINK_LIBRARIES(cli ${JSONC_LIBRARIES})
++ENDIF()

Same here (no if/endif lines). So, ${JSONC_LIBRARIES} can go back with the others libs (in the first targte_link_library call.

Quoted 3 lines

+
+ ADD_SUBDIRECTORY(lua)
+ ADD_SUBDIRECTORY(examples)

Also, while checking the upstream project, I noticed that:
- "-Werror" is added to the cflags.
Please remove it, otherwise it may/will fail in a number of build
configuration.
Usually, -Werror is good during the development but bad/PITA for integration.
- BUILD_EXAMPLES is ON by default, consider disabling it or add an option driving it.

Quoted 11 lines
package/ubus/ubus.mk new file +5 -0
new file mode 100644
index 0000000..652ab48
@@ -0,0 +1,28 @@
+################################################################################
+#
+# UBUS
+#
+################################################################################
Quoted 8 lines

package/ubus/ubus.mk line 12

Quoted 7 lines
package/ubus/ubus.mk new file +7 -0
+
+UBUS_VERSION = 4c4f35cf2230d70b9ddd87638ca911e8a563f2f3
+UBUS_SITE = git://nbd.name/luci2/ubus.git
+UBUS_LICENSE = LGPLv2.1
+UBUS_DEPENDENCIES = json-c libubox
+
+ifeq ($(BR2_USE_MMU)$(BR2_PACKAGE_LUA_5_1),yy)

Why BR2_USE_MMU?

Quoted 2 lines

Not sure, just took it from libubox.mk which is mandatory dependency.. I think I must disable it. There is no such requirement.

Then the dependency should be put in the Config.in, not in the *.mk file (check how it's done for other packages, there are plenty of them depending on !BR2_USE_MMU)

Regards,

Quoted 5 lines

--
_________________________________
Best regards, Mednyy Alexey.

Signature · 1 line
Samuel
#4 lore raw

PATCH v3 1/1 ubus: new package

In reply to Alexey Mednyy

package/ubus/ubus-01-json-definition-fix.patch

Quoted 49 lines · Alexey Mednyy
---
 package/Config.in                              |  1 +
 package/ubus/Config.in                         | 14 +++++++++++++
 package/ubus/ubus-01-json-definition-fix.patch | 27 +++++++++++++++++++++++++
 package/ubus/ubus.mk                           | 28 ++++++++++++++++++++++++++
 4 files changed, 70 insertions(+)
 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
package/Config.in +1 -0
index 19bb9bf..16d4901 100644
@@ -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"
package/ubus/Config.in new file +14 -0
new file mode 100644
index 0000000..b0f5de9
@@ -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
package/ubus/ubus-01-json-definition-fix.patch new file +0 -0
new file mode 100644
index 0000000..50f9096
@@ -0,0 +1,27 @@

In addition to Samuel's comments, a path should have a description and a
Signed-off-by line, just like if it was an actual commit (see [1]). We would anyway like you to upstream this patch to OpenWRT, so you'll need that commit message and SoB there anyway.

package/ubus/ubus-01-json-definition-fix.patch line 4

Quoted 4 lines
package/ubus/ubus-01-json-definition-fix.patch new file +4 -0
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index cb2f420..86c4c4d 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt

[snip]

Regards,
Arnout

[1]
http://nightly.buildroot.org/manual.html#_format_and_licensing_of_the_package_patches

Signature · 6 lines
Arnout Vandecappelle                          arnout at mind be
Senior Embedded Software Architect            +32-16-286500
Essensium/Mind                                http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium           BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7CB5 E4CC 6C2E EFD4 6E3D A754 F963 ECAB 2450 2F1F