]> git.pld-linux.org Git - packages/domoticz.git/blob - domoticz.spec
add2ec27839e7e6b6fa5d7eac7026e324e4d57b0
[packages/domoticz.git] / domoticz.spec
1 Summary:        Open source Home Automation System
2 Name:           domoticz
3 Version:        2021.1
4 Release:        1
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:  28349806fc3ddb0514ea7d9255ceecd0
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}-gpio.patch
18 Patch4:         %{name}-no_updates.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:  libfmt-devel
25 BuildRequires:  libmosquitto-devel
26 BuildRequires:  libopenzwave-devel >= 1.5.0
27 BuildRequires:  libstdc++-devel >= 6:4.9
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:  rpmbuild(macros) >= 1.644
37 BuildRequires:  sqlite3-devel
38 BuildRequires:  tinyxml-devel
39 BuildRequires:  tinyxpath-devel
40 BuildRequires:  zlib-devel
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
45 Requires:       fonts-TTF-OpenSans
46 Requires:       libopenzwave >= 1.5.0
47 Requires:       setup >= 2.10.1
48 Provides:       group(domoticz)
49 Provides:       user(domoticz)
50
51 %description
52 Domoticz is a Home Automation System that lets you monitor and
53 configure various devices like: Lights, Switches, various
54 sensors/meters like Temperature, Rain, Wind, UV, Electra, Gas, Water
55 and much more. Notifications/Alerts can be sent to any mobile device
56
57 %prep
58 %setup -q
59 %patch0 -p1
60 %patch1 -p1
61 %patch2 -p1
62 %patch3 -p1
63 %patch4 -p1
64
65 APPVERSION="%{version}"
66 echo "#define APPVERSION ${APPVERSION##*.}" > appversion.h
67 echo '#define APPHASH "%{snap}"' >> appversion.h
68 APPDATE=$(date --date="%{date}" "+%s")
69 echo "#define APPDATE ${APPDATE}" >> appversion.h
70
71 %{__rm} -r extern tinyxpath
72
73 %build
74 install -d build && cd build
75 %cmake \
76         -DUSE_BUILTIN_JSONCPP=NO \
77         -DUSE_BUILTIN_LIBFMT=NO \
78         -DUSE_BUILTIN_MINIZIP=NO \
79         -DUSE_BUILTIN_MQTT=NO \
80         -DUSE_BUILTIN_SQLITE=NO \
81         -DUSE_BUILTIN_TINYXPATH=NO \
82         -DUSE_LUA_STATIC=NO \
83         -DUSE_OPENSSL_STATIC=NO \
84         -DUSE_STATIC_BOOST=NO \
85         -DUSE_STATIC_LIBSTDCXX=NO \
86         -DUSE_STATIC_OPENZWAVE=NO \
87         -DCMAKE_INSTALL_PREFIX=%{_datadir}/%{name} \
88         ..
89
90 %{__make}
91
92 %install
93 rm -rf $RPM_BUILD_ROOT
94
95 %{__make} -C build install \
96         DESTDIR=$RPM_BUILD_ROOT
97
98 install -d $RPM_BUILD_ROOT{%{_bindir},%{_sysconfdir}/sysconfig,%{systemdunitdir},%{_sharedstatedir}/%{name}}
99
100 # remove docs, we grab them in files below
101 %{__rm} $RPM_BUILD_ROOT%{_datadir}/%{name}/*.txt
102
103 # move binary to standard directory
104 mv $RPM_BUILD_ROOT%{_datadir}/%{name}/%{name} $RPM_BUILD_ROOT%{_bindir}
105
106 cp -p %{SOURCE1} $RPM_BUILD_ROOT%{systemdunitdir}
107 cp -p %{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 # OpenZWave Control Panel temp file
125 ln -s %{_sharedstatedir}/%{name}/ozwcp.poll.XXXXXX.xml \
126         $RPM_BUILD_ROOT%{_datadir}/%{name}/ozwcp.poll.XXXXXX.xml
127
128 %clean
129 rm -rf $RPM_BUILD_ROOT
130
131 %pre
132 %groupadd -g 342 domoticz
133 %useradd -u 342 -r -d %{_datadir} -s /bin/false -c "Domoticz Home Automation Server" -G dialout,i2c -g domoticz domoticz
134
135 %post
136 %systemd_post %{name}.service
137
138 %preun
139 %systemd_preun %{name}.service
140
141 %postun
142 if [ "$1" = "0" ]; then
143         %userremove mpd
144         %groupremove mpd
145 fi
146 %systemd_reload
147
148 %files
149 %defattr(644,root,root,755)
150 %doc License.txt README.md History.txt
151 %attr(755,root,root) %{_bindir}/%{name}
152 %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/%{name}
153 %{_datadir}/%{name}
154 %dir %attr(750,domoticz,domoticz) %{_sharedstatedir}/%{name}
155 %{systemdunitdir}/%{name}.service
This page took 0.02564 seconds and 2 git commands to generate.