From 1b533c2d9ee6247939fb34fbe6550dea0a656ff1 Mon Sep 17 00:00:00 2001 From: Michel Alex Date: Mon, 13 May 2024 12:30:49 +0000 Subject: [PATCH] package/libzenoh-c: new package This package provides a C binding based on the main Zenoh implementation written in Rust. https://github.com/eclipse-zenoh/zenoh-c Signed-off-by: Alex Michel Signed-off-by: Thomas Petazzoni --- DEVELOPERS | 1 + package/Config.in | 1 + package/libzenoh-c/Config.in | 9 +++++++ package/libzenoh-c/libzenoh-c.hash | 3 +++ package/libzenoh-c/libzenoh-c.mk | 40 ++++++++++++++++++++++++++++++ 5 files changed, 54 insertions(+) create mode 100644 package/libzenoh-c/Config.in create mode 100644 package/libzenoh-c/libzenoh-c.hash create mode 100644 package/libzenoh-c/libzenoh-c.mk diff --git a/DEVELOPERS b/DEVELOPERS index ad03c26ea4..a9deddb343 100644 --- a/DEVELOPERS +++ b/DEVELOPERS @@ -83,6 +83,7 @@ N: Alessandro Partesotti F: package/oatpp/ N: Alex Michel +F: package/libzenoh-c/ F: package/libzenoh-pico/ F: package/network-manager-openvpn/ diff --git a/package/Config.in b/package/Config.in index 768103e0c4..1b6a5b0dab 100644 --- a/package/Config.in +++ b/package/Config.in @@ -2048,6 +2048,7 @@ menu "Networking" source "package/libwebsock/Config.in" source "package/libwebsockets/Config.in" source "package/libyang/Config.in" + source "package/libzenoh-c/Config.in" source "package/libzenoh-pico/Config.in" source "package/lksctp-tools/Config.in" source "package/mbuffer/Config.in" diff --git a/package/libzenoh-c/Config.in b/package/libzenoh-c/Config.in new file mode 100644 index 0000000000..d22807c047 --- /dev/null +++ b/package/libzenoh-c/Config.in @@ -0,0 +1,9 @@ +config BR2_PACKAGE_LIBZENOH_C + bool "libzenoh-c" + depends on BR2_PACKAGE_HOST_RUSTC_TARGET_ARCH_SUPPORTS + select BR2_PACKAGE_HOST_RUSTC + help + This package provides a C binding based on the main + Zenoh implementation written in Rust. + + https://github.com/eclipse-zenoh/zenoh-c diff --git a/package/libzenoh-c/libzenoh-c.hash b/package/libzenoh-c/libzenoh-c.hash new file mode 100644 index 0000000000..8331f5cca4 --- /dev/null +++ b/package/libzenoh-c/libzenoh-c.hash @@ -0,0 +1,3 @@ +# Locally computed +sha256 c792f0be936ecbb3f759124be28950a01385f4680eaf4f1da55997640899648e libzenoh-c-0.11.0.2-cargo2.tar.gz +sha256 01a44774f7b1a453595c7c6d7f7308284ba6a1059dc49e14dad6647e1d44a338 LICENSE diff --git a/package/libzenoh-c/libzenoh-c.mk b/package/libzenoh-c/libzenoh-c.mk new file mode 100644 index 0000000000..3a50fe6bf1 --- /dev/null +++ b/package/libzenoh-c/libzenoh-c.mk @@ -0,0 +1,40 @@ +################################################################################ +# +# libzenoh-c +# +################################################################################ + +LIBZENOH_C_VERSION = 0.11.0.2 +LIBZENOH_C_SITE = $(call github,eclipse-zenoh,zenoh-c,$(LIBZENOH_C_VERSION)) +LIBZENOH_C_LICENSE = Apache-2.0 or EPL-2.0 +LIBZENOH_C_LICENSE_FILES = LICENSE +LIBZENOH_C_INSTALL_STAGING = YES + +ifeq ($(BR2_ENABLE_DEBUG),y) +LIBZENOH_C_LIB_LOCATION = $(@D)/target/$(RUSTC_TARGET_NAME)/debug +else +LIBZENOH_C_LIB_LOCATION = $(@D)/target/$(RUSTC_TARGET_NAME)/release +endif + +define LIBZENOH_C_INSTALL_FILES + $(INSTALL) -D -m 644 \ + $(LIBZENOH_C_LIB_LOCATION)/libzenohc.so \ + $(1)/usr/lib/libzenohc.so +endef + +# This package does not provide any binaries or examples, and the +# cargo infra does not provide any possibility to disable the --bins +# option in cargo install step, we have to override the +# INSTALL_STAGING_CMDS and the INSTALL_TARGET_CMDS macros. + +define LIBZENOH_C_INSTALL_TARGET_CMDS + $(call LIBZENOH_C_INSTALL_FILES,$(TARGET_DIR)) +endef + +define LIBZENOH_C_INSTALL_STAGING_CMDS + $(call LIBZENOH_C_INSTALL_FILES,$(STAGING_DIR)) + mkdir -p $(STAGING_DIR)/usr/include/ + cp -dpfr $(@D)/include/* $(STAGING_DIR)/usr/include/ +endef + +$(eval $(cargo-package))