Skip to contentSkip to conversation

ubus: new package

PATCH New Sergio Prado 2 participants 3 messages Nov 28, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ubus: new package

---
 package/Config.in                                  |  1 +
 .../0001-Install-server-and-client-examples.patch  | 22 ++++++++++
 package/ubus/Config.in                             | 26 ++++++++++++
 package/ubus/ubus.hash                             |  2 +
 package/ubus/ubus.mk                               | 47 ++++++++++++++++++++++
 5 files changed, 98 insertions(+)
 create mode 100644 package/ubus/0001-Install-server-and-client-examples.patch
 create mode 100644 package/ubus/Config.in
 create mode 100644 package/ubus/ubus.hash
 create mode 100644 package/ubus/ubus.mk
package/Config.in +1 -0
index 988fe844b872..12a3e91c8e44 100644
@@ -430,6 +430,7 @@ endif
 	source "package/ti-utils/Config.in"
 	source "package/triggerhappy/Config.in"
 	source "package/uboot-tools/Config.in"
+	source "package/ubus/Config.in"
 	source "package/udev/Config.in"
 	source "package/udisks/Config.in"
 	source "package/usb_modeswitch/Config.in"
package/ubus/0001-Install-server-and-client-examples.patch new file +22 -0
new file mode 100644
index 000000000000..81e664f2beea
@@ -0,0 +1,22 @@
+Install server and client examples
+
+Signed-off-by: Sergio Prado <[email protected]>
+---
+ examples/CMakeLists.txt | 4 ++++
+ 1 file changed, 4 insertions(+)
+
+diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt
+index 0279f6e66b50..7cec87e5e8f9 100644
+--- a/examples/CMakeLists.txt
++++ b/examples/CMakeLists.txt
+@@ -10,3 +10,7 @@ IF (BUILD_EXAMPLES)
+ 	ADD_EXECUTABLE(client client.c count.c)
+ 	TARGET_LINK_LIBRARIES(client ubus ubox)
+ ENDIF()
++
++INSTALL(TARGETS server client
++	RUNTIME DESTINATION sbin
++)
+-- 
+1.9.1
+
package/ubus/Config.in new file +26 -0
new file mode 100644
index 000000000000..fa89c8f3cd68
@@ -0,0 +1,26 @@
+config BR2_PACKAGE_UBUS
+	bool "ubus"
+	select BR2_PACKAGE_LIBUBOX
+	select BR2_PACKAGE_JSON_C
+	depends on !BR2_STATIC_LIBS # libubox
+	help
+	  IPC/RPC bus that allows communication between processes.
+
+	  It consists of few parts including a daemon (ubusd), a library
+	  (libubus) and a command line interface (ubus). Although created
+	  for the OpenWRT project, it can be used as a general IPC/RPC
+	  mechanism in other projects.
+
+	  * Select BR2_PACKAGE_LUA_5_1 if you want to have Lua support.
+
+	  https://wiki.openwrt.org/doc/techref/ubus
+
+if BR2_PACKAGE_UBUS
+
+config BR2_PACKAGE_UBUS_EXAMPLES
+	bool "build and install ubus examples"
+	default n
+	help
+	  Build and install client and server ubus examples.
+
+endif
package/ubus/ubus.hash new file +2 -0
new file mode 100644
index 000000000000..af9b652b0e1d
@@ -0,0 +1,2 @@
+# No hash for this git snapshot
+none  xxx  ubus-259450f414d8c9ee41896e8e6d6bc57ec00e2b63.tar.gz
package/ubus/ubus.mk new file +47 -0

47 lines not on this page · raw message

Signature · 1 line
1.9.1
#1 lore raw

PATCH 1/1 ubus: new package

Dear Sergio Prado,

package/ubus/0001-Install-server-and-client-examples.patch line 19

