]> git.pld-linux.org Git - packages/domoticz.git/blame - domoticz.spec
macros for %systemd*
[packages/domoticz.git] / domoticz.spec
CommitLineData
9dda6696
AM
1Summary: Open source Home Automation System
2Name: domoticz
72784cf7 3Version: 2020.2
0abc31de 4Release: 3
9dda6696
AM
5License: GPLv3+ and ASL 2.0 and Boost and BSD and MIT
6Group: Base
7URL: http://www.domoticz.com
72784cf7
AM
8Source0: https://github.com/domoticz/domoticz/archive/%{version}.tar.gz
9# Source0-md5: fd383a13d13d0976c72f332d6db1d24e
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# Use system openzwave includes
bc226567 15Patch1: %{name}-openzwave.patch
9dda6696 16# Fix python detection (https://github.com/domoticz/domoticz/pull/1749)
bc226567
JP
17Patch2: %{name}-python.patch
18Patch3: no-git.patch
19Patch4: boost-1.73.patch
c8cb4cfe 20Patch5: %{name}-gpio.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
4987f952
JP
28BuildRequires: libstdc++-devel >= 6:4.8.1
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
4987f952 46Requires: libopenzwave >= 1.5.0
ed4fe787
JP
47Provides: group(domoticz)
48Provides: user(domoticz)
9dda6696
AM
49
50%description
51Domoticz is a Home Automation System that lets you monitor and
52configure various devices like: Lights, Switches, various
53sensors/meters like Temperature, Rain, Wind, UV, Electra, Gas, Water
54and much more. Notifications/Alerts can be sent to any mobile device
55
56%prep
72784cf7 57%setup -q
bc226567
JP
58%patch0 -p1
59%patch1 -p1
60%patch2 -p1
61%patch3 -p1
62%patch4 -p1
c8cb4cfe 63%patch5 -p1
10f7a92e
AM
64
65APPVERSION="%{version}"
66echo "#define APPVERSION ${APPVERSION##*.}" > appversion.h
67echo '#define APPHASH "%{snap}"' >> appversion.h
68APPDATE=$(date --date="%{date}" "+%s")
69echo "#define APPDATE ${APPDATE}" >> appversion.h
70
0e22aa87 71%{__rm} -r extern tinyxpath
9dda6696
AM
72
73%build
74install -d build && cd build
75%cmake \
4987f952
JP
76 -DUSE_BUILTIN_JSONCPP=NO \
77 -DUSE_BUILTIN_MINIZIP=NO \
71593ba7
JR
78 -DUSE_BUILTIN_MQTT=NO \
79 -DUSE_BUILTIN_SQLITE=NO \
80 -DUSE_BUILTIN_TINYXPATH=NO \
4987f952
JP
81 -DUSE_LUA_STATIC=NO \
82 -DUSE_OPENSSL_STATIC=NO \
71593ba7 83 -DUSE_STATIC_BOOST=NO \
4987f952
JP
84 -DUSE_STATIC_LIBSTDCXX=NO \
85 -DUSE_STATIC_OPENZWAVE=NO \
71593ba7
JR
86 -DCMAKE_INSTALL_PREFIX=%{_datadir}/%{name} \
87 ..
00bce45c 88
9dda6696
AM
89%{__make}
90
91%install
92rm -rf $RPM_BUILD_ROOT
0e22aa87 93
00bce45c 94%{__make} -C build install \
0e22aa87
JP
95 DESTDIR=$RPM_BUILD_ROOT
96
97install -d $RPM_BUILD_ROOT{%{_bindir},%{_sysconfdir}/sysconfig,%{systemdunitdir},%{_sharedstatedir}/%{name}}
9dda6696
AM
98
99# remove docs, we grab them in files below
0e22aa87 100%{__rm} $RPM_BUILD_ROOT%{_datadir}/%{name}/*.txt
9dda6696
AM
101
102# move binary to standard directory
0e22aa87 103mv $RPM_BUILD_ROOT%{_datadir}/%{name}/%{name} $RPM_BUILD_ROOT%{_bindir}
9dda6696 104
0e22aa87 105cp -p %{SOURCE1} $RPM_BUILD_ROOT%{systemdunitdir}
9dda6696
AM
106cp -p %{SOURCE2} $RPM_BUILD_ROOT%{_sysconfdir}/sysconfig/%{name}
107
9dda6696 108# Unbundle DroidSans.ttf
0e22aa87
JP
109%{__rm} $RPM_BUILD_ROOT%{_datadir}/%{name}/www/styles/element{al,-light,-dark}/fonts/DroidSans.ttf
110ln -s %{_fontsdir}/TTF/DroidSans.ttf \
111 $RPM_BUILD_ROOT%{_datadir}/%{name}/www/styles/elemental/fonts
112ln -s %{_fontsdir}/TTF/DroidSans.ttf \
113 $RPM_BUILD_ROOT%{_datadir}/%{name}/www/styles/element-light/fonts
114ln -s %{_fontsdir}/TTF/DroidSans.ttf \
115 $RPM_BUILD_ROOT%{_datadir}/%{name}/www/styles/element-dark/fonts
9dda6696
AM
116
117# OpenZWave Control Panel temp file
118ln -s %{_sharedstatedir}/%{name}/ozwcp.poll.XXXXXX.xml \
0e22aa87 119 $RPM_BUILD_ROOT%{_datadir}/%{name}/ozwcp.poll.XXXXXX.xml
9dda6696
AM
120
121%clean
122rm -rf $RPM_BUILD_ROOT
123
124%pre
ed4fe787
JP
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
9dda6696
AM
127
128%post
129%systemd_post %{name}.service
130
131%preun
132%systemd_preun %{name}.service
133
134%postun
ed4fe787
JP
135if [ "$1" = "0" ]; then
136 %userremove mpd
137 %groupremove mpd
138fi
5ac2f181 139%systemd_reload
9dda6696
AM
140
141%files
142%defattr(644,root,root,755)
0e22aa87 143%doc License.txt README.md History.txt
9dda6696
AM
144%attr(755,root,root) %{_bindir}/%{name}
145%config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/%{name}
0e22aa87
JP
146%{_datadir}/%{name}
147%dir %attr(750,domoticz,domoticz) %{_sharedstatedir}/%{name}
9dda6696 148%{systemdunitdir}/%{name}.service
This page took 0.126025 seconds and 4 git commands to generate.