openwrt-packages/utils/domoticz/Makefile

140 lines
4.5 KiB
Makefile
Raw Normal View History

#
# Copyright (C) 2016 - 2017 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_MAJOR:=4
PKG_VERSION_PATCH:=10717
PKG_COMMIT:=
PKG_VERSION:=$(PKG_VERSION_MAJOR).$(PKG_VERSION_PATCH)
PKG_RELEASE:=3
domoticz: update to 3.9571 and clean up FHS handling Upstream has merged a simplified version of the FHS patch, with a few changes... Scripts are actually configuration. There are examples, but the point is that you write your own. So they should live in the data directory (e.g. /var/lib/domoticz) not in /usr/share/domoticz. The only exception is the dzVents runtime. So.... the upstream patch handles the dzVents runtime bit. Drop the part of our patch which added -scripts, because it can just be based in the userdata directory and we don't need to change that. Ship the default scripts/ directory in /etc/domoticz/scripts, and on startup make a *symlink* to it from /var/lib/domoticz/scripts. Symlink from /etc/domoticz/scripts/dzVents{data,generated_scripts} to temporary directories under /var/lib/domoticz/dzVents so that those directories (which are written to by Domoticz) don't land on the root file system. Anyone with a writeable file system who *wants* the data/ directory to be persistent, can change that. Just as they can change the userdata config option to point to a real file system somewhere. Also drop the renaming of the OpenZWave Config/ directory. It's purely cosmetric so there's no need for us to carry that change. It can go upstream first, if it really offends anyone. Drop the patches which are now merged upstream, and turn off the newly added USE_OPENSSL_STATIC. Add -noupdates to the command line. Finally, gzip the static www files to save space. In the common case, clients will use "Accept-Encodiong: gzip" and Domoticz will serve them as-is. It can also decompress on the fly if it really has to, but now we aren't asking it to *compress* on the fly, which is probably a losing proposition on an OpenWRT box. Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2018-05-13 16:52:50 +02:00
ifeq ($(PKG_COMMIT),)
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
PKG_SOURCE_URL:=https://github.com/domoticz/domoticz/archive/$(PKG_VERSION)/$(PKG_SOURCE)
domoticz: update to 3.9571 and clean up FHS handling Upstream has merged a simplified version of the FHS patch, with a few changes... Scripts are actually configuration. There are examples, but the point is that you write your own. So they should live in the data directory (e.g. /var/lib/domoticz) not in /usr/share/domoticz. The only exception is the dzVents runtime. So.... the upstream patch handles the dzVents runtime bit. Drop the part of our patch which added -scripts, because it can just be based in the userdata directory and we don't need to change that. Ship the default scripts/ directory in /etc/domoticz/scripts, and on startup make a *symlink* to it from /var/lib/domoticz/scripts. Symlink from /etc/domoticz/scripts/dzVents{data,generated_scripts} to temporary directories under /var/lib/domoticz/dzVents so that those directories (which are written to by Domoticz) don't land on the root file system. Anyone with a writeable file system who *wants* the data/ directory to be persistent, can change that. Just as they can change the userdata config option to point to a real file system somewhere. Also drop the renaming of the OpenZWave Config/ directory. It's purely cosmetric so there's no need for us to carry that change. It can go upstream first, if it really offends anyone. Drop the patches which are now merged upstream, and turn off the newly added USE_OPENSSL_STATIC. Add -noupdates to the command line. Finally, gzip the static www files to save space. In the common case, clients will use "Accept-Encodiong: gzip" and Domoticz will serve them as-is. It can also decompress on the fly if it really has to, but now we aren't asking it to *compress* on the fly, which is probably a losing proposition on an OpenWRT box. Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2018-05-13 16:52:50 +02:00
else
PKG_SOURCE:=$(PKG_NAME)-$(PKG_COMMIT).tar.gz
PKG_SOURCE_URL:=https://github.com/domoticz/domoticz/archive/$(PKG_COMMIT)/$(PKG_SOURCE)
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)-$(PKG_COMMIT)
endif
PKG_HASH:=c053a2161942529f56b748945ec297dcd67f449e68029fc886893a528891ad86
PKG_LICENSE:=GPL-3.0
PKG_LICENSE_FILES:=License.txt
PKG_BUILD_DEPENDS:=python3
PKG_BUILD_PARALLEL:=1
PKG_USE_MIPS16:=0
CMAKE_INSTALL:=1
include $(INCLUDE_DIR)/package.mk
include $(INCLUDE_DIR)/cmake.mk
define Package/domoticz
SECTION:=utils
CATEGORY:=Utilities
TITLE:=Open Source Home Automation System
URL:=http://domoticz.com/
MAINTAINER:=Stijn Tintel <stijn@linux-ipv6.be>
USERID:=domoticz=6144:domoticz=6144
DEPENDS:= \
+boost \
+boost-date_time \
+boost-system \
+boost-thread \
+libcurl \
+libmosquittopp \
+libopenssl \
+libopenzwave \
+libsqlite3 \
+libstdcpp \
+telldus-core \
+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
CMAKE_OPTIONS += \
-DBUILD_SHARED_LIBS=yes \
-DBoost_NO_BOOST_CMAKE=yes \
-DCMAKE_BUILD_TYPE=Release \
-DUSE_BUILTIN_MQTT=no \
-DUSE_BUILTIN_SQLITE=no \
-DUSE_STATIC_BOOST=no \
-DUSE_STATIC_LIBSTDCXX=no \
-DUSE_STATIC_OPENZWAVE=no \
domoticz: update to 3.9571 and clean up FHS handling Upstream has merged a simplified version of the FHS patch, with a few changes... Scripts are actually configuration. There are examples, but the point is that you write your own. So they should live in the data directory (e.g. /var/lib/domoticz) not in /usr/share/domoticz. The only exception is the dzVents runtime. So.... the upstream patch handles the dzVents runtime bit. Drop the part of our patch which added -scripts, because it can just be based in the userdata directory and we don't need to change that. Ship the default scripts/ directory in /etc/domoticz/scripts, and on startup make a *symlink* to it from /var/lib/domoticz/scripts. Symlink from /etc/domoticz/scripts/dzVents{data,generated_scripts} to temporary directories under /var/lib/domoticz/dzVents so that those directories (which are written to by Domoticz) don't land on the root file system. Anyone with a writeable file system who *wants* the data/ directory to be persistent, can change that. Just as they can change the userdata config option to point to a real file system somewhere. Also drop the renaming of the OpenZWave Config/ directory. It's purely cosmetric so there's no need for us to carry that change. It can go upstream first, if it really offends anyone. Drop the patches which are now merged upstream, and turn off the newly added USE_OPENSSL_STATIC. Add -noupdates to the command line. Finally, gzip the static www files to save space. In the common case, clients will use "Accept-Encodiong: gzip" and Domoticz will serve them as-is. It can also decompress on the fly if it really has to, but now we aren't asking it to *compress* on the fly, which is probably a losing proposition on an OpenWRT box. Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2018-05-13 16:52:50 +02:00
-DUSE_OPENSSL_STATIC=no \
-DUSE_PYTHON=yes \
domoticz: update to 3.9571 and clean up FHS handling Upstream has merged a simplified version of the FHS patch, with a few changes... Scripts are actually configuration. There are examples, but the point is that you write your own. So they should live in the data directory (e.g. /var/lib/domoticz) not in /usr/share/domoticz. The only exception is the dzVents runtime. So.... the upstream patch handles the dzVents runtime bit. Drop the part of our patch which added -scripts, because it can just be based in the userdata directory and we don't need to change that. Ship the default scripts/ directory in /etc/domoticz/scripts, and on startup make a *symlink* to it from /var/lib/domoticz/scripts. Symlink from /etc/domoticz/scripts/dzVents{data,generated_scripts} to temporary directories under /var/lib/domoticz/dzVents so that those directories (which are written to by Domoticz) don't land on the root file system. Anyone with a writeable file system who *wants* the data/ directory to be persistent, can change that. Just as they can change the userdata config option to point to a real file system somewhere. Also drop the renaming of the OpenZWave Config/ directory. It's purely cosmetric so there's no need for us to carry that change. It can go upstream first, if it really offends anyone. Drop the patches which are now merged upstream, and turn off the newly added USE_OPENSSL_STATIC. Add -noupdates to the command line. Finally, gzip the static www files to save space. In the common case, clients will use "Accept-Encodiong: gzip" and Domoticz will serve them as-is. It can also decompress on the fly if it really has to, but now we aren't asking it to *compress* on the fly, which is probably a losing proposition on an OpenWRT box. Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2018-05-13 16:52:50 +02:00
-DWITH_LIBUSB=no
TARGET_CFLAGS+=-flto
TARGET_CXXFLAGS+=-DWITH_GPIO -flto
define Build/Prepare
$(call Build/Prepare/Default)
domoticz: update to 3.9571 and clean up FHS handling Upstream has merged a simplified version of the FHS patch, with a few changes... Scripts are actually configuration. There are examples, but the point is that you write your own. So they should live in the data directory (e.g. /var/lib/domoticz) not in /usr/share/domoticz. The only exception is the dzVents runtime. So.... the upstream patch handles the dzVents runtime bit. Drop the part of our patch which added -scripts, because it can just be based in the userdata directory and we don't need to change that. Ship the default scripts/ directory in /etc/domoticz/scripts, and on startup make a *symlink* to it from /var/lib/domoticz/scripts. Symlink from /etc/domoticz/scripts/dzVents{data,generated_scripts} to temporary directories under /var/lib/domoticz/dzVents so that those directories (which are written to by Domoticz) don't land on the root file system. Anyone with a writeable file system who *wants* the data/ directory to be persistent, can change that. Just as they can change the userdata config option to point to a real file system somewhere. Also drop the renaming of the OpenZWave Config/ directory. It's purely cosmetric so there's no need for us to carry that change. It can go upstream first, if it really offends anyone. Drop the patches which are now merged upstream, and turn off the newly added USE_OPENSSL_STATIC. Add -noupdates to the command line. Finally, gzip the static www files to save space. In the common case, clients will use "Accept-Encodiong: gzip" and Domoticz will serve them as-is. It can also decompress on the fly if it really has to, but now we aren't asking it to *compress* on the fly, which is probably a losing proposition on an OpenWRT box. Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2018-05-13 16:52:50 +02:00
# Fix APPVERSION/APPDATE since we don't build from a git tree
sed -i 's/#define APPVERSION.*/#define APPVERSION $(PKG_VERSION_PATCH)/' \
$(PKG_BUILD_DIR)/appversion.default
domoticz: update to 3.9571 and clean up FHS handling Upstream has merged a simplified version of the FHS patch, with a few changes... Scripts are actually configuration. There are examples, but the point is that you write your own. So they should live in the data directory (e.g. /var/lib/domoticz) not in /usr/share/domoticz. The only exception is the dzVents runtime. So.... the upstream patch handles the dzVents runtime bit. Drop the part of our patch which added -scripts, because it can just be based in the userdata directory and we don't need to change that. Ship the default scripts/ directory in /etc/domoticz/scripts, and on startup make a *symlink* to it from /var/lib/domoticz/scripts. Symlink from /etc/domoticz/scripts/dzVents{data,generated_scripts} to temporary directories under /var/lib/domoticz/dzVents so that those directories (which are written to by Domoticz) don't land on the root file system. Anyone with a writeable file system who *wants* the data/ directory to be persistent, can change that. Just as they can change the userdata config option to point to a real file system somewhere. Also drop the renaming of the OpenZWave Config/ directory. It's purely cosmetric so there's no need for us to carry that change. It can go upstream first, if it really offends anyone. Drop the patches which are now merged upstream, and turn off the newly added USE_OPENSSL_STATIC. Add -noupdates to the command line. Finally, gzip the static www files to save space. In the common case, clients will use "Accept-Encodiong: gzip" and Domoticz will serve them as-is. It can also decompress on the fly if it really has to, but now we aren't asking it to *compress* on the fly, which is probably a losing proposition on an OpenWRT box. Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2018-05-13 16:52:50 +02:00
COMMITDATE=`tar tvfz $(DL_DIR)/$(PKG_SOURCE) --full-time | sed 's/.* \(20..-..-.. ..:..:..\) domoticz-.*/\1/;q'`; \
COMMITTS=`date --date="$$$${COMMITDATE}" +%s`; \
sed -i "s/#define APPDATE.*/#define APPDATE $$$${COMMITTS}/" $(PKG_BUILD_DIR)/appversion.default
ifneq ($(PKG_COMMIT),)
sed -i "s/#define APPHASH.*/#define APPHASH \"$(shell echo $(PKG_COMMIT) | cut -c1-8)\"/" $(PKG_BUILD_DIR)/appversion.default
endif
# Remove unwanted scripts
cd $(PKG_BUILD_DIR)/scripts && rm -rf \
buienradar_rain_example.pl \
_domoticz_main* \
download_update.sh \
domoticz: update to 3.9571 and clean up FHS handling Upstream has merged a simplified version of the FHS patch, with a few changes... Scripts are actually configuration. There are examples, but the point is that you write your own. So they should live in the data directory (e.g. /var/lib/domoticz) not in /usr/share/domoticz. The only exception is the dzVents runtime. So.... the upstream patch handles the dzVents runtime bit. Drop the part of our patch which added -scripts, because it can just be based in the userdata directory and we don't need to change that. Ship the default scripts/ directory in /etc/domoticz/scripts, and on startup make a *symlink* to it from /var/lib/domoticz/scripts. Symlink from /etc/domoticz/scripts/dzVents{data,generated_scripts} to temporary directories under /var/lib/domoticz/dzVents so that those directories (which are written to by Domoticz) don't land on the root file system. Anyone with a writeable file system who *wants* the data/ directory to be persistent, can change that. Just as they can change the userdata config option to point to a real file system somewhere. Also drop the renaming of the OpenZWave Config/ directory. It's purely cosmetric so there's no need for us to carry that change. It can go upstream first, if it really offends anyone. Drop the patches which are now merged upstream, and turn off the newly added USE_OPENSSL_STATIC. Add -noupdates to the command line. Finally, gzip the static www files to save space. In the common case, clients will use "Accept-Encodiong: gzip" and Domoticz will serve them as-is. It can also decompress on the fly if it really has to, but now we aren't asking it to *compress* on the fly, which is probably a losing proposition on an OpenWRT box. Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2018-05-13 16:52:50 +02:00
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 \
domoticz: update to 3.9571 and clean up FHS handling Upstream has merged a simplified version of the FHS patch, with a few changes... Scripts are actually configuration. There are examples, but the point is that you write your own. So they should live in the data directory (e.g. /var/lib/domoticz) not in /usr/share/domoticz. The only exception is the dzVents runtime. So.... the upstream patch handles the dzVents runtime bit. Drop the part of our patch which added -scripts, because it can just be based in the userdata directory and we don't need to change that. Ship the default scripts/ directory in /etc/domoticz/scripts, and on startup make a *symlink* to it from /var/lib/domoticz/scripts. Symlink from /etc/domoticz/scripts/dzVents{data,generated_scripts} to temporary directories under /var/lib/domoticz/dzVents so that those directories (which are written to by Domoticz) don't land on the root file system. Anyone with a writeable file system who *wants* the data/ directory to be persistent, can change that. Just as they can change the userdata config option to point to a real file system somewhere. Also drop the renaming of the OpenZWave Config/ directory. It's purely cosmetric so there's no need for us to carry that change. It can go upstream first, if it really offends anyone. Drop the patches which are now merged upstream, and turn off the newly added USE_OPENSSL_STATIC. Add -noupdates to the command line. Finally, gzip the static www files to save space. In the common case, clients will use "Accept-Encodiong: gzip" and Domoticz will serve them as-is. It can also decompress on the fly if it really has to, but now we aren't asking it to *compress* on the fly, which is probably a losing proposition on an OpenWRT box. Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2018-05-13 16:52:50 +02:00
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
domoticz: update to 3.9571 and clean up FHS handling Upstream has merged a simplified version of the FHS patch, with a few changes... Scripts are actually configuration. There are examples, but the point is that you write your own. So they should live in the data directory (e.g. /var/lib/domoticz) not in /usr/share/domoticz. The only exception is the dzVents runtime. So.... the upstream patch handles the dzVents runtime bit. Drop the part of our patch which added -scripts, because it can just be based in the userdata directory and we don't need to change that. Ship the default scripts/ directory in /etc/domoticz/scripts, and on startup make a *symlink* to it from /var/lib/domoticz/scripts. Symlink from /etc/domoticz/scripts/dzVents{data,generated_scripts} to temporary directories under /var/lib/domoticz/dzVents so that those directories (which are written to by Domoticz) don't land on the root file system. Anyone with a writeable file system who *wants* the data/ directory to be persistent, can change that. Just as they can change the userdata config option to point to a real file system somewhere. Also drop the renaming of the OpenZWave Config/ directory. It's purely cosmetric so there's no need for us to carry that change. It can go upstream first, if it really offends anyone. Drop the patches which are now merged upstream, and turn off the newly added USE_OPENSSL_STATIC. Add -noupdates to the command line. Finally, gzip the static www files to save space. In the common case, clients will use "Accept-Encodiong: gzip" and Domoticz will serve them as-is. It can also decompress on the fly if it really has to, but now we aren't asking it to *compress* on the fly, which is probably a losing proposition on an OpenWRT box. Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2018-05-13 16:52:50 +02:00
$(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
domoticz: update to 3.9571 and clean up FHS handling Upstream has merged a simplified version of the FHS patch, with a few changes... Scripts are actually configuration. There are examples, but the point is that you write your own. So they should live in the data directory (e.g. /var/lib/domoticz) not in /usr/share/domoticz. The only exception is the dzVents runtime. So.... the upstream patch handles the dzVents runtime bit. Drop the part of our patch which added -scripts, because it can just be based in the userdata directory and we don't need to change that. Ship the default scripts/ directory in /etc/domoticz/scripts, and on startup make a *symlink* to it from /var/lib/domoticz/scripts. Symlink from /etc/domoticz/scripts/dzVents{data,generated_scripts} to temporary directories under /var/lib/domoticz/dzVents so that those directories (which are written to by Domoticz) don't land on the root file system. Anyone with a writeable file system who *wants* the data/ directory to be persistent, can change that. Just as they can change the userdata config option to point to a real file system somewhere. Also drop the renaming of the OpenZWave Config/ directory. It's purely cosmetric so there's no need for us to carry that change. It can go upstream first, if it really offends anyone. Drop the patches which are now merged upstream, and turn off the newly added USE_OPENSSL_STATIC. Add -noupdates to the command line. Finally, gzip the static www files to save space. In the common case, clients will use "Accept-Encodiong: gzip" and Domoticz will serve them as-is. It can also decompress on the fly if it really has to, but now we aren't asking it to *compress* on the fly, which is probably a losing proposition on an OpenWRT box. Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2018-05-13 16:52:50 +02:00
# 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/
domoticz: update to 3.9571 and clean up FHS handling Upstream has merged a simplified version of the FHS patch, with a few changes... Scripts are actually configuration. There are examples, but the point is that you write your own. So they should live in the data directory (e.g. /var/lib/domoticz) not in /usr/share/domoticz. The only exception is the dzVents runtime. So.... the upstream patch handles the dzVents runtime bit. Drop the part of our patch which added -scripts, because it can just be based in the userdata directory and we don't need to change that. Ship the default scripts/ directory in /etc/domoticz/scripts, and on startup make a *symlink* to it from /var/lib/domoticz/scripts. Symlink from /etc/domoticz/scripts/dzVents{data,generated_scripts} to temporary directories under /var/lib/domoticz/dzVents so that those directories (which are written to by Domoticz) don't land on the root file system. Anyone with a writeable file system who *wants* the data/ directory to be persistent, can change that. Just as they can change the userdata config option to point to a real file system somewhere. Also drop the renaming of the OpenZWave Config/ directory. It's purely cosmetric so there's no need for us to carry that change. It can go upstream first, if it really offends anyone. Drop the patches which are now merged upstream, and turn off the newly added USE_OPENSSL_STATIC. Add -noupdates to the command line. Finally, gzip the static www files to save space. In the common case, clients will use "Accept-Encodiong: gzip" and Domoticz will serve them as-is. It can also decompress on the fly if it really has to, but now we aren't asking it to *compress* on the fly, which is probably a losing proposition on an OpenWRT box. Signed-off-by: David Woodhouse <dwmw2@infradead.org>
2018-05-13 16:52:50 +02:00
/etc/domoticz/
endef
$(eval $(call BuildPackage,domoticz))