Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 44 additions & 22 deletions packages/shared-state-async/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,12 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=shared-state-async

PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://github.com/libremesh/shared-state-async.git
PKG_SOURCE_DATE:=2024-05-13
PKG_SOURCE_VERSION:=db58e3d16e8658417956f9bb42e7e87f6aadcd4d
PKG_SOURCE_URL:=https://github.com/javierbrk/shared-state-async.git
PKG_SOURCE_VERSION:=use-statically-linked-stdlib
PKG_MAINTAINER:=Asociación Civil Altermundi <info@altermundi.net>
PKG_LICENSE:=AGPL-3.0-only

# tar.xz or tar.zst
PKG_XZ=$(shell top="$(TOPDIR)" && grep -q openwrt-23.05 $${top}/feeds.conf.default && echo true)
ifeq ($(PKG_XZ),true)
PKG_MIRROR_HASH:=35884a57e26058c6534b25c50b9aef14df81da501be1d153a9bb7923a47154dd
else
PKG_MIRROR_HASH:=649c977e5d32fe232c8d0cb617ec04c6e4bd767dfac40ebcdb1630ab990fcd8f
endif


GIT_COMMIT_DATE:=$(shell psd="$(PKG_SOURCE_DATE)" && echo $${psd} | sed 's|-|.|g' )
GIT_COMMIT_SHORTHASH:=$(shell psv="$(PKG_SOURCE_VERSION)" && echo $${psv:0:7} )
Expand All @@ -35,17 +28,35 @@ include $(INCLUDE_DIR)/package.mk
include $(INCLUDE_DIR)/cmake.mk
include $(INCLUDE_DIR)/host-build.mk

define Package/$(PKG_NAME)
TITLE:=shared-state C++ async re-implementation
CATEGORY:=LibreMesh
# TODO: Statically linking libstdcpp instead of depending on it and then
# stripping unused symbols might reduce space usage, until this is the
# only package to use it
DEPENDS:=+libstdcpp
define Package/shared-state-async/Default
TITLE:=shared-state C++ async
CATEGORY:=LibreMesh
URL:=https://github.com/libremesh/shared-state-async
endef

define Package/shared-state-async
$(call Package/shared-state-async/Default)
TITLE+= (dynamic linking)
DEPENDS:=+libstdcpp
VARIANT:=dynamic
CONFLICTS:=shared-state-async-static
endef

define Package/shared-state-async-static
$(call Package/shared-state-async/Default)
TITLE+= (static linking)
VARIANT:=static
PROVIDES:=shared-state-async
CONFLICTS:=shared-state-async
endef

define Package/shared-state-async/description
shared-state re-written in C++20 and coroutines to handle information exchange between network nodes more efficiently.
endef

define Package/$(PKG_NAME)/description
shared-state re-written in C++20 and corotuines to handle information exchange between network nodes more efficiently.
define Package/shared-state-async-static/description
shared-state re-written in C++20 and coroutines to handle information exchange between network nodes more efficiently.
This variant is statically linked against the C++ standard library.
endef

# Otherwise OpenWrt's CPPFLAGS are ignored
Expand All @@ -59,10 +70,18 @@ CMAKE_OPTIONS += -DCMAKE_VERBOSE_MAKEFILE=ON
# #0 0x00000000
# #1 0x00000000
# #2 0x00000000
CMAKE_OPTIONS += -DSS_CPPTRACE_STACKTRACE=OFF
CMAKE_OPTIONS += -DSS_CPPTRACE_STACKTRACE=OFF

# Build configuration según variante
ifeq ($(BUILD_VARIANT),static)
CMAKE_OPTIONS += -DSS_STATIC_LIBSTDCPP=ON
CMAKE_OPTIONS += -DSS_STRIP_SYMBOLS=ON
else
CMAKE_OPTIONS += -DSS_STATIC_LIBSTDCPP=OFF
CMAKE_OPTIONS += -DSS_STRIP_SYMBOLS=OFF
endif

define Package/$(PKG_NAME)/install
define Package/shared-state-async/install
$(INSTALL_DIR) $(1)/usr/bin
$(INSTALL_BIN) $(PKG_BUILD_DIR)/shared-state-async $(1)/usr/bin/
$(CP) ./files/* $(1)/
Expand All @@ -71,4 +90,7 @@ define Package/$(PKG_NAME)/install
$(CP) ../shared-state/files/usr/bin/shared-state-get_candidates_neigh $(1)/usr/bin/shared-state-async-discover
endef

$(eval $(call BuildPackage,$(PKG_NAME)))
Package/shared-state-async-static/install = $(Package/shared-state-async/install)

$(eval $(call BuildPackage,shared-state-async))
$(eval $(call BuildPackage,shared-state-async-static))