iopsys-feed/bridgemngr/Makefile
Xiaofeng Meng 5c514051a2 Add dm-framework for bridgemngr
Introduce dm-framework.mk providing reusable build macros for packages
that integrate with the DM Framework:

- Build/Compile/DM: Generates C code and shared libraries from JSON data
  models using json2code.js, compiles them, and creates package-specific
  .so files
- Build/Install/DM: Installs generated libraries, JS handlers,
  and data model files to the dm-framework directory(dmf)

Also adds bridgemngr as the first package utilizing these helpers to
implement bridge data model with dm-framework, which can be enabled
through flag CONFIG_BRIDGEMNGR_USE_DM_FRAMEWORK.

The commit also include changes in bbfdm dm-framework adaption.
2025-12-09 14:56:19 +01:00

101 lines
2.6 KiB
Makefile

#
# Copyright (C) 2020-2024 iopsys
#
include $(TOPDIR)/rules.mk
PKG_NAME:=bridgemngr
PKG_VERSION:=1.1.6
LOCAL_DEV:=0
ifneq ($(LOCAL_DEV),1)
PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://dev.iopsys.eu/network/bridgemngr.git
PKG_SOURCE_VERSION:=882f8c8cc9a97372297d192cc916c4f8ffe7c25a
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
PKG_MIRROR_HASH:=skip
endif
PKG_LICENSE:=GPL-2.0-only
PKG_LICENSE_FILES:=LICENSE
include $(INCLUDE_DIR)/package.mk
ifneq ($(CONFIG_BRIDGEMNGR_USE_DM_FRAMEWORK),y)
include ../bbfdm/bbfdm.mk
else
include ../dm-framework/dm-framework.mk
endif
define Package/bridgemngr
CATEGORY:=Utilities
TITLE:=Bridge Manager
DEPENDS:=+libuci +libubox +libubus +libblobmsg-json
ifeq ($(CONFIG_BRIDGEMNGR_USE_DM_FRAMEWORK),y)
DEPENDS+= +dm-framework
PKG_BUILD_DEPENDS:=dm-framework
else
DEPENDS+= +libbbfdm-api +libbbfdm-ubus +dm-service
endif
endef
define Package/bridgemngr/description
Package to add Device.Bridging. data model support.
endef
define Package/$(PKG_NAME)/config
source "$(SOURCE)/Config.in"
endef
ifneq ($(CONFIG_BRIDGEMNGR_USE_DM_FRAMEWORK),y)
MAKE_PATH:=src
endif
ifeq ($(CONFIG_BRIDGEMNGR_BRIDGE_VENDOR_PREFIX),"")
VENDOR_PREFIX = $(if $(CONFIG_BBF_VENDOR_PREFIX),$(CONFIG_BBF_VENDOR_PREFIX),$(CONFIG_DM_FRAMEWORK_VENDOR_PREFIX))
else
VENDOR_PREFIX = $(CONFIG_BRIDGEMNGR_BRIDGE_VENDOR_PREFIX)
endif
TARGET_CFLAGS += -DBBF_VENDOR_PREFIX=\\\"$(VENDOR_PREFIX)\\\"
ifeq ($(CONFIG_BRIDGEMNGR_BRIDGE_VLAN),y)
TARGET_CFLAGS += -DBRIDGE_VLAN_BACKEND
endif
ifeq ($(CONFIG_BRIDGEMNGR_COPY_PBITS),y)
TARGET_CFLAGS += -DBRIDGEMNGR_COPY_PBITS
endif
ifeq ($(CONFIG_BRIDGEMNGR_USE_DM_FRAMEWORK),y)
define Build/Compile
$(call Build/Compile/DM,./dm,$(PKG_BUILD_DIR)/dm_build,$(VENDOR_PREFIX))
endef
endif
define Package/bridgemngr/install
$(INSTALL_DIR) $(1)/etc/init.d
$(INSTALL_DIR) $(1)/etc/config
ifeq ($(CONFIG_BRIDGEMNGR_USE_DM_FRAMEWORK),y)
$(call Build/Install/DM,./dm,$(PKG_BUILD_DIR)/dm_build,$(1),bridgemngr)
else
$(BBFDM_REGISTER_SERVICES) ./bbfdm_service.json $(1) $(PKG_NAME)
$(BBFDM_INSTALL_MS_DM) $(PKG_BUILD_DIR)/src/libbridgemngr.so $(1) $(PKG_NAME)
ifeq ($(CONFIG_BRIDGEMNGR_BRIDGE_VENDOR_EXT), y)
$(BBFDM_INSTALL_MS_PLUGIN) $(PKG_BUILD_DIR)/src/libbridgeext.so $(1) $(PKG_NAME) 10
$(BBFDM_INSTALL_MS_PLUGIN) -v ${VENDOR_PREFIX} ./files/VLAN_Filtering_Extension.json $(1) $(PKG_NAME) 11
endif
endif
$(INSTALL_BIN) ./files/etc/init.d/bridging $(1)/etc/init.d/
$(INSTALL_DATA) ./files/etc/config/bridging $(1)/etc/config/
endef
ifeq ($(LOCAL_DEV),1)
define Build/Prepare
$(CP) ~/git/bridgemngr/* $(PKG_BUILD_DIR)/
endef
endif
$(eval $(call BuildPackage,bridgemngr))