summaryrefslogtreecommitdiffstats
path: root/utils/domoticz/Makefile
blob: b42476b439146aceae3bb03ffb03bbe0054a5e90 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
#
# Copyright (C) 2016 - 2020  Stijn Tintel <stijn@linux-ipv6.be>
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#

include $(TOPDIR)/rules.mk

PKG_NAME:=domoticz
PKG_VERSION:=2026.4
PKG_RELEASE:=1

# The codeload tarball lacks the extern/ submodules (libwebem); use the
# source asset from the release, which bundles them.
PKG_SOURCE:=domoticz_src_2026.18387.tar.gz
PKG_SOURCE_URL:=https://github.com/domoticz/domoticz/releases/download/$(PKG_VERSION)
PKG_HASH:=88964b791050abf6b6df3ec9e1d262d18e198a6fa108638974eca8600d1a4568

PKG_MAINTAINER:=David Woodhouse <dwmw2@infradead.org>
PKG_LICENSE:=GPL-3.0
PKG_LICENSE_FILES:=License.txt
PKG_CPE_ID:=cpe:/a:domoticz:domoticz

PKG_BUILD_DEPENDS:=python3 minizip cereal boost jwt-cpp
PKG_BUILD_FLAGS:=no-mips16

include $(INCLUDE_DIR)/package.mk
include $(INCLUDE_DIR)/cmake.mk

# The tarball extracts to a bare domoticz/ directory; strip that so the
# build happens in the usual versioned directory.
TAR_OPTIONS:=--strip-components 1 $(TAR_OPTIONS)
TAR_CMD=$(HOST_TAR) -C $(1) $(TAR_OPTIONS)

define Package/domoticz
  SECTION:=utils
  CATEGORY:=Utilities
  TITLE:=Open Source Home Automation System
  URL:=https://domoticz.com/
  USERID:=domoticz=6144:domoticz=6144
  DEPENDS:= \
	+libatomic \
	+boost \
	+boost-date_time \
	+boost-thread \
	+jsoncpp \
	+libcurl \
	+python3 \
	+minizip \
	+lua5.3 \
	+libfmt \
	+libmosquitto \
	+libopenssl \
	+libopenzwave \
	+libsqlite3 \
	+libstdcpp \
	+zlib
endef

define Package/domoticz/description
  Domoticz is a Home Automation System that lets you monitor and configure various devices like: Lights, Switches, various sensors/meters like Temperature, Rain, Wind, UV, Electra, Gas, Water and much more. Notifications/Alerts can be sent to any mobile device.
endef

TARGET_LDFLAGS += -latomic

CMAKE_OPTIONS += \
	-DBoost_NO_BOOST_CMAKE=yes \
	-DCMAKE_FIND_ROOT_PATH_MODE_PACKAGE=ONLY \
	-DGIT_SUBMODULE=no \
	-DCMAKE_BUILD_TYPE=Release \
	-DUSE_BUILTIN_MQTT=no \
	-DUSE_BUILTIN_SQLITE=no \
	-DUSE_BUILTIN_JSONCPP=no \
	-DUSE_BUILTIN_MINIZIP=no \
	-DUSE_BUILTIN_LIBFMT=no \
	-DUSE_BUILTIN_JWTCPP=no \
	-DUSE_LUA_STATIC=no \
	-DUSE_STATIC_BOOST=no \
	-DUSE_STATIC_LIBSTDCXX=no \
	-DUSE_STATIC_OPENZWAVE=no \
	-DUSE_OPENSSL_STATIC=no \
	-DUSE_PYTHON=yes \
	-DWITH_LIBUSB=no \
	-DWITH_TELLDUSCORE=no

TARGET_CXXFLAGS += -DWITH_GPIO

define Build/Prepare
	$(call Build/Prepare/Default)
	# Remove unwanted scripts
	cd $(PKG_BUILD_DIR)/scripts && rm -rf \
		buienradar_rain_example.pl \
		_domoticz_main* \
		download_update.sh \
		dzVents/{.gitignore,documentation,examples,generated_scripts,data} \
		dzVents/runtime/{integration-tests,misc/smoothing.xlsx,tests} \
		logrotate/ \
		lua_parsers/example* \
		lua/*demo.lua \
		python/ \
		readme.txt \
		restart_domoticz \
		templates/All.Python \
		update_domoticz \
		domoticz.conf
	# Remove *.md
	cd $(PKG_BUILD_DIR) && $(FIND) -name '*.md' -delete
endef

define Package/domoticz/install
	$(INSTALL_DIR) $(1)/etc/config $(1)/etc/hotplug.d/tty $(1)/etc/init.d $(1)/etc/domoticz/plugins
	$(INSTALL_BIN) ./files/domoticz.hotplug $(1)/etc/hotplug.d/tty/domoticz
	$(INSTALL_BIN) ./files/domoticz.init $(1)/etc/init.d/domoticz
	$(INSTALL_CONF) ./files/domoticz.config $(1)/etc/config/domoticz
	$(INSTALL_DIR) $(1)/usr/share/domoticz $(1)/usr/bin
	$(CP) $(PKG_INSTALL_DIR)/usr/dzVents $(1)/usr/share/domoticz/dzVents
	$(CP) $(PKG_INSTALL_DIR)/usr/Config $(1)/usr/share/domoticz/Config
	$(CP) $(PKG_INSTALL_DIR)/usr/scripts $(1)/etc/domoticz/scripts
	ln -sf /var/lib/domoticz/dzVents/generated_scripts $(1)/etc/domoticz/scripts/dzVents
	ln -sf /var/lib/domoticz/dzVents/data $(1)/etc/domoticz/scripts/dzVents
	$(CP) $(PKG_INSTALL_DIR)/usr/www $(1)/usr/share/domoticz/
	$(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/domoticz $(1)/usr/bin/domoticz
	# compress static web content
	find $(1)/usr/share/domoticz/www -name "*.css" -exec gzip -9 {} \;
	find $(1)/usr/share/domoticz/www -name "*.js" -exec gzip -9 {} \;
	gzip -9 $(1)/usr/share/domoticz/www/*.html
	gzip -9 $(1)/usr/share/domoticz/www/secpanel/*.html
	find $(1)/usr/share/domoticz/www/views -name "*.html" -exec sh -c 'grep -q "<\!--#embed" {} || gzip -9 {}' \;
endef

define Package/domoticz/conffiles
/etc/config/domoticz
/var/lib/domoticz/
/etc/domoticz/
endef

$(eval $(call BuildPackage,domoticz))