diff --git a/spk/matter-server/Makefile b/spk/matter-server/Makefile new file mode 100644 index 00000000000..449f5c88d7d --- /dev/null +++ b/spk/matter-server/Makefile @@ -0,0 +1,52 @@ +SPK_NAME = matter-server +SPK_VERS = 8.1.0 +SPK_REV = 1 +SPK_ICON = src/matter.png + +# 64-bit OS supported only +# and therefore home-assistant-chip-core is only available for x64 and aarch64 +UNSUPPORTED_ARCHS = $(32bit_ARCHS) + +# home-assistant-chip-core requires "glibc >= 2.34" +# Despite home-assistant-chip-core wheel is provided as manylinux_2_31, it requires glibc 2.34 and not 2.31 +REQUIRED_MIN_DSM = 7.2 + +PYTHON_PACKAGE = python312 +SPK_DEPENDS = "$(PYTHON_PACKAGE)" + +MAINTAINER = SynoCommunity +DESCRIPTION = The Open Home Foundation Matter Server is an officially certified Software Component to create a Matter controller. It serves as the foundation to provide Matter support to Home Assistant but its universal approach makes it suitable to be used in other projects too. This package conains a custom library for home-assistant-chip-core to allow definition of config data path. +DISPLAY_NAME = Python Matter Server +CHANGELOG = "1. Initial package with custom build of home_assistant_chip_core==2025.7.0" + +HOMEPAGE = https://github.com/home-assistant-libs/python-matter-server +LICENSE = Apache 2.0 + +STARTABLE = yes +SERVICE_SETUP = src/service-setup.sh + +FWPORTS = src/matter-server.sc +SERVICE_PORT = 5580 + +USE_ALTERNATE_TMPDIR = 1 + +POST_STRIP_TARGET = matter-server_extra_install + +WHEELS = src/requirements-crossenv.txt + +# [PyYAML] +DEPENDS += cross/libyaml + +include ../../mk/spksrc.python.mk + +ifeq ($(findstring $(ARCH),$(x64_ARCHS)),$(ARCH)) +CUSTOM_CHIP_WHEELS_DIR = src/custom_wheels/x64 +else ifeq ($(findstring $(ARCH),$(ARMv8_ARCHS)),$(ARCH)) +CUSTOM_CHIP_WHEELS_DIR = src/custom_wheels/aarch64 +endif + +.PHONY: matter-server_extra_install +matter-server_extra_install: + @install -m 755 -d $(STAGING_DIR)/share/wheelhouse + @install -m 644 src/requirements-pure.txt $(STAGING_DIR)/share/ + @install -m 644 $(CUSTOM_CHIP_WHEELS_DIR)/* $(STAGING_DIR)/share/wheelhouse/ diff --git a/spk/matter-server/PLIST b/spk/matter-server/PLIST new file mode 100644 index 00000000000..4cfaf73a12c --- /dev/null +++ b/spk/matter-server/PLIST @@ -0,0 +1 @@ +rsc:share/wheelhouse diff --git a/spk/matter-server/src/custom_wheels/aarch64/home_assistant_chip_core-2025.7.0-cp37-abi3-manylinux_2_31_aarch64.whl b/spk/matter-server/src/custom_wheels/aarch64/home_assistant_chip_core-2025.7.0-cp37-abi3-manylinux_2_31_aarch64.whl new file mode 100644 index 00000000000..ccb3c9bec23 Binary files /dev/null and b/spk/matter-server/src/custom_wheels/aarch64/home_assistant_chip_core-2025.7.0-cp37-abi3-manylinux_2_31_aarch64.whl differ diff --git a/spk/matter-server/src/custom_wheels/x64/home_assistant_chip_core-2025.7.0-cp37-abi3-manylinux_2_31_x86_64.whl b/spk/matter-server/src/custom_wheels/x64/home_assistant_chip_core-2025.7.0-cp37-abi3-manylinux_2_31_x86_64.whl new file mode 100644 index 00000000000..7dab2c7ab38 Binary files /dev/null and b/spk/matter-server/src/custom_wheels/x64/home_assistant_chip_core-2025.7.0-cp37-abi3-manylinux_2_31_x86_64.whl differ diff --git a/spk/matter-server/src/matter-server.sc b/spk/matter-server/src/matter-server.sc new file mode 100644 index 00000000000..c9bafca07fa --- /dev/null +++ b/spk/matter-server/src/matter-server.sc @@ -0,0 +1,5 @@ +[matter_ws] +title="Matter WebService (TCP)" +desc="matter ws" +port_forward="yes" +dst.ports="5580/tcp" diff --git a/spk/matter-server/src/matter.png b/spk/matter-server/src/matter.png new file mode 100644 index 00000000000..f3aa15b57bd Binary files /dev/null and b/spk/matter-server/src/matter.png differ diff --git a/spk/matter-server/src/requirements-crossenv.txt b/spk/matter-server/src/requirements-crossenv.txt new file mode 100644 index 00000000000..27ee03a4b95 --- /dev/null +++ b/spk/matter-server/src/requirements-crossenv.txt @@ -0,0 +1,11 @@ +aiohttp==3.12.15 +cffi==1.17.1 +cryptography==45.0.7 +frozenlist==1.7.0 +#home_assistant_chip_core==2025.7.0 # no source available, prebuilt custom version added to package +multidict==6.6.4 +orjson==3.11.3 +propcache==0.3.2 +PyYAML==6.0.2 +yarl==1.20.1 +zeroconf==0.147.0 # requirement not found with generate requirements script diff --git a/spk/matter-server/src/requirements-pure.txt b/spk/matter-server/src/requirements-pure.txt new file mode 100644 index 00000000000..731052ab323 --- /dev/null +++ b/spk/matter-server/src/requirements-pure.txt @@ -0,0 +1,42 @@ +aenum==3.1.16 +aiohappyeyeballs==2.6.1 +aiorun==2025.1.1 +aiosignal==1.4.0 +asttokens==3.0.0 +async_timeout==5.0.1 +atomicwrites==1.4.1 # dependency not found with generate requirements script +attrs==25.3.0 +coloredlogs==15.0.1 +construct==2.10.70 +dacite==1.9.2 +decorator==5.2.1 +deprecation==2.1.0 +ecdsa==0.19.1 +executing==2.2.1 +home_assistant_chip_clusters==2025.7.0 +humanfriendly==10.0 +idna==3.10 +ifaddr==0.2.0 # dependency of zeroconf (not found with generate requirements script) +ipdb==0.13.13 +ipython==9.5.0 +ipython_pygments_lexers==1.1.1 +jedi==0.19.2 +markdown_it_py==4.0.0 +matplotlib_inline==0.1.7 +mdurl==0.1.2 +packaging==25.0 +parso==0.8.5 +pexpect==4.9.0 +#pip==25.0.1 # => python312 +prompt_toolkit==3.0.52 +ptyprocess==0.7.0 +pure_eval==0.2.3 +pycparser==2.22 +pygments==2.19.2 +python_matter_server==8.1.0 +rich==14.1.0 +six==1.17.0 +stack_data==0.6.3 +traitlets==5.14.3 +typing_extensions==4.15.0 +wcwidth==0.2.13 diff --git a/spk/matter-server/src/service-setup.sh b/spk/matter-server/src/service-setup.sh new file mode 100644 index 00000000000..e04b3b3c927 --- /dev/null +++ b/spk/matter-server/src/service-setup.sh @@ -0,0 +1,35 @@ +PYTHON_VER=python3.12 +PYTHON_DIR="/var/packages/python312/target/bin" +PATH="${SYNOPKG_PKGDEST}/env/bin:${SYNOPKG_PKGDEST}/bin:${PYTHON_DIR}:${PATH}" + +DATA_PATH=${SYNOPKG_PKGVAR}/data +# config data path provided by custom chip library only: +export CHIP_CONIFG_DATA_PATH=${DATA_PATH} +OTA_PROVIDER_DIR=${SYNOPKG_PKGVAR}/ota +SERVER=${SYNOPKG_PKGDEST}/env/bin/matter-server +SERVICE_COMMAND="${SERVER} --log-file ${LOG_FILE} --storage-path ${DATA_PATH} --ota-provider-dir ${OTA_PROVIDER_DIR}" +SVC_WRITE_PID=y +SVC_BACKGROUND=y + + +service_postinst () +{ + separator="====================================================" + + echo ${separator} + echo "Install Python virtual environment" + install_python_virtualenv + + echo ${separator} + echo "Install packages from wheelhouse" + pip install --disable-pip-version-check --no-deps --no-input --no-index ${SYNOPKG_PKGDEST}/share/wheelhouse/*.whl + + echo ${separator} + echo "Install python packages from index" + pip install --disable-pip-version-check --no-deps --no-input --requirement ${SYNOPKG_PKGDEST}/share/requirements-pure.txt + + echo ${separator} + echo "create special folders" + mkdir -p ${DATA_PATH} + mkdir -p ${OTA_PROVIDER_DIR} +}