]>
Commit | Line | Data |
---|---|---|
9dda6696 AM |
1 | Summary: Open source Home Automation System |
2 | Name: domoticz | |
9a71e0cb | 3 | Version: 2021.1 |
f3eaf224 | 4 | Release: 6 |
9dda6696 AM |
5 | License: GPLv3+ and ASL 2.0 and Boost and BSD and MIT |
6 | Group: Base | |
7 | URL: http://www.domoticz.com | |
40563459 | 8 | Source0: https://github.com/domoticz/domoticz/archive/%{version}/%{name}-%{version}.tar.gz |
9a71e0cb | 9 | # Source0-md5: 28349806fc3ddb0514ea7d9255ceecd0 |
9dda6696 AM |
10 | Source1: %{name}.service |
11 | Source2: %{name}.conf | |
9dda6696 | 12 | # Use system tinyxpath (https://github.com/domoticz/domoticz/pull/1759) |
bc226567 | 13 | Patch0: %{name}-tinyxpath.patch |
9dda6696 | 14 | # Fix python detection (https://github.com/domoticz/domoticz/pull/1749) |
9a71e0cb JP |
15 | Patch1: %{name}-python.patch |
16 | Patch2: no-git.patch | |
17 | Patch3: %{name}-gpio.patch | |
18 | Patch4: %{name}-no_updates.patch | |
4987f952 | 19 | BuildRequires: boost-devel >= 1.66.0 |
72784cf7 | 20 | BuildRequires: cereal-devel |
4987f952 | 21 | BuildRequires: cmake >= 3.16.0 |
9dda6696 | 22 | BuildRequires: curl-devel |
4987f952 | 23 | BuildRequires: jsoncpp-devel |
9a71e0cb | 24 | BuildRequires: libfmt-devel |
9dda6696 | 25 | BuildRequires: libmosquitto-devel |
9dda6696 | 26 | BuildRequires: libopenzwave-devel >= 1.5.0 |
9a71e0cb | 27 | BuildRequires: libstdc++-devel >= 6:4.9 |
4987f952 JP |
28 | BuildRequires: libusb-compat-devel |
29 | BuildRequires: linux-libc-headers | |
30 | BuildRequires: lua53-devel | |
72784cf7 | 31 | BuildRequires: minizip-devel |
9dda6696 | 32 | BuildRequires: openssl-devel |
4987f952 JP |
33 | BuildRequires: pkgconfig |
34 | BuildRequires: python3 >= 1:3.4 | |
35 | BuildRequires: python3-devel >= 1:3.4 | |
f5d0e494 | 36 | BuildRequires: rpmbuild(macros) >= 1.644 |
4987f952 JP |
37 | BuildRequires: sqlite3-devel |
38 | BuildRequires: tinyxml-devel | |
9dda6696 AM |
39 | BuildRequires: tinyxpath-devel |
40 | BuildRequires: zlib-devel | |
0e22aa87 JP |
41 | Requires(pre): /usr/sbin/groupadd |
42 | Requires(pre): /usr/sbin/useradd | |
43 | Requires(post,preun,postun): systemd-units >= 38 | |
44 | Requires: fonts-TTF-Google-Droid | |
e9c32406 | 45 | Requires: fonts-TTF-OpenSans |
4987f952 | 46 | Requires: libopenzwave >= 1.5.0 |
a1c25c45 | 47 | Requires: setup >= 2.10.1 |
77898dff | 48 | Suggests: python3-libs |
ed4fe787 JP |
49 | Provides: group(domoticz) |
50 | Provides: user(domoticz) | |
4f49453f | 51 | BuildRoot: %{tmpdir}/%{name}-%{version}-root-%(id -u -n) |
9dda6696 AM |
52 | |
53 | %description | |
54 | Domoticz is a Home Automation System that lets you monitor and | |
55 | configure various devices like: Lights, Switches, various | |
56 | sensors/meters like Temperature, Rain, Wind, UV, Electra, Gas, Water | |
57 | and much more. Notifications/Alerts can be sent to any mobile device | |
58 | ||
59 | %prep | |
72784cf7 | 60 | %setup -q |
bc226567 JP |
61 | %patch0 -p1 |
62 | %patch1 -p1 | |
63 | %patch2 -p1 | |
64 | %patch3 -p1 | |
65 | %patch4 -p1 | |
10f7a92e AM |
66 | |
67 | APPVERSION="%{version}" | |
68 | echo "#define APPVERSION ${APPVERSION##*.}" > appversion.h | |
69 | echo '#define APPHASH "%{snap}"' >> appversion.h | |
70 | APPDATE=$(date --date="%{date}" "+%s") | |
71 | echo "#define APPDATE ${APPDATE}" >> appversion.h | |
72 | ||
0e22aa87 | 73 | %{__rm} -r extern tinyxpath |
9dda6696 AM |
74 | |
75 | %build | |
76 | install -d build && cd build | |
109876d2 | 77 | export CXXFLAGS="%{rpmcxxflags} -DPYTHON_LIBDIR=\\\"%{_libdir}\\\"" |
9dda6696 | 78 | %cmake \ |
4987f952 | 79 | -DUSE_BUILTIN_JSONCPP=NO \ |
9a71e0cb | 80 | -DUSE_BUILTIN_LIBFMT=NO \ |
4987f952 | 81 | -DUSE_BUILTIN_MINIZIP=NO \ |
71593ba7 JR |
82 | -DUSE_BUILTIN_MQTT=NO \ |
83 | -DUSE_BUILTIN_SQLITE=NO \ | |
84 | -DUSE_BUILTIN_TINYXPATH=NO \ | |
4987f952 JP |
85 | -DUSE_LUA_STATIC=NO \ |
86 | -DUSE_OPENSSL_STATIC=NO \ | |
71593ba7 | 87 | -DUSE_STATIC_BOOST=NO \ |
4987f952 JP |
88 | -DUSE_STATIC_LIBSTDCXX=NO \ |
89 | -DUSE_STATIC_OPENZWAVE=NO \ | |
71593ba7 JR |
90 | -DCMAKE_INSTALL_PREFIX=%{_datadir}/%{name} \ |
91 | .. | |
00bce45c | 92 | |
9dda6696 AM |
93 | %{__make} |
94 | ||
95 | %install | |
96 | rm -rf $RPM_BUILD_ROOT | |
0e22aa87 | 97 | |
00bce45c | 98 | %{__make} -C build install \ |
0e22aa87 JP |
99 | DESTDIR=$RPM_BUILD_ROOT |
100 | ||
101 | install -d $RPM_BUILD_ROOT{%{_bindir},%{_sysconfdir}/sysconfig,%{systemdunitdir},%{_sharedstatedir}/%{name}} | |
9dda6696 AM |
102 | |
103 | # remove docs, we grab them in files below | |
0e22aa87 | 104 | %{__rm} $RPM_BUILD_ROOT%{_datadir}/%{name}/*.txt |
9dda6696 AM |
105 | |
106 | # move binary to standard directory | |
0e22aa87 | 107 | mv $RPM_BUILD_ROOT%{_datadir}/%{name}/%{name} $RPM_BUILD_ROOT%{_bindir} |
9dda6696 | 108 | |
0e22aa87 | 109 | cp -p %{SOURCE1} $RPM_BUILD_ROOT%{systemdunitdir} |
9dda6696 AM |
110 | cp -p %{SOURCE2} $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/%{name} |
111 | ||
9dda6696 | 112 | # Unbundle DroidSans.ttf |
e9c32406 | 113 | %{__rm} $RPM_BUILD_ROOT%{_datadir}/%{name}/www/styles/element{al,-light,-dark}/fonts/{Droid,Open}Sans.ttf |
0e22aa87 JP |
114 | ln -s %{_fontsdir}/TTF/DroidSans.ttf \ |
115 | $RPM_BUILD_ROOT%{_datadir}/%{name}/www/styles/elemental/fonts | |
e9c32406 JP |
116 | ln -s %{_fontsdir}/TTF/OpenSans-Regular.ttf \ |
117 | $RPM_BUILD_ROOT%{_datadir}/%{name}/www/styles/elemental/fonts/OpenSans.ttf | |
0e22aa87 JP |
118 | ln -s %{_fontsdir}/TTF/DroidSans.ttf \ |
119 | $RPM_BUILD_ROOT%{_datadir}/%{name}/www/styles/element-light/fonts | |
e9c32406 JP |
120 | ln -s %{_fontsdir}/TTF/OpenSans-Regular.ttf \ |
121 | $RPM_BUILD_ROOT%{_datadir}/%{name}/www/styles/element-light/fonts/OpenSans.ttf | |
0e22aa87 JP |
122 | ln -s %{_fontsdir}/TTF/DroidSans.ttf \ |
123 | $RPM_BUILD_ROOT%{_datadir}/%{name}/www/styles/element-dark/fonts | |
e9c32406 JP |
124 | ln -s %{_fontsdir}/TTF/OpenSans-Regular.ttf \ |
125 | $RPM_BUILD_ROOT%{_datadir}/%{name}/www/styles/element-dark/fonts/OpenSans.ttf | |
9dda6696 AM |
126 | |
127 | # OpenZWave Control Panel temp file | |
128 | ln -s %{_sharedstatedir}/%{name}/ozwcp.poll.XXXXXX.xml \ | |
0e22aa87 | 129 | $RPM_BUILD_ROOT%{_datadir}/%{name}/ozwcp.poll.XXXXXX.xml |
9dda6696 AM |
130 | |
131 | %clean | |
132 | rm -rf $RPM_BUILD_ROOT | |
133 | ||
134 | %pre | |
ed4fe787 | 135 | %groupadd -g 342 domoticz |
a1c25c45 | 136 | %useradd -u 342 -r -d %{_datadir} -s /bin/false -c "Domoticz Home Automation Server" -G dialout,i2c -g domoticz domoticz |
9dda6696 AM |
137 | |
138 | %post | |
139 | %systemd_post %{name}.service | |
140 | ||
141 | %preun | |
142 | %systemd_preun %{name}.service | |
143 | ||
144 | %postun | |
ed4fe787 | 145 | if [ "$1" = "0" ]; then |
f3eaf224 JP |
146 | %userremove domoticz |
147 | %groupremove domoticz | |
ed4fe787 | 148 | fi |
5ac2f181 | 149 | %systemd_reload |
9dda6696 AM |
150 | |
151 | %files | |
152 | %defattr(644,root,root,755) | |
0e22aa87 | 153 | %doc License.txt README.md History.txt |
9dda6696 AM |
154 | %attr(755,root,root) %{_bindir}/%{name} |
155 | %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/%{name} | |
0e22aa87 JP |
156 | %{_datadir}/%{name} |
157 | %dir %attr(750,domoticz,domoticz) %{_sharedstatedir}/%{name} | |
9dda6696 | 158 | %{systemdunitdir}/%{name}.service |