1a11e5e
#global git_short_hash df9de70
1a11e5e
#global git_hash df9de7020c4317a484c39f7330e6d1c9ca3d9ec9
6582fdf
3aa01fd
Name:		domoticz
8f1bf90
Version:	2020.2
b202fc7
Release:	5%{?dist}
3aa01fd
Summary:	Open source Home Automation System
3aa01fd
3aa01fd
License:	GPLv3+ and ASL 2.0 and Boost and BSD and MIT
3aa01fd
URL:		http://www.domoticz.com
1a11e5e
Source0:	https://github.com/domoticz/domoticz/archive/%{version}.tar.gz#/%{name}-%{version}.tar.gz
1a11e5e
#Source0:	https://github.com/domoticz/domoticz/archive/%%{git_short_hash}.tar.gz#/%%{name}-%%{version}.tar.gz
3aa01fd
Source1:	%{name}.service
3aa01fd
Source2:	%{name}.conf
1a11e5e
# Manually update version reported inside app
af0f3ae
Source3:	%{name}-appversion
3aa01fd
70a7e43
# Use system tinyxpath (https://github.com/domoticz/domoticz/pull/1759)
1a11e5e
Patch1:		%{name}-tinyxpath.patch
415d1f4
# Use system openzwave includes
1a11e5e
Patch2:		%{name}-openzwave.patch
70a7e43
# Fix python detection (https://github.com/domoticz/domoticz/pull/1749)
1a11e5e
Patch3:		%{name}-python.patch
3d0a1de
# Python 3.8 linking fix
1a11e5e
Patch4:		%{name}-python38.patch
0cb4a4b
# _Py_DEC_REFTOTAL macro has been removed from Python 3.9 by:
0cb4a4b
# https://github.com/python/cpython/commit/49932fec62c616ec88da52642339d83ae719e924
0cb4a4b
Patch5:		%{name}-python39.patch
f3a8b05
# Boost 1.73 support
f3a8b05
Patch6:		%{name}-boost.patch
3aa01fd
3aa01fd
BuildRequires:	boost-devel
741f5e0
BuildRequires:	cereal-devel
3aa01fd
BuildRequires:	cmake
3aa01fd
BuildRequires:	curl-devel
70a7e43
BuildRequires:	fontpackages-devel
3aa01fd
BuildRequires:	gcc-c++
3aa01fd
BuildRequires:	git
8f1bf90
BuildRequires:	jsoncpp-devel
af0f3ae
BuildRequires:	libopenzwave-devel >= 1.6.0
3aa01fd
BuildRequires:	libusb-devel
3aa01fd
BuildRequires:	lua-devel
df115eb
BuildRequires:	make
741f5e0
BuildRequires:	minizip-compat-devel
3aa01fd
BuildRequires:	mosquitto-devel
3aa01fd
BuildRequires:	openssl-devel
415d1f4
BuildRequires:	python3-devel
3aa01fd
BuildRequires:	sqlite-devel
3aa01fd
BuildRequires:	systemd-devel
415d1f4
BuildRequires:	tinyxpath-devel
3aa01fd
BuildRequires:	zlib-devel
3aa01fd
3aa01fd
Requires(pre):	shadow-utils
3aa01fd
Requires(post):	systemd
3aa01fd
Requires(postun):	systemd
3aa01fd
Requires(preun):	systemd
3aa01fd
3aa01fd
Requires:	google-droid-sans-fonts
70a7e43
Recommends:	system-python-libs >= 3.4
3aa01fd
3aa01fd
Provides:	bundled(js-ace)
3aa01fd
Provides:	bundled(js-angularamd) = 0.2.1
3aa01fd
Provides:	bundled(js-angularjs) = 1.5.8
3aa01fd
Provides:	bundled(js-blockly)
3aa01fd
Provides:	bundled(js-bootbox)
3aa01fd
Provides:	bundled(js-bootstrap) = 3.2.0
3aa01fd
Provides:	bundled(js-colpick)
3aa01fd
Provides:	bundled(js-d3)
3aa01fd
Provides:	bundled(js-datatables-datatools) = 2.2.3
3aa01fd
Provides:	bundled(js-dateformat) = 1.2.3
3aa01fd
Provides:	bundled(js-filesaver) = 0.0-git20140725
3aa01fd
Provides:	bundled(js-highcharts) = 4.2.6
3aa01fd
Provides:	bundled(js-html5shiv) = 3.6.2
3aa01fd
Provides:	bundled(js-i18next) = 1.8.0
3aa01fd
Provides:	bundled(js-jquery) = 1.12.0
3aa01fd
Provides:	bundled(js-ngdraggable)
3aa01fd
Provides:	bundled(js-nggrid)
3aa01fd
Provides:	bundled(js-jquery-noty) = 2.1.0
3aa01fd
Provides:	bundled(js-require) = 2.1.14
3aa01fd
Provides:	bundled(js-respond) = 1.1.0
3aa01fd
Provides:	bundled(js-angular-ui-bootstrap) = 0.13.4
3aa01fd
Provides:	bundled(js-wow) = 0.1.9
3aa01fd
Provides:	bundled(js-ozwcp)
3aa01fd
Provides:	bundled(js-less) = 1.3.0
3aa01fd
Provides:	bundled(js-ion-sound) = 3.0.6
3aa01fd
Provides:	bundled(js-zeroclipboard) = 1.0.4
3aa01fd
de75b76
%global _python_bytecompile_extra 0
de75b76
3aa01fd
3aa01fd
%description
3aa01fd
Domoticz is a Home Automation System that lets you monitor and configure various
3aa01fd
devices like: Lights, Switches, various sensors/meters like Temperature, Rain,
3aa01fd
Wind, UV, Electra, Gas, Water and much more. Notifications/Alerts can be sent to
3aa01fd
any mobile device
3aa01fd
3aa01fd
3aa01fd
%prep
1a11e5e
%setup -q -n %{name}-%{version}
1a11e5e
#setup -q -n %{name}-%{git_hash}
1a11e5e
%patch1 -p1 -b.tinyxpath
1a11e5e
%patch2 -p1 -b.openzwave
1a11e5e
%patch3 -p1 -b.python
3d0a1de
%if 0%{?fedora} >= 32
1a11e5e
%patch4 -p1 -b.python38
3d0a1de
%endif
0cb4a4b
%if 0%{?fedora} >= 33
0cb4a4b
%patch5 -p1 -b.python39
e5b8ca7
# Add support for future versions of Python by replacing hardcoded version with macro
e5b8ca7
sed -i 's/-lpython3.9/-lpython%{python3_version}/' CMakeLists.txt
f3a8b05
%patch6 -p1 -b.boost173
0cb4a4b
%endif
415d1f4
rm -f hardware/openzwave/*.h
415d1f4
rm -rf hardware/openzwave/aes
415d1f4
rm -rf hardware/openzwave/command_classes
415d1f4
rm -rf hardware/openzwave/platform
415d1f4
rm -rf hardware/openzwave/value_classes
70a7e43
rm -rf sqlite/
415d1f4
rm -rf tinyxpath/
af0f3ae
cp -p %{SOURCE3} ./appversion.h
3aa01fd
3aa01fd
3aa01fd
%build
3aa01fd
%cmake \
af0f3ae
 -DCMAKE_BUILD_TYPE=RelWithDebInfo \
3aa01fd
 -DUSE_STATIC_LIBSTDCXX=NO \
3aa01fd
 -DUSE_STATIC_OPENZWAVE=NO \
24bdab9
 -DUSE_OPENSSL_STATIC=NO \
8f1bf90
 -DUSE_BUILTIN_JSONCPP=NO \
3aa01fd
 -DUSE_BUILTIN_LUA=NO \
8f1bf90
 -DUSE_BUILTIN_MINIZIP=NO \
3aa01fd
 -DUSE_BUILTIN_MQTT=NO \
3aa01fd
 -DUSE_BUILTIN_SQLITE=NO \
70a7e43
 -DUSE_BUILTIN_TINYXPATH=NO \
3aa01fd
 -DUSE_STATIC_BOOST=NO \
dfa1fbd
 -DCMAKE_INSTALL_PREFIX=%{_datadir}/%{name} \
40fa211
 %{nil}
40fa211
%cmake_build
3aa01fd
3aa01fd
3aa01fd
%install
40fa211
%cmake_install
3aa01fd
9d9f230
# remove bundled OpenZWave configuration files so system files are used
9d9f230
rm -rf $RPM_BUILD_ROOT%{_datadir}/%{name}/Config/
9d9f230
3aa01fd
# remove docs, we grab them in files below
3aa01fd
rm -f $RPM_BUILD_ROOT%{_datadir}/%{name}/*.txt
3aa01fd
3aa01fd
# move binary to standard directory
3aa01fd
mkdir -p $RPM_BUILD_ROOT%{_bindir}/
3aa01fd
mv $RPM_BUILD_ROOT%{_datadir}/%{name}/%{name} $RPM_BUILD_ROOT%{_bindir}/
3aa01fd
3aa01fd
# install systemd service and config
3aa01fd
mkdir -p $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/
3aa01fd
mkdir -p $RPM_BUILD_ROOT%{_unitdir}/
3aa01fd
cp -p %{SOURCE1} $RPM_BUILD_ROOT%{_unitdir}/
3aa01fd
cp -p %{SOURCE2} $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/%{name}
3aa01fd
5f7b071
# create backups/database/plugins/scripts/ssl cert directory
5f7b071
mkdir -p $RPM_BUILD_ROOT%{_sharedstatedir}/%{name}/{backups,plugins,scripts}
5f7b071
mkdir -p $RPM_BUILD_ROOT%{_sharedstatedir}/%{name}/scripts/{dzVents,lua,lua_parsers,python,templates}
5f7b071
mkdir -p $RPM_BUILD_ROOT%{_sharedstatedir}/%{name}/scripts/dzVents/{data,generated_scripts,scripts}
3aa01fd
3aa01fd
# Disable the app's self-update script
3aa01fd
chmod 644 $RPM_BUILD_ROOT%{_datadir}/%{name}/updatedomo
3aa01fd
3aa01fd
# Unbundle DroidSans.ttf
3aa01fd
rm -f $RPM_BUILD_ROOT%{_datadir}/%{name}/www/styles/elemental/fonts/DroidSans.ttf
3aa01fd
ln -s %{_fontdir}/google-droid/DroidSans.ttf \
3aa01fd
      $RPM_BUILD_ROOT%{_datadir}/%{name}/www/styles/elemental/fonts/
3aa01fd
rm -f $RPM_BUILD_ROOT%{_datadir}/%{name}/www/styles/element-light/fonts/DroidSans.ttf
3aa01fd
ln -s %{_fontdir}/google-droid/DroidSans.ttf \
3aa01fd
      $RPM_BUILD_ROOT%{_datadir}/%{name}/www/styles/element-light/fonts/
3aa01fd
rm -f $RPM_BUILD_ROOT%{_datadir}/%{name}/www/styles/element-dark/fonts/DroidSans.ttf
3aa01fd
ln -s %{_fontdir}/google-droid/DroidSans.ttf \
3aa01fd
      $RPM_BUILD_ROOT%{_datadir}/%{name}/www/styles/element-dark/fonts/
3aa01fd
9d9f230
# Workaround lookup path for dzVents
9d9f230
ln -s %{_datadir}/%{name}/scripts/lua/JSON.lua \
9d9f230
      $RPM_BUILD_ROOT%{_datadir}/%{name}/dzVents/runtime/JSON.lua
5f7b071
9d9f230
# Link default plugins and scripts to userdata directory
5f7b071
ln -s %{_datadir}/%{name}/scripts/dzVents/data/README.md \
5f7b071
      $RPM_BUILD_ROOT%{_sharedstatedir}/%{name}/scripts/dzVents/data/README.md
5f7b071
ln -s %{_datadir}/%{name}/scripts/dzVents/generated_scripts/README.md \
5f7b071
      $RPM_BUILD_ROOT%{_sharedstatedir}/%{name}/scripts/dzVents/generated_scripts/README.md
5f7b071
ln -s %{_datadir}/%{name}/scripts/dzVents/scripts/README.md \
5f7b071
      $RPM_BUILD_ROOT%{_sharedstatedir}/%{name}/scripts/dzVents/scripts/README.md
5f7b071
ln -s %{_datadir}/%{name}/scripts/templates/All.{dzVents,Lua,Python} \
5f7b071
      $RPM_BUILD_ROOT%{_sharedstatedir}/%{name}/scripts/templates/
5f7b071
ln -s %{_datadir}/%{name}/scripts/templates/Bare.dzVents \
5f7b071
      $RPM_BUILD_ROOT%{_sharedstatedir}/%{name}/scripts/templates/
5f7b071
ln -s %{_datadir}/%{name}/scripts/templates/Device.{dzVents,Lua} \
5f7b071
      $RPM_BUILD_ROOT%{_sharedstatedir}/%{name}/scripts/templates/
5f7b071
ln -s %{_datadir}/%{name}/scripts/templates/global_data.dzVents \
5f7b071
      $RPM_BUILD_ROOT%{_sharedstatedir}/%{name}/scripts/templates/
5f7b071
ln -s %{_datadir}/%{name}/scripts/templates/Group.dzVents \
5f7b071
      $RPM_BUILD_ROOT%{_sharedstatedir}/%{name}/scripts/templates/
5f7b071
ln -s %{_datadir}/%{name}/scripts/templates/HTTPRequest.dzVents \
5f7b071
      $RPM_BUILD_ROOT%{_sharedstatedir}/%{name}/scripts/templates/
5f7b071
ln -s %{_datadir}/%{name}/scripts/templates/Scene.dzVents \
5f7b071
      $RPM_BUILD_ROOT%{_sharedstatedir}/%{name}/scripts/templates/
5f7b071
ln -s %{_datadir}/%{name}/scripts/templates/Security.{dzVents,Lua} \
5f7b071
      $RPM_BUILD_ROOT%{_sharedstatedir}/%{name}/scripts/templates/
5f7b071
ln -s %{_datadir}/%{name}/scripts/templates/Time.Lua \
5f7b071
      $RPM_BUILD_ROOT%{_sharedstatedir}/%{name}/scripts/templates/
5f7b071
ln -s %{_datadir}/%{name}/scripts/templates/Timer.dzVents \
5f7b071
      $RPM_BUILD_ROOT%{_sharedstatedir}/%{name}/scripts/templates/
5f7b071
ln -s %{_datadir}/%{name}/scripts/templates/UserVariable.{dzVents,Lua} \
5f7b071
      $RPM_BUILD_ROOT%{_sharedstatedir}/%{name}/scripts/templates/
d689dd1
de75b76
# Byte compile the default plugin
de75b76
%py_byte_compile %{__python3} %{buildroot}%{_datadir}/%{name}/plugins/AwoxSMP
de75b76
3aa01fd
3aa01fd
%pre
3aa01fd
getent group domoticz >/dev/null || groupadd -r domoticz
3aa01fd
getent passwd domoticz >/dev/null || \
3aa01fd
useradd -r -g domoticz -d %{_datadir}/%{name} -s /sbin/nologin \
3aa01fd
-c "Domoticz Home Automation Server" domoticz
415d1f4
# For OpenZWave USB access (/dev/ttyACM#)
415d1f4
usermod -G domoticz,dialout domoticz
3aa01fd
3aa01fd
3aa01fd
%post
3aa01fd
%systemd_post %{name}.service
3aa01fd
3aa01fd
3aa01fd
%preun
3aa01fd
%systemd_preun %{name}.service
3aa01fd
3aa01fd
3aa01fd
%postun
3aa01fd
%systemd_postun_with_restart %{name}.service
3aa01fd
3aa01fd
3aa01fd
%files
3aa01fd
%license License.txt
3aa01fd
%doc README.md History.txt
3aa01fd
%{_bindir}/%{name}
3aa01fd
%config(noreplace) %{_sysconfdir}/sysconfig/%{name}
3aa01fd
%{_datadir}/%{name}/
97b4254
%attr(0755,domoticz,domoticz) %{_sharedstatedir}/%{name}/
3aa01fd
%{_unitdir}/%{name}.service
3aa01fd
3aa01fd
3aa01fd
%changelog
b202fc7
* Mon Jul 27 2020 Fedora Release Engineering <releng@fedoraproject.org> - 2020.2-5
b202fc7
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild
b202fc7
f3a8b05
* Wed Jun 03 2020 Michael Cronenworth <mike@cchtml.com> - 2020.2-4
f3a8b05
- Rebuild for Boost 1.73 (RHBZ#1843104)
f3a8b05
30232d6
* Sat May 30 2020 Björn Esser <besser82@fedoraproject.org> - 2020.2-3
30232d6
- Rebuild (jsoncpp)
0cb4a4b
- Add a patch to fix build with Python 3.9 (RHBZ#1842068)
30232d6
741f5e0
* Mon Apr 27 2020 Michael Cronenworth <mike@cchtml.com> - 2020.2-2
741f5e0
- Link against older minizip
741f5e0
8f1bf90
* Mon Apr 27 2020 Michael Cronenworth <mike@cchtml.com> - 2020.2-1
8f1bf90
- New stable release
8f1bf90
9d9f230
* Tue Apr 21 2020 Michael Cronenworth <mike@cchtml.com> - 2020.1-2
9d9f230
- Fix dzVents (RHBZ#1759558)
9d9f230
1a11e5e
* Tue Mar 24 2020 Michael Cronenworth <mike@cchtml.com> - 2020.1-1
1a11e5e
- New stable release
1a11e5e
4afbdc0
* Wed Feb 05 2020 Michael Cronenworth <mike@cchtml.com> - 4.11671-0.git20200202.1
4afbdc0
- Update git checkout
4afbdc0
cb8405f
* Tue Jan 28 2020 Fedora Release Engineering <releng@fedoraproject.org> - 4.11553-0.git20191207.1.1
cb8405f
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild
cb8405f
6582fdf
* Sat Dec 07 2019 Michael Cronenworth <mike@cchtml.com> - 4.11553-0.git20191207.1
6582fdf
- Update git checkout (RHBZ#1780739)
6582fdf
5f7b071
* Wed Oct 09 2019 Michael Cronenworth <mike@cchtml.com> - 4.11352-0.git20191006.1
5f7b071
- Update git checkout and fix scripts directories (RHBZ#1759558)
5f7b071
5f7b071
* Sat Aug 31 2019 Michael Cronenworth <mike@cchtml.com> - 4.11250-0.git20190831.1
51ef934
- Fix app version to match upstream versioning
51ef934
- Fix default userdata location so the app can write to it
51ef934
51ef934
* Sat Aug 31 2019 Michael Cronenworth <mike@cchtml.com> - 4.10718-0.git20190831.1
af0f3ae
- Version update to current master git checkout
af0f3ae
- Compile against OpenZWave 1.6
af0f3ae
d8da234
* Wed Jul 24 2019 Fedora Release Engineering <releng@fedoraproject.org> - 4.9700-7
d8da234
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild
d8da234
4e97d02
* Thu Jan 31 2019 Fedora Release Engineering <releng@fedoraproject.org> - 4.9700-6
4e97d02
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild
4e97d02
9033aff
* Thu Jan 24 2019 Jonathan Wakely <jwakely@redhat.com> - 4.9700-5
9033aff
- Rebuilt for Boost 1.69
9033aff
dfa1fbd
* Wed Jan 23 2019 Björn Esser <besser82@fedoraproject.org> - 4.9700-4
dfa1fbd
- Append curdir to CMake invokation. (#1668512)
dfa1fbd
fc75934
* Sun Nov 11 2018 Michael Cronenworth <mike@cchtml.com> - 4.9700-3
fc75934
- Add patch to support Python 3.7
fc75934
75c7081
* Thu Jul 12 2018 Fedora Release Engineering <releng@fedoraproject.org> - 4.9700-2
75c7081
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild
75c7081
24bdab9
* Sun Jul 08 2018 Michael Cronenworth <mike@cchtml.com> - 4.9700-1
24bdab9
- Version update
24bdab9
e80f623
* Tue Jun 19 2018 Miro Hrončok <mhroncok@redhat.com> - 3.8153-7
e80f623
- Rebuilt for Python 3.7
e80f623
de75b76
* Mon Jun 18 2018 Michael Cronenworth <mike@cchtml.com> - 3.8153-6
de75b76
- Do not compile some of the extra Python files
de75b76
- Add patch to fix bug in OZWCP javascript
de75b76
10a06f3
* Wed Feb 07 2018 Fedora Release Engineering <releng@fedoraproject.org> - 3.8153-5
10a06f3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild
10a06f3
8d07018
* Thu Jan 25 2018 Michael Cronenworth <mike@cchtml.com> - 3.8153-4
8d07018
- Add OpenZWave Command Class Barrier support
8d07018
- Boost 1.66 support (RHBZ#1538585)
8d07018
70a7e43
* Fri Sep 08 2017 Michael Cronenworth <mike@cchtml.com> - 3.8153-3
70a7e43
- Fix OpenZWave control panel symlink (RHBZ#1482266)
70a7e43
- Fix Python detection
70a7e43
d689dd1
* Mon Jul 31 2017 Michael Cronenworth <mike@cchtml.com> - 3.8153-2
d689dd1
- Fix OpenZWave control panel
d689dd1
415d1f4
* Mon Jul 31 2017 Michael Cronenworth <mike@cchtml.com> - 3.8153-1
415d1f4
- New upstream version
415d1f4
- Unbundle tinyxpath
415d1f4
c179cb9
* Wed Jul 26 2017 Fedora Release Engineering <releng@fedoraproject.org> - 3.5877-3
c179cb9
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild
c179cb9
8f9e10b
* Fri Jul 21 2017 Kalev Lember <klember@redhat.com> - 3.5877-2
8f9e10b
- Rebuilt for Boost 1.64
8f9e10b
3aa01fd
* Wed Jul 19 2017 Michael Cronenworth <mike@cchtml.com> - 3.5877-1
3aa01fd
- Initial spec