]> git.pld-linux.org Git - packages/domoticz.git/blob - domoticz.spec
cleanup
[packages/domoticz.git] / domoticz.spec
1 Summary:        Open source Home Automation System
2 Name:           domoticz
3 Version:        2020.2
4 Release:        3
5 License:        GPLv3+ and ASL 2.0 and Boost and BSD and MIT
6 Group:          Base
7 URL:            http://www.domoticz.com
8 Source0:        https://github.com/domoticz/domoticz/archive/%{version}.tar.gz
9 # Source0-md5:  fd383a13d13d0976c72f332d6db1d24e
10 Source1:        %{name}.service
11 Source2:        %{name}.conf
12 # Use system tinyxpath (https://github.com/domoticz/domoticz/pull/1759)
13 Patch0:         %{name}-tinyxpath.patch
14 # Use system openzwave includes
15 Patch1:         %{name}-openzwave.patch
16 # Fix python detection (https://github.com/domoticz/domoticz/pull/1749)
17 Patch2:         %{name}-python.patch
18 Patch3:         no-git.patch
19 Patch4:         boost-1.73.patch
20 BuildRequires:  boost-devel >= 1.66.0
21 BuildRequires:  cereal-devel
22 BuildRequires:  cmake >= 3.16.0
23 BuildRequires:  curl-devel
24 BuildRequires:  jsoncpp-devel
25 BuildRequires:  libmosquitto-devel
26 BuildRequires:  libopenzwave-devel >= 1.5.0
27 BuildRequires:  libstdc++-devel >= 6:4.8.1
28 BuildRequires:  libusb-compat-devel
29 BuildRequires:  linux-libc-headers
30 BuildRequires:  lua53-devel
31 BuildRequires:  minizip-devel
32 BuildRequires:  openssl-devel
33 BuildRequires:  pkgconfig
34 BuildRequires:  python3 >= 1:3.4
35 BuildRequires:  python3-devel >= 1:3.4
36 BuildRequires:  sqlite3-devel
37 BuildRequires:  tinyxml-devel
38 BuildRequires:  tinyxpath-devel
39 BuildRequires:  zlib-devel
40 Requires(pre):  /usr/sbin/groupadd
41 Requires(pre):  /usr/sbin/useradd
42 Requires(post,preun,postun):    systemd-units >= 38
43 Requires:       fonts-TTF-Google-Droid
44 Requires:       libopenzwave >= 1.5.0
45
46 %description
47 Domoticz is a Home Automation System that lets you monitor and
48 configure various devices like: Lights, Switches, various
49 sensors/meters like Temperature, Rain, Wind, UV, Electra, Gas, Water
50 and much more. Notifications/Alerts can be sent to any mobile device
51
52 %prep
53 %setup -q
54 %patch0 -p1
55 %patch1 -p1
56 %patch2 -p1
57 %patch3 -p1
58 %patch4 -p1
59
60 APPVERSION="%{version}"
61 echo "#define APPVERSION ${APPVERSION##*.}" > appversion.h
62 echo '#define APPHASH "%{snap}"' >> appversion.h
63 APPDATE=$(date --date="%{date}" "+%s")
64 echo "#define APPDATE ${APPDATE}" >> appversion.h
65
66 %{__rm} -r extern tinyxpath
67
68 %build
69 install -d build && cd build
70 %cmake \
71         -DUSE_BUILTIN_JSONCPP=NO \
72         -DUSE_BUILTIN_MINIZIP=NO \
73         -DUSE_BUILTIN_MQTT=NO \
74         -DUSE_BUILTIN_SQLITE=NO \
75         -DUSE_BUILTIN_TINYXPATH=NO \
76         -DUSE_LUA_STATIC=NO \
77         -DUSE_OPENSSL_STATIC=NO \
78         -DUSE_STATIC_BOOST=NO \
79         -DUSE_STATIC_LIBSTDCXX=NO \
80         -DUSE_STATIC_OPENZWAVE=NO \
81         -DCMAKE_INSTALL_PREFIX=%{_datadir}/%{name} \
82         ..
83
84 %{__make}
85
86 %install
87 rm -rf $RPM_BUILD_ROOT
88
89 %{__make} -C build install \
90         DESTDIR=$RPM_BUILD_ROOT
91
92 install -d $RPM_BUILD_ROOT{%{_bindir},%{_sysconfdir}/sysconfig,%{systemdunitdir},%{_sharedstatedir}/%{name}}
93
94 # remove docs, we grab them in files below
95 %{__rm} $RPM_BUILD_ROOT%{_datadir}/%{name}/*.txt
96
97 # move binary to standard directory
98 mv $RPM_BUILD_ROOT%{_datadir}/%{name}/%{name} $RPM_BUILD_ROOT%{_bindir}
99
100 cp -p %{SOURCE1} $RPM_BUILD_ROOT%{systemdunitdir}
101 cp -p %{SOURCE2} $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/%{name}
102
103 # Unbundle DroidSans.ttf
104 %{__rm} $RPM_BUILD_ROOT%{_datadir}/%{name}/www/styles/element{al,-light,-dark}/fonts/DroidSans.ttf
105 ln -s %{_fontsdir}/TTF/DroidSans.ttf \
106         $RPM_BUILD_ROOT%{_datadir}/%{name}/www/styles/elemental/fonts
107 ln -s %{_fontsdir}/TTF/DroidSans.ttf \
108         $RPM_BUILD_ROOT%{_datadir}/%{name}/www/styles/element-light/fonts
109 ln -s %{_fontsdir}/TTF/DroidSans.ttf \
110         $RPM_BUILD_ROOT%{_datadir}/%{name}/www/styles/element-dark/fonts
111
112 # OpenZWave Control Panel temp file
113 ln -s %{_sharedstatedir}/%{name}/ozwcp.poll.XXXXXX.xml \
114         $RPM_BUILD_ROOT%{_datadir}/%{name}/ozwcp.poll.XXXXXX.xml
115
116 %clean
117 rm -rf $RPM_BUILD_ROOT
118
119 %pre
120 getent group domoticz >/dev/null || groupadd -r domoticz
121 getent passwd domoticz >/dev/null || \
122 useradd -r -g domoticz -d %{_datadir}/%{name} -s /sbin/nologin \
123 -c "Domoticz Home Automation Server" domoticz
124 # For OpenZWave USB access (/dev/ttyACM#)
125 usermod -G domoticz,dialout domoticz
126
127 %post
128 %systemd_post %{name}.service
129
130 %preun
131 %systemd_preun %{name}.service
132
133 %postun
134 %systemd_reload
135
136 %files
137 %defattr(644,root,root,755)
138 %doc License.txt README.md History.txt
139 %attr(755,root,root) %{_bindir}/%{name}
140 %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/%{name}
141 %{_datadir}/%{name}
142 %dir %attr(750,domoticz,domoticz) %{_sharedstatedir}/%{name}
143 %{systemdunitdir}/%{name}.service
This page took 0.066867 seconds and 4 git commands to generate.