7b40ba07543dfeb525f3bdf53f962975a6271f70
[feed/packages.git] / utils / domoticz / Makefile
1 #
2 # Copyright (C) 2016 - 2017 Stijn Tintel <stijn@linux-ipv6.be>
3 #
4 # This is free software, licensed under the GNU General Public License v2.
5 # See /LICENSE for more information.
6 #
7
8 include $(TOPDIR)/rules.mk
9
10 PKG_NAME:=domoticz
11 PKG_VERSION_MAJOR:=4
12 PKG_VERSION_PATCH:=10717
13 PKG_COMMIT:=
14 PKG_VERSION:=$(PKG_VERSION_MAJOR).$(PKG_VERSION_PATCH)
15 PKG_RELEASE:=3
16
17 ifeq ($(PKG_COMMIT),)
18 PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
19 PKG_SOURCE_URL:=https://github.com/domoticz/domoticz/archive/$(PKG_VERSION)/$(PKG_SOURCE)
20 else
21 PKG_SOURCE:=$(PKG_NAME)-$(PKG_COMMIT).tar.gz
22 PKG_SOURCE_URL:=https://github.com/domoticz/domoticz/archive/$(PKG_COMMIT)/$(PKG_SOURCE)
23 PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_COMMIT)
24 endif
25 PKG_HASH:=c053a2161942529f56b748945ec297dcd67f449e68029fc886893a528891ad86
26
27 PKG_LICENSE:=GPL-3.0
28 PKG_LICENSE_FILES:=License.txt
29
30 PKG_BUILD_DEPENDS:=python3
31 PKG_BUILD_PARALLEL:=1
32 PKG_USE_MIPS16:=0
33
34 CMAKE_INSTALL:=1
35
36 include $(INCLUDE_DIR)/package.mk
37 include $(INCLUDE_DIR)/cmake.mk
38
39 define Package/domoticz
40 SECTION:=utils
41 CATEGORY:=Utilities
42 TITLE:=Open Source Home Automation System
43 URL:=http://domoticz.com/
44 MAINTAINER:=Stijn Tintel <stijn@linux-ipv6.be>
45 USERID:=domoticz=6144:domoticz=6144
46 DEPENDS:= \
47 +boost \
48 +boost-date_time \
49 +boost-system \
50 +boost-thread \
51 +libcurl \
52 +libmosquittopp \
53 +libopenssl \
54 +libopenzwave \
55 +libsqlite3 \
56 +libstdcpp \
57 +telldus-core \
58 +zlib
59 endef
60
61 define Package/domoticz/description
62 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.
63 endef
64
65 CMAKE_OPTIONS += \
66 -DBUILD_SHARED_LIBS=yes \
67 -DBoost_NO_BOOST_CMAKE=yes \
68 -DCMAKE_BUILD_TYPE=Release \
69 -DUSE_BUILTIN_MQTT=no \
70 -DUSE_BUILTIN_SQLITE=no \
71 -DUSE_STATIC_BOOST=no \
72 -DUSE_STATIC_LIBSTDCXX=no \
73 -DUSE_STATIC_OPENZWAVE=no \
74 -DUSE_OPENSSL_STATIC=no \
75 -DUSE_PYTHON=yes \
76 -DWITH_LIBUSB=no
77
78 TARGET_CFLAGS+=-flto
79 TARGET_CXXFLAGS+=-DWITH_GPIO -flto
80
81 define Build/Prepare
82 $(call Build/Prepare/Default)
83 # Fix APPVERSION/APPDATE since we don't build from a git tree
84 sed -i 's/#define APPVERSION.*/#define APPVERSION $(PKG_VERSION_PATCH)/' \
85 $(PKG_BUILD_DIR)/appversion.default
86 COMMITDATE=`tar tvfz $(DL_DIR)/$(PKG_SOURCE) --full-time | sed 's/.* \(20..-..-.. ..:..:..\) domoticz-.*/\1/;q'`; \
87 COMMITTS=`date --date="$$$${COMMITDATE}" +%s`; \
88 sed -i "s/#define APPDATE.*/#define APPDATE $$$${COMMITTS}/" $(PKG_BUILD_DIR)/appversion.default
89 ifneq ($(PKG_COMMIT),)
90 sed -i "s/#define APPHASH.*/#define APPHASH \"$(shell echo $(PKG_COMMIT) | cut -c1-8)\"/" $(PKG_BUILD_DIR)/appversion.default
91 endif
92 # Remove unwanted scripts
93 cd $(PKG_BUILD_DIR)/scripts && rm -rf \
94 buienradar_rain_example.pl \
95 _domoticz_main* \
96 download_update.sh \
97 dzVents/{.gitignore,documentation,examples,generated_scripts,data} \
98 dzVents/runtime/{integration-tests,misc/smoothing.xlsx,tests} \
99 logrotate/ \
100 lua_parsers/example* \
101 lua/*demo.lua \
102 python/ \
103 readme.txt \
104 restart_domoticz \
105 templates/All.Python \
106 update_domoticz \
107 domoticz.conf
108 # Remove *.md
109 cd $(PKG_BUILD_DIR) && $(FIND) -name '*.md' -delete
110 endef
111
112 define Package/domoticz/install
113 $(INSTALL_DIR) $(1)/etc/config $(1)/etc/hotplug.d/tty $(1)/etc/init.d $(1)/etc/domoticz/plugins
114 $(INSTALL_BIN) ./files/domoticz.hotplug $(1)/etc/hotplug.d/tty/domoticz
115 $(INSTALL_BIN) ./files/domoticz.init $(1)/etc/init.d/domoticz
116 $(INSTALL_CONF) ./files/domoticz.config $(1)/etc/config/domoticz
117 $(INSTALL_DIR) $(1)/usr/share/domoticz $(1)/usr/bin
118 $(CP) $(PKG_INSTALL_DIR)/usr/dzVents $(1)/usr/share/domoticz/dzVents
119 $(CP) $(PKG_INSTALL_DIR)/usr/Config $(1)/usr/share/domoticz/Config
120 $(CP) $(PKG_INSTALL_DIR)/usr/scripts $(1)/etc/domoticz/scripts
121 ln -sf /var/lib/domoticz/dzVents/generated_scripts $(1)/etc/domoticz/scripts/dzVents
122 ln -sf /var/lib/domoticz/dzVents/data $(1)/etc/domoticz/scripts/dzVents
123 $(CP) $(PKG_INSTALL_DIR)/usr/www $(1)/usr/share/domoticz/
124 $(INSTALL_BIN) $(PKG_INSTALL_DIR)/usr/domoticz $(1)/usr/bin/domoticz
125 # compress static web content
126 find $(1)/usr/share/domoticz/www -name "*.css" -exec gzip -9 {} \;
127 find $(1)/usr/share/domoticz/www -name "*.js" -exec gzip -9 {} \;
128 gzip -9 $(1)/usr/share/domoticz/www/*.html
129 gzip -9 $(1)/usr/share/domoticz/www/secpanel/*.html
130 find $(1)/usr/share/domoticz/www/views -name "*.html" -exec sh -c 'grep -q "<\!--#embed" {} || gzip -9 {}' \;
131 endef
132
133 define Package/domoticz/conffiles
134 /etc/config/domoticz
135 /var/lib/domoticz/
136 /etc/domoticz/
137 endef
138
139 $(eval $(call BuildPackage,domoticz))