summaryrefslogtreecommitdiff
path: root/mosquitto.spec
blob: c7dd27b46f180090989dab3847b53b9737282c76 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
# TODO
# - initscript
Summary:	An Open Source MQTT v3.1 Broker
Name:		mosquitto
Version:	1.1.3
Release:	0.1
License:	BSD
Group:		Applications
Source0:	http://mosquitto.org/files/source/%{name}-%{version}.tar.gz
# Source0-md5:	fd0cae17221d778b0a002c31e6c3de9e
URL:		http://mosquitto.org/
BuildRequires:	cmake
BuildRequires:	libstdc++-devel
BuildRequires:	libwrap-devel
BuildRequires:	openssl-devel
BuildRequires:	python-devel
BuildRequires:	python-setuptools
BuildRequires:	rpmbuild(macros) >= 1.219
BuildRequires:	sqlite3-devel >= 3.5
Requires(postun):	/usr/sbin/groupdel
Requires(postun):	/usr/sbin/userdel
Requires(pre):	/bin/id
Requires(pre):	/usr/bin/getgid
Requires(pre):	/usr/sbin/groupadd
Requires(pre):	/usr/sbin/useradd
Provides:	group(mosquitto)
Provides:	user(mosquitto)
BuildRoot:	%{tmpdir}/%{name}-%{version}-root-%(id -u -n)

%description
Mosquitto is an open source (BSD licensed) message broker that
implements the MQ Telemetry Transport protocol version 3.1. MQTT
provides a lightweight method of carrying out messaging using a
publish/subscribe model. This makes it suitable for "machine to
machine" messaging such as with low power sensors or mobile devices
such as phones, embedded computers or micro-controllers like the
Arduino.

%package clients
Summary:	Mosquitto command line pub/sub clients
Group:		Applications/Networking
Requires:	libmosquitto = %{version}-%{release}

%description clients
This is two MQTT version 3 clients. The first can publish messages to
a broker, the second can subscribe to multiple topics on a broker.

%package -n libmosquitto
Summary:	MQTT C client library
Group:		Development/Libraries

%description -n libmosquitto
This is a library that provides a means of implementing MQTT version 3
clients. MQTT provides a lightweight method of carrying out messaging
using a publish/subscribe model.

%package -n libmosquitto-devel
Summary:	MQTT C client library development files
Group:		Development/Libraries
Group:		Development/Libraries
Requires:	libmosquitto = %{version}-%{release}

%description -n libmosquitto-devel
This is a library that provides a means of implementing MQTT version 3
clients. MQTT provides a lightweight method of carrying out messaging
using a publish/subscribe model.

%package -n libmosquittopp
Summary:	MQTT C++ client library
Group:		Development/Libraries

%description -n libmosquittopp
This is a library that provides a means of implementing MQTT version 3
clients. MQTT provides a lightweight method of carrying out messaging
using a publish/subscribe model.

%package -n libmosquittopp-devel
Summary:	MQTT C++ client library development files
Group:		Development/Libraries
Requires:	libmosquittopp = %{version}-%{release}

%description -n libmosquittopp-devel
This is a library that provides a means of implementing MQTT version 3
clients. MQTT provides a lightweight method of carrying out messaging
using a publish/subscribe model.

%package -n python-%{name}
Summary:	MQTT Python client library
Group:		Development/Languages/Python
Requires:	%{name} = %{version}-%{release}
%if "%{_rpmversion}" >= "5"
BuildArch:	noarch
%endif

%description -n python-%{name}
This is a library that provides a means of implementing MQTT version 3
clients. MQTT provides a lightweight method of carrying out messaging
using a publish/subscribe model.

%prep
%setup -q

%build
install -d build
cd build
%cmake \
	-DUSE_LIBWRAP:BOOL=ON \
	..
%{__make}
cd ..

cd lib/python
%{__python} setup.py build

%install
rm -rf $RPM_BUILD_ROOT
%{__make} -C build install \
	DESTDIR=$RPM_BUILD_ROOT

rm $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/*.example

cd lib/python
%{__python} setup.py install \
	--skip-build \
	--optimize=2 \
	--root $RPM_BUILD_ROOT

%py_postclean

%clean
rm -rf $RPM_BUILD_ROOT

%pre
%groupadd -g 293 -r mosquitto
%useradd -u 293 -r -g mosquitto -d %{_sysconfdir}/%{name} -s /sbin/nologin -c "Mosquitto Broker" mosquitto

if [ "$1" = "0" ]; then
	%userremove mosquitto
	%groupremove mosquitto
fi

%post	-n libmosquitto -p /sbin/ldconfig
%postun	-n libmosquitto -p /sbin/ldconfig

%post	-n libmosquittopp -p /sbin/ldconfig
%postun	-n libmosquittopp -p /sbin/ldconfig

%files
%defattr(644,root,root,755)
%doc LICENSE.txt readme.txt *.example
%dir %{_sysconfdir}/%{name}
%config(noreplace) %verify(not md5 mtime size) %{_sysconfdir}/%{name}/%{name}.conf
%attr(755,root,root) %{_bindir}/mosquitto_passwd
%attr(755,root,root) %{_sbindir}/mosquitto
%{_mandir}/man1/mosquitto_passwd.1*
%{_mandir}/man5/mosquitto.conf.5*
%{_mandir}/man7/mosquitto-tls.7*
%{_mandir}/man7/mqtt.7*
%{_mandir}/man8/mosquitto.8*

%files clients
%defattr(644,root,root,755)
%attr(755,root,root) %{_bindir}/mosquitto_pub
%attr(755,root,root) %{_bindir}/mosquitto_sub
%{_mandir}/man1/mosquitto_pub.1*
%{_mandir}/man1/mosquitto_sub.1*

%files -n libmosquitto
%defattr(644,root,root,755)
%attr(755,root,root) %{_libdir}/libmosquitto.so.*.*.*
%ghost %{_libdir}/libmosquitto.so.1

%files -n libmosquitto-devel
%defattr(644,root,root,755)
%{_mandir}/man3/libmosquitto.3*
%{_libdir}/libmosquitto.so
%{_includedir}/mosquitto.h
%{_includedir}/mosquitto_plugin.h

%files -n libmosquittopp
%defattr(644,root,root,755)
%attr(755,root,root) %{_libdir}/libmosquittopp.so.*.*.*
%ghost %{_libdir}/libmosquittopp.so.1

%files -n libmosquittopp-devel
%defattr(644,root,root,755)
%{_libdir}/libmosquittopp.so
%{_includedir}/mosquittopp.h

%files -n python-%{name}
%defattr(644,root,root,755)
%{py_sitescriptdir}/mosquitto.py[co]
%{py_sitescriptdir}/mosquitto-%{version}-*.egg-info