Quoted 12 lines · Sergio Prado
package/ubus/0001-Install-server-and-client-examples.patch new file +12 -0
+diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt
+index 0279f6e66b50..7cec87e5e8f9 100644
+--- a/examples/CMakeLists.txt
++++ b/examples/CMakeLists.txt
+@@ -10,3 +10,7 @@ IF (BUILD_EXAMPLES)
+ 	ADD_EXECUTABLE(client client.c count.c)
+ 	TARGET_LINK_LIBRARIES(client ubus ubox)
+ ENDIF()
++
++INSTALL(TARGETS server client
++	RUNTIME DESTINATION sbin
++)

I think this patch is wrong, because if you build with the examples disabled, the configure step fails with:

-- Detecting C compile features
-- Detecting C compile features - done
CMake Error at examples/CMakeLists.txt:14 (INSTALL):
install TARGETS given target "server" which does not exist in this directory.

Quoted 9 lines

+--
+1.9.1

(quoted diff) +1 -0
+
package/ubus/Config.in new file +0 -0
new file mode 100644
index 000000000000..fa89c8f3cd68

package/ubus/Config.in line 5

Quoted 5 lines
package/ubus/Config.in new file +5 -0
@@ -0,0 +1,26 @@
+config BR2_PACKAGE_UBUS
+	bool "ubus"
+	select BR2_PACKAGE_LIBUBOX
+	select BR2_PACKAGE_JSON_C
+	depends on !BR2_STATIC_LIBS # libubox

You need to add a comment:

comment "ubus needs a toolchain w/ dynamic library"
depends on BR2_STATIC_LIBS

Quoted 7 lines
package/ubus/Config.in new file +7 -0
+	help
+	  IPC/RPC bus that allows communication between processes.
+
+	  It consists of few parts including a daemon (ubusd), a library
+	  (libubus) and a command line interface (ubus). Although created
+	  for the OpenWRT project, it can be used as a general IPC/RPC
+	  mechanism in other projects.

package/ubus/Config.in line 22

Quoted 10 lines
package/ubus/Config.in new file +10 -0
+
+	  * Select BR2_PACKAGE_LUA_5_1 if you want to have Lua support.
+
+	  https://wiki.openwrt.org/doc/techref/ubus
+
+if BR2_PACKAGE_UBUS
+
+config BR2_PACKAGE_UBUS_EXAMPLES
+	bool "build and install ubus examples"
+	default n

Not needed, this is the default

Quoted 30 lines
package/ubus/Config.in new file +4 -0
+	help
+	  Build and install client and server ubus examples.
+
+endif
package/ubus/ubus.hash new file +2 -0
new file mode 100644
index 000000000000..af9b652b0e1d
@@ -0,0 +1,2 @@
+# No hash for this git snapshot
+none  xxx  ubus-259450f414d8c9ee41896e8e6d6bc57ec00e2b63.tar.gz
package/ubus/ubus.mk new file +12 -0
new file mode 100644
index 000000000000..2ecc023e110a
@@ -0,0 +1,47 @@
+################################################################################
+#
+# ubus
+#
+################################################################################
+
+UBUS_VERSION = 259450f414d8c9ee41896e8e6d6bc57ec00e2b63
+UBUS_SITE = git://git.openwrt.org/project/ubus.git
+
+UBUS_LICENSE = LGPLv2.1
+UBUS_LICENSE_FILES = ubusd_acl.h
+

package/ubus/ubus.mk line 22

Quoted 10 lines
package/ubus/ubus.mk new file +10 -0
+UBUS_INSTALL_STAGING = YES
+
+UBUS_DEPENDENCIES = json-c libubox
+
+# package only compiles with Lua 5.1
+ifeq ($(BR2_PACKAGE_LUA_5_1),y)
+UBUS_DEPENDENCIES += lua
+UBUS_CONF_OPTS += -DBUILD_LUA=ON \
+                  -DLUA_CFLAGS=-I$(STAGING_DIR)/usr/include \
+                  -DLUAPATH=/usr/lib/lua/$(LUAINTERPRETER_ABIVER)

