]> git.pld-linux.org Git - packages/domoticz.git/blob - domoticz.spec
e1bb9caca7e4590463a2b6b2ecf7b7f9a5fb919e
[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 Patch5:         %{name}-gpio.patch
21 BuildRequires:  boost-devel >= 1.66.0
22 BuildRequires:  cereal-devel
23 BuildRequires:  cmake >= 3.16.0
24 BuildRequires:  curl-devel
25 BuildRequires:  jsoncpp-devel
26 BuildRequires:  libmosquitto-devel
27 BuildRequires:  libopenzwave-devel >= 1.5.0
28 BuildRequires:  libstdc++-devel >= 6:4.8.1
29 BuildRequires:  libusb-compat-devel
30 BuildRequires:  linux-libc-headers
31 BuildRequires:  lua53-devel
32 BuildRequires:  minizip-devel
33 BuildRequires:  openssl-devel
34 BuildRequires:  pkgconfig
35 BuildRequires:  python3 >= 1:3.4
36 BuildRequires:  python3-devel >= 1:3.4
37 BuildRequires:  rpmbuild(macros) >= 1.644
38 BuildRequires:  sqlite3-devel
39 BuildRequires:  tinyxml-devel
40 BuildRequires:  tinyxpath-devel
41 BuildRequires:  zlib-devel
42 Requires(pre):  /usr/sbin/groupadd
43 Requires(pre):  /usr/sbin/useradd
44 Requires(post,preun,postun):    systemd-units >= 38
45 Requires:       fonts-TTF-Google-Droid
46 Requires:       libopenzwave >= 1.5.0
47 Provides:       group(domoticz)
48 Provides:       user(domoticz)
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 %patch5 -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_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         -DUSE_STATIC_OPENZWAVE=NO \
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}/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 cp -p %{SOURCE1} $RPM_BUILD_ROOT%{systemdunitdir}
106 cp -p %{SOURCE2} $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/%{name}
107
108 # Unbundle DroidSans.ttf
109 %{__rm} $RPM_BUILD_ROOT%{_datadir}/%{name}/www/styles/element{al,-light,-dark}/fonts/DroidSans.ttf
110 ln -s %{_fontsdir}/TTF/DroidSans.ttf \
111         $RPM_BUILD_ROOT%{_datadir}/%{name}/www/styles/elemental/fonts
112 ln -s %{_fontsdir}/TTF/DroidSans.ttf \
113         $RPM_BUILD_ROOT%{_datadir}/%{name}/www/styles/element-light/fonts
114 ln -s %{_fontsdir}/TTF/DroidSans.ttf \
115         $RPM_BUILD_ROOT%{_datadir}/%{name}/www/styles/element-dark/fonts
116
117 # OpenZWave Control Panel temp file
118 ln -s %{_sharedstatedir}/%{name}/ozwcp.poll.XXXXXX.xml \
119         $RPM_BUILD_ROOT%{_datadir}/%{name}/ozwcp.poll.XXXXXX.xml
120
121 %clean
122 rm -rf $RPM_BUILD_ROOT
123
124 %pre
125 %groupadd -g 342 domoticz
126 %useradd -u 342 -r -d %{_datadir} -s /bin/false -c "Domoticz Home Automation Server" -G dialout -g domoticz domoticz
127
128 %post
129 %systemd_post %{name}.service
130
131 %preun
132 %systemd_preun %{name}.service
133
134 %postun
135 if [ "$1" = "0" ]; then
136         %userremove mpd
137         %groupremove mpd
138 fi
139 %systemd_reload
140
141 %files
142 %defattr(644,root,root,755)
143 %doc License.txt README.md History.txt
144 %attr(755,root,root) %{_bindir}/%{name}
145 %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/%{name}
146 %{_datadir}/%{name}
147 %dir %attr(750,domoticz,domoticz) %{_sharedstatedir}/%{name}
148 %{systemdunitdir}/%{name}.service
This page took 0.04633 seconds and 2 git commands to generate.