]> git.pld-linux.org Git - packages/domoticz.git/blob - domoticz.spec
fix build with python 3.9
[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 Patch6:         python3.9.patch
22 BuildRequires:  boost-devel >= 1.66.0
23 BuildRequires:  cereal-devel
24 BuildRequires:  cmake >= 3.16.0
25 BuildRequires:  curl-devel
26 BuildRequires:  jsoncpp-devel
27 BuildRequires:  libmosquitto-devel
28 BuildRequires:  libopenzwave-devel >= 1.5.0
29 BuildRequires:  libstdc++-devel >= 6:4.8.1
30 BuildRequires:  libusb-compat-devel
31 BuildRequires:  linux-libc-headers
32 BuildRequires:  lua53-devel
33 BuildRequires:  minizip-devel
34 BuildRequires:  openssl-devel
35 BuildRequires:  pkgconfig
36 BuildRequires:  python3 >= 1:3.4
37 BuildRequires:  python3-devel >= 1:3.4
38 BuildRequires:  rpmbuild(macros) >= 1.644
39 BuildRequires:  sqlite3-devel
40 BuildRequires:  tinyxml-devel
41 BuildRequires:  tinyxpath-devel
42 BuildRequires:  zlib-devel
43 Requires(pre):  /usr/sbin/groupadd
44 Requires(pre):  /usr/sbin/useradd
45 Requires(post,preun,postun):    systemd-units >= 38
46 Requires:       fonts-TTF-Google-Droid
47 Requires:       libopenzwave >= 1.5.0
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 %patch5 -p1
65 %patch6 -p1
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
73 %{__rm} -r extern tinyxpath
74
75 %build
76 install -d build && cd build
77 %cmake \
78         -DUSE_BUILTIN_JSONCPP=NO \
79         -DUSE_BUILTIN_MINIZIP=NO \
80         -DUSE_BUILTIN_MQTT=NO \
81         -DUSE_BUILTIN_SQLITE=NO \
82         -DUSE_BUILTIN_TINYXPATH=NO \
83         -DUSE_LUA_STATIC=NO \
84         -DUSE_OPENSSL_STATIC=NO \
85         -DUSE_STATIC_BOOST=NO \
86         -DUSE_STATIC_LIBSTDCXX=NO \
87         -DUSE_STATIC_OPENZWAVE=NO \
88         -DCMAKE_INSTALL_PREFIX=%{_datadir}/%{name} \
89         ..
90
91 %{__make}
92
93 %install
94 rm -rf $RPM_BUILD_ROOT
95
96 %{__make} -C build install \
97         DESTDIR=$RPM_BUILD_ROOT
98
99 install -d $RPM_BUILD_ROOT{%{_bindir},%{_sysconfdir}/sysconfig,%{systemdunitdir},%{_sharedstatedir}/%{name}}
100
101 # remove docs, we grab them in files below
102 %{__rm} $RPM_BUILD_ROOT%{_datadir}/%{name}/*.txt
103
104 # move binary to standard directory
105 mv $RPM_BUILD_ROOT%{_datadir}/%{name}/%{name} $RPM_BUILD_ROOT%{_bindir}
106
107 cp -p %{SOURCE1} $RPM_BUILD_ROOT%{systemdunitdir}
108 cp -p %{SOURCE2} $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/%{name}
109
110 # Unbundle DroidSans.ttf
111 %{__rm} $RPM_BUILD_ROOT%{_datadir}/%{name}/www/styles/element{al,-light,-dark}/fonts/DroidSans.ttf
112 ln -s %{_fontsdir}/TTF/DroidSans.ttf \
113         $RPM_BUILD_ROOT%{_datadir}/%{name}/www/styles/elemental/fonts
114 ln -s %{_fontsdir}/TTF/DroidSans.ttf \
115         $RPM_BUILD_ROOT%{_datadir}/%{name}/www/styles/element-light/fonts
116 ln -s %{_fontsdir}/TTF/DroidSans.ttf \
117         $RPM_BUILD_ROOT%{_datadir}/%{name}/www/styles/element-dark/fonts
118
119 # OpenZWave Control Panel temp file
120 ln -s %{_sharedstatedir}/%{name}/ozwcp.poll.XXXXXX.xml \
121         $RPM_BUILD_ROOT%{_datadir}/%{name}/ozwcp.poll.XXXXXX.xml
122
123 %clean
124 rm -rf $RPM_BUILD_ROOT
125
126 %pre
127 %groupadd -g 342 domoticz
128 %useradd -u 342 -r -d %{_datadir} -s /bin/false -c "Domoticz Home Automation Server" -G dialout -g domoticz domoticz
129
130 %post
131 %systemd_post %{name}.service
132
133 %preun
134 %systemd_preun %{name}.service
135
136 %postun
137 if [ "$1" = "0" ]; then
138         %userremove mpd
139         %groupremove mpd
140 fi
141 %systemd_reload
142
143 %files
144 %defattr(644,root,root,755)
145 %doc License.txt README.md History.txt
146 %attr(755,root,root) %{_bindir}/%{name}
147 %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/%{name}
148 %{_datadir}/%{name}
149 %dir %attr(750,domoticz,domoticz) %{_sharedstatedir}/%{name}
150 %{systemdunitdir}/%{name}.service
This page took 0.084288 seconds and 3 git commands to generate.