Indent with just one tab here.

Quoted 13 lines
package/ubus/ubus.mk new file +13 -0
+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
+
+ifeq ($(BR2_PACKAGE_UBUS_EXAMPLES),y)
+UBUS_CONF_OPTS += -DBUILD_EXAMPLES=ON

package/ubus/ubus.mk line 45

Quoted 10 lines
package/ubus/ubus.mk new file +10 -0
+else
+UBUS_CONF_OPTS += -DBUILD_EXAMPLES=OFF
+endif
+
+define UBUS_INSTALL_STAGING_CMDS
+	$(INSTALL) -D -m 0755 $(@D)/libubus.so* $(STAGING_DIR)/usr/lib
+	$(INSTALL) -D -m 0644 $(@D)/ubusmsg.h $(STAGING_DIR)/usr/include
+	$(INSTALL) -D -m 0644 $(@D)/ubus_common.h $(STAGING_DIR)/usr/include
+	$(INSTALL) -D -m 0644 $(@D)/libubus.h $(STAGING_DIR)/usr/include
+endef

Why don't you just use the default installation logic, like is done for the target installation ? Installing more than strictly needed to staging is not a problem.

Thanks,

Thomas

Signature · 3 lines
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
#2 lore raw

PATCH 1/1 ubus: new package

Hi Thomas,

2015-11-28 15:51 GMT-02:00 Thomas Petazzoni <
[email protected]>:

Quoted 20 lines

Dear Sergio Prado,

package/ubus/0001-Install-server-and-client-examples.patch line 19

Quoted 12 lines · Sergio Prado
package/ubus/0001-Install-server-and-client-examples.patch new file +12 -0
+diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt
+index 0279f6e66b50..7cec87e5e8f9 100644
+--- a/examples/CMakeLists.txt
++++ b/examples/CMakeLists.txt
+@@ -10,3 +10,7 @@ IF (BUILD_EXAMPLES)
+     ADD_EXECUTABLE(client client.c count.c)
+     TARGET_LINK_LIBRARIES(client ubus ubox)
+ ENDIF()
++
++INSTALL(TARGETS server client
++    RUNTIME DESTINATION sbin
++)

I think this patch is wrong, because if you build with the examples disabled, the configure step fails with:

Quoted 6 lines

-- Detecting C compile features
-- Detecting C compile features - done
CMake Error at examples/CMakeLists.txt:14 (INSTALL):
install TARGETS given target "server" which does not exist in this directory.

Ops, my bad. The install should occur inside the IF statement. I forgot to test with the examples disabled after adding this patch. Will be fixed in v2.

Quoted 19 lines
Quoted 11 lines

+--
+1.9.1

(quoted diff) +1 -0
+
package/ubus/Config.in new file +0 -0
new file mode 100644
index 000000000000..fa89c8f3cd68

package/ubus/Config.in line 5

Quoted 5 lines
package/ubus/Config.in new file +5 -0
@@ -0,0 +1,26 @@
+config BR2_PACKAGE_UBUS
+     bool "ubus"
+     select BR2_PACKAGE_LIBUBOX
+     select BR2_PACKAGE_JSON_C
+     depends on !BR2_STATIC_LIBS # libubox

You need to add a comment:

Quoted 3 lines

comment "ubus needs a toolchain w/ dynamic library"
depends on BR2_STATIC_LIBS

OK.

Quoted 12 lines
Quoted 12 lines
package/ubus/Config.in new file +11 -0
+     help
+       IPC/RPC bus that allows communication between processes.
+
+       It consists of few parts including a daemon (ubusd), a library
+       (libubus) and a command line interface (ubus). Although created
+       for the OpenWRT project, it can be used as a general IPC/RPC
+       mechanism in other projects.
+
+       * Select BR2_PACKAGE_LUA_5_1 if you want to have Lua support.
+
+       https://wiki.openwrt.org/doc/techref/ubus
Quoted 9 lines

