]> git.pld-linux.org Git - packages/domoticz.git/blob - domoticz.spec
missed tinyxpath patch update; rel 2
[packages/domoticz.git] / domoticz.spec
1 Summary:        Open source Home Automation System
2 Name:           domoticz
3 Version:        2024.1
4 Release:        2
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}/%{name}-%{version}.tar.gz
9 # Source0-md5:  35b60b24ab2e1cf6d721d6720ae8a670
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 # Fix python detection (https://github.com/domoticz/domoticz/pull/1749)
15 Patch1:         %{name}-python.patch
16 Patch2:         no-git.patch
17 Patch3:         %{name}-no_updates.patch
18 Patch4:         config.patch
19 BuildRequires:  boost-devel >= 1.66.0
20 BuildRequires:  cereal-devel
21 BuildRequires:  cmake >= 3.16.0
22 BuildRequires:  curl-devel
23 BuildRequires:  jsoncpp-devel
24 BuildRequires:  libmosquitto-devel
25 BuildRequires:  libstdc++-devel >= 6:4.9
26 BuildRequires:  libusb-compat-devel
27 BuildRequires:  linux-libc-headers
28 BuildRequires:  lua53-devel
29 BuildRequires:  minizip-devel
30 BuildRequires:  openssl-devel
31 BuildRequires:  pkgconfig
32 BuildRequires:  python3 >= 1:3.4
33 BuildRequires:  python3-devel >= 1:3.4
34 BuildRequires:  rpmbuild(macros) >= 1.644
35 BuildRequires:  sqlite3-devel
36 BuildRequires:  tinyxml-devel
37 BuildRequires:  tinyxpath-devel
38 BuildRequires:  zlib-devel
39 Requires(pre):  /usr/sbin/groupadd
40 Requires(pre):  /usr/sbin/useradd
41 Requires(post,preun,postun):    systemd-units >= 38
42 Requires:       fonts-TTF-Google-Droid
43 Requires:       fonts-TTF-OpenSans
44 Requires:       setup >= 2.10.1
45 Suggests:       python3-libs
46 Provides:       group(domoticz)
47 Provides:       user(domoticz)
48 BuildRoot:      %{tmpdir}/%{name}-%{version}-root-%(id -u -n)
49
50 %description
51 Domoticz is a Home Automation System that lets you monitor and
52 configure various devices like: Lights, Switches, various
53 sensors/meters like Temperature, Rain, Wind, UV, Electra, Gas, Water
54 and much more. Notifications/Alerts can be sent to any mobile device
55
56 %prep
57 %setup -q
58 %patch0 -p1
59 %patch1 -p1
60 %patch2 -p1
61 %patch3 -p1
62 %patch4 -p1
63
64 APPVERSION="%{version}"
65 echo "#define APPVERSION ${APPVERSION##*.}" > appversion.h
66 echo '#define APPHASH "%{snap}"' >> appversion.h
67 APPDATE=$(date --date="%{date}" "+%s")
68 echo "#define APPDATE ${APPDATE}" >> appversion.h
69
70 %{__rm} -r extern tinyxpath
71
72 %build
73 install -d build && cd build
74 export CXXFLAGS="%{rpmcxxflags} -DPYTHON_LIBDIR=\\\"%{_libdir}\\\""
75 %cmake \
76         -DUSE_BUILTIN_JSONCPP=NO \
77         -DUSE_BUILTIN_MINIZIP=NO \
78         -DUSE_BUILTIN_MQTT=NO \
79         -DUSE_BUILTIN_SQLITE=NO \
80         -DUSE_BUILTIN_TINYXPATH=NO \
81         -DUSE_LUA_STATIC=NO \
82         -DUSE_OPENSSL_STATIC=NO \
83         -DUSE_STATIC_BOOST=NO \
84         -DUSE_STATIC_LIBSTDCXX=NO \
85         -DFORCE_WITH_GPIO:BOOL=TRUE \
86         -DCMAKE_INSTALL_PREFIX=%{_datadir}/%{name} \
87         ..
88
89 %{__make}
90
91 %install
92 rm -rf $RPM_BUILD_ROOT
93
94 %{__make} -C build install \
95         DESTDIR=$RPM_BUILD_ROOT
96
97 install -d $RPM_BUILD_ROOT{%{_bindir},%{_sysconfdir}/{domoticz,sysconfig},%{systemdunitdir},%{_sharedstatedir}/%{name}}
98
99 # remove docs, we grab them in files below
100 %{__rm} $RPM_BUILD_ROOT%{_datadir}/%{name}/*.txt
101
102 # move binary to standard directory
103 mv $RPM_BUILD_ROOT%{_datadir}/%{name}/%{name} $RPM_BUILD_ROOT%{_bindir}
104
105 sed -e 's#@DOMOTICZ_DIR@#%{_datadir}/%{name}#g' %{SOURCE1} > $RPM_BUILD_ROOT%{systemdunitdir}/%{name}.service
106 sed -e 's#@DOMOTICZ_DIR@#%{_datadir}/%{name}#g' scripts/domoticz.conf > $RPM_BUILD_ROOT%{_sysconfdir}/domoticz/domoticz.conf
107 sed -e 's#@DOMOTICZ_CONF_DIR@#%{_sysconfdir}/%{name}#' %{SOURCE2} > $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/%{name}
108
109 # Unbundle DroidSans.ttf
110 %{__rm} $RPM_BUILD_ROOT%{_datadir}/%{name}/www/styles/element{al,-light,-dark}/fonts/{Droid,Open}Sans.ttf
111 ln -s %{_fontsdir}/TTF/DroidSans.ttf \
112         $RPM_BUILD_ROOT%{_datadir}/%{name}/www/styles/elemental/fonts
113 ln -s %{_fontsdir}/TTF/OpenSans-Regular.ttf \
114         $RPM_BUILD_ROOT%{_datadir}/%{name}/www/styles/elemental/fonts/OpenSans.ttf
115 ln -s %{_fontsdir}/TTF/DroidSans.ttf \
116         $RPM_BUILD_ROOT%{_datadir}/%{name}/www/styles/element-light/fonts
117 ln -s %{_fontsdir}/TTF/OpenSans-Regular.ttf \
118         $RPM_BUILD_ROOT%{_datadir}/%{name}/www/styles/element-light/fonts/OpenSans.ttf
119 ln -s %{_fontsdir}/TTF/DroidSans.ttf \
120         $RPM_BUILD_ROOT%{_datadir}/%{name}/www/styles/element-dark/fonts
121 ln -s %{_fontsdir}/TTF/OpenSans-Regular.ttf \
122         $RPM_BUILD_ROOT%{_datadir}/%{name}/www/styles/element-dark/fonts/OpenSans.ttf
123
124 %clean
125 rm -rf $RPM_BUILD_ROOT
126
127 %pre
128 %groupadd -g 342 domoticz
129 %useradd -u 342 -r -d %{_datadir} -s /bin/false -c "Domoticz Home Automation Server" -G dialout,i2c -g domoticz domoticz
130
131 %post
132 %systemd_post %{name}.service
133
134 %preun
135 %systemd_preun %{name}.service
136
137 %postun
138 if [ "$1" = "0" ]; then
139         %userremove domoticz
140         %groupremove domoticz
141 fi
142 %systemd_reload
143
144 %triggerpostun -- domoticz < 2022.1
145 if [ -f /etc/sysconfig/domoticz.rpmnew ] && [ -f /etc/sysconfig/domoticz ] && ! grep -q '^DOMOTICZ_CONF=' /etc/sysconfig/domoticz; then
146         (
147         . /etc/sysconfig/domoticz
148         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
149                 cn_before=${c%:*}
150                 cn_after=${c#*:}
151                 eval cn_value=\"\$$cn_before\"
152                 test -n "$cn_value" && sed -i -e "s|^[[:space:]#]*$cn_after=.*|$cn_after=$cn_value|" %{_sysconfdir}/%{name}/%{name}.conf
153         done
154         )
155         mv -f /etc/sysconfig/domoticz{,.rpmsave}
156         mv /etc/sysconfig/domoticz{.rpmnew,}
157 fi
158
159 %files
160 %defattr(644,root,root,755)
161 %doc License.txt README.md History.txt
162 %attr(755,root,root) %{_bindir}/%{name}
163 %dir %attr(750,domoticz,domoticz) %{_sysconfdir}/%{name}
164 %attr(640,domoticz,domoticz) %config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/%{name}/%{name}.conf
165 %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/%{name}
166 %{_datadir}/%{name}
167 %dir %attr(750,domoticz,domoticz) %{_sharedstatedir}/%{name}
168 %{systemdunitdir}/%{name}.service
This page took 0.098152 seconds and 4 git commands to generate.