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