package/ubus/Config.in line 22

Quoted 6 lines
package/ubus/Config.in new file +6 -0
+
+if BR2_PACKAGE_UBUS
+
+config BR2_PACKAGE_UBUS_EXAMPLES
+     bool "build and install ubus examples"
+     default n

Not needed, this is the default

OK.

Quoted 37 lines

package/ubus/ubus.mk

Quoted 20 lines
package/ubus/Config.in new file +4 -0
+     help
+       Build and install client and server ubus examples.
+
+endif
package/ubus/ubus.hash new file +2 -0
new file mode 100644
index 000000000000..af9b652b0e1d
@@ -0,0 +1,2 @@
+# No hash for this git snapshot
+none  xxx  ubus-259450f414d8c9ee41896e8e6d6bc57ec00e2b63.tar.gz
package/ubus/ubus.mk new file +0 -0
new file mode 100644
index 000000000000..2ecc023e110a
@@ -0,0 +1,47 @@

+################################################################################

package/ubus/ubus.mk line 4

Quoted 4 lines
package/ubus/ubus.mk new file +3 -0
+#
+# ubus
+#

+################################################################################

Quoted 11 lines
package/ubus/ubus.mk new file +11 -0
+
+UBUS_VERSION = 259450f414d8c9ee41896e8e6d6bc57ec00e2b63
+UBUS_SITE = git://git.openwrt.org/project/ubus.git
+
+UBUS_LICENSE = LGPLv2.1
+UBUS_LICENSE_FILES = ubusd_acl.h
+
+UBUS_INSTALL_STAGING = YES
+
+UBUS_DEPENDENCIES = json-c libubox
+
Quoted 9 lines

package/ubus/ubus.mk line 22

Quoted 6 lines
package/ubus/ubus.mk new file +6 -0
+# package only compiles with Lua 5.1
+ifeq ($(BR2_PACKAGE_LUA_5_1),y)
+UBUS_DEPENDENCIES += lua
+UBUS_CONF_OPTS += -DBUILD_LUA=ON \
+                  -DLUA_CFLAGS=-I$(STAGING_DIR)/usr/include \
+                  -DLUAPATH=/usr/lib/lua/$(LUAINTERPRETER_ABIVER)

Indent with just one tab here.

OK.

Quoted 23 lines
Quoted 12 lines
package/ubus/ubus.mk new file +11 -0
+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
+

package/ubus/ubus.mk

Quoted 10 lines
package/ubus/ubus.mk new file +10 -0
+ifeq ($(BR2_PACKAGE_UBUS_EXAMPLES),y)
+UBUS_CONF_OPTS += -DBUILD_EXAMPLES=ON
+else
+UBUS_CONF_OPTS += -DBUILD_EXAMPLES=OFF
+endif
+
+define UBUS_INSTALL_STAGING_CMDS
+     $(INSTALL) -D -m 0755 $(@D)/libubus.so* $(STAGING_DIR)/usr/lib
+     $(INSTALL) -D -m 0644 $(@D)/ubusmsg.h $(STAGING_DIR)/usr/include
+     $(INSTALL) -D -m 0644 $(@D)/ubus_common.h

$(STAGING_DIR)/usr/include

Quoted 7 lines

package/ubus/ubus.mk line 45

Quoted 2 lines
package/ubus/ubus.mk new file +2 -0
+     $(INSTALL) -D -m 0644 $(@D)/libubus.h $(STAGING_DIR)/usr/include
+endef

Why don't you just use the default installation logic, like is done for the target installation ? Installing more than strictly needed to staging is not a problem.

Right. I thought installing executable files in staging would be bad. In that case, I will keep the default installation logic.

I'm sending v2.

Quoted 2 lines

Thanks,

Thanks!

Quoted 7 lines

Thomas
--
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20151128/5a770cd2/attachment.html>