cb635f2
Name:           mosquitto
4a40b9a
Version:        1.2.3
db417d0
Release:        2%{?dist}
cb635f2
Summary:        An Open Source MQTT v3.1 Broker
cb635f2
cb635f2
License:        BSD
cb635f2
URL:            http://mosquitto.org/
cb635f2
Source0:        http://mosquitto.org/files/source/%{name}-%{version}.tar.gz
cb635f2
cb635f2
BuildRequires:  openssl-devel
cb635f2
BuildRequires:  tcp_wrappers-devel
cb635f2
BuildRequires:  python2-devel
cb635f2
BuildRequires:  python-setuptools
c815d7b
BuildRequires:  systemd
cb635f2
BuildRequires:  uthash-devel
cb635f2
cb635f2
Requires(pre):  shadow-utils
cb635f2
Requires(post): systemd
cb635f2
Requires(preun): systemd
cb635f2
Requires(postun): systemd
cb635f2
cb635f2
%description
cb635f2
Mosquitto is an open source (BSD licensed) message broker that implements the 
cb635f2
MQ Telemetry Transport protocol version 3.1. MQTT provides a lightweight 
cb635f2
method of carrying out messaging using a publish/subscribe model. This makes 
cb635f2
it suitable for "machine to machine" messaging such as with low power sensors 
cb635f2
or mobile devices such as phones, embedded computers or micro-controllers 
cb635f2
like the Arduino.
cb635f2
cb635f2
%package devel
cb635f2
Requires:     %{name}%{?_isa} = %{version}-%{release}
cb635f2
Summary:      Development files for %{name}
cb635f2
cb635f2
%description devel
cb635f2
Development headers and libraries for %{name}
cb635f2
cb635f2
%package python
cb635f2
Requires:    %{name} = %{version}-%{release}
cb635f2
BuildArch:   noarch
cb635f2
Summary:     Python bindings for %{name}
cb635f2
cb635f2
%description python
cb635f2
Python bindings for %{name}
cb635f2
cb635f2
%prep
cb635f2
%setup -q
cb635f2
# Remove bundled uthash.h
cb635f2
rm -r src/uthash.h
cb635f2
# Set the install prefix to /usr
cb635f2
sed -i "s|prefix=/usr/local|prefix=/usr|" config.mk
fb72ace
# Don't strip binaries on install: rpmbuild will take care of it
fb72ace
sed -i "s|(INSTALL) -s|(INSTALL)|g" lib/Makefile src/Makefile client/Makefile
cb635f2
cb635f2
%build
cb635f2
export CFLAGS="%{optflags}"
fb72ace
export LDFLAGS="%{optflags} %{__global_ldflags} -Wl,--as-needed"
cb635f2
make all %{?_smp_mflags}
cb635f2
cb635f2
pushd lib/python
8e44614
%{__python2} setup.py build
cb635f2
cb635f2
%install
cb635f2
%if "%{_lib}" == "lib64"
cb635f2
export LIB_SUFFIX=64
cb635f2
%endif
cb635f2
%make_install
cb635f2
cb635f2
pushd lib/python
8e44614
%{__python2} setup.py install --skip-build --root $RPM_BUILD_ROOT
cb635f2
popd
cb635f2
cb635f2
cat > mosquitto.service << FOE
cb635f2
[Unit]
cb635f2
Description=Mosquitto MQTTv3.1 Broker
cb635f2
Documentation=man:mosquitto.conf(5) man:mosquitto(8)
cb635f2
cb635f2
[Service]
d856329
ExecStart=/usr/sbin/mosquitto 
cb635f2
User=mosquitto
db417d0
db417d0
[Install]
db417d0
WantedBy=multi-user.target
cb635f2
FOE
cb635f2
cb635f2
mkdir -p $RPM_BUILD_ROOT%{_unitdir}
cb635f2
install -p -m 0644 %{name}.service $RPM_BUILD_ROOT%{_unitdir}/%{name}.service
cb635f2
cb635f2
%check
cb635f2
#make test
cb635f2
cb635f2
%pre
cb635f2
getent group %{name} >/dev/null || groupadd -r %{name}
cb635f2
getent passwd %{name} >/dev/null || \
cb635f2
    useradd -r -g %{name} -d %{_sysconfdir}/%{name} -s /sbin/nologin \
cb635f2
    -c "Mosquitto Broker" %{name}
cb635f2
exit 0
cb635f2
cb635f2
%post
cb635f2
%systemd_post %{name}.service
cb635f2
/sbin/ldconfig
cb635f2
cb635f2
%preun
cb635f2
%systemd_preun %{name}.service
cb635f2
cb635f2
%postun
cb635f2
%systemd_postun_with_restart %{name}.service
cb635f2
/sbin/ldconfig
cb635f2
cb635f2
%files
cb635f2
%doc LICENSE.txt readme.txt *.example
cb635f2
%{_bindir}/*
cb635f2
%{_sbindir}/*
cb635f2
%{_libdir}/*.so.*
cb635f2
%dir %{_sysconfdir}/%{name}
d856329
%config %{_sysconfdir}/%{name}/*.example
cb635f2
%{_unitdir}/%{name}.service
cb635f2
%{_mandir}/man1/*.1.*
cb635f2
%{_mandir}/man5/*.5.*
cb635f2
%{_mandir}/man7/*.7.*
cb635f2
%{_mandir}/man8/*.8.*
cb635f2
cb635f2
%files devel
cb635f2
%{_includedir}/*.h
cb635f2
%{_libdir}/*.so
cb635f2
%{_mandir}/man3/*.3.*
cb635f2
cb635f2
%files python
cb635f2
%{python_sitelib}/%{name}*
cb635f2
cb635f2
%changelog
db417d0
* Sat Dec 21 2013 Fabian Affolter <mail@fabian-affolter.ch> - 1.2.3-2
db417d0
- Add install section to service file
db417d0
4a40b9a
* Sat Dec 21 2013 Fabian Affolter <mail@fabian-affolter.ch> - 1.2.3-1
4a40b9a
- Update to latest upstream release 1.2.3
4a40b9a
d719061
* Mon Oct 28 2013 Fabian Affolter <mail@fabian-affolter.ch> - 1.2.2-1
d719061
- Update to latest upstream release 1.2.2
d719061
8420dd4
* Sat Sep 21 2013 Fabian Affolter <mail@fabian-affolter.ch> - 1.2.1-1
8420dd4
- Update to latest upstream release 1.2.1
8420dd4
d856329
* Wed Aug 14 2013 Rich Mattes <richmattes@gmail.com> - 1.2-1
d856329
- Update to release 1.2
d856329
cb635f2
* Sat Aug 10 2013 Rich Mattes <richmattes@gmail.com> - 1.1.3-3
cb635f2
- Switch to Makefiles from CMake scripts
cb635f2
- Add User=mosquitto to systemd unit
cb635f2
cb635f2
* Tue Jul 23 2013 Rich Mattes <richmattes@gmail.com> - 1.1.3-2
cb635f2
- Unbundle uthash
cb635f2
- Add as-needed to ldflags to avoid spurious links
cb635f2
cb635f2
* Wed May 1 2013 Rich Mattes <richmattes@gmail.com> - 1.1.3-1
cb635f2
- Initial package