From cb635f202d75849a38923a6b5c039e2508ec4be2 Mon Sep 17 00:00:00 2001 From: Rich Mattes Date: Sat, 10 Aug 2013 10:40:33 -0400 Subject: [PATCH] Initial import --- .gitignore | 1 + mosquitto.spec | 136 +++++++++++++++++++++++++++++++++++++++++++++++++ sources | 1 + 3 files changed, 138 insertions(+) create mode 100644 mosquitto.spec diff --git a/.gitignore b/.gitignore index e69de29..7b87d47 100644 --- a/.gitignore +++ b/.gitignore @@ -0,0 +1 @@ +/mosquitto-1.1.3.tar.gz diff --git a/mosquitto.spec b/mosquitto.spec new file mode 100644 index 0000000..5f4ab87 --- /dev/null +++ b/mosquitto.spec @@ -0,0 +1,136 @@ +Name: mosquitto +Version: 1.1.3 +Release: 3%{?dist} +Summary: An Open Source MQTT v3.1 Broker + +License: BSD +URL: http://mosquitto.org/ +Source0: http://mosquitto.org/files/source/%{name}-%{version}.tar.gz + +BuildRequires: openssl-devel +BuildRequires: tcp_wrappers-devel +BuildRequires: python2-devel +BuildRequires: python-setuptools +BuildRequires: uthash-devel + +Requires(pre): shadow-utils +Requires(post): systemd +Requires(preun): systemd +Requires(postun): systemd + +%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 devel +Requires: %{name}%{?_isa} = %{version}-%{release} +Summary: Development files for %{name} + +%description devel +Development headers and libraries for %{name} + +%package python +Requires: %{name} = %{version}-%{release} +BuildArch: noarch +Summary: Python bindings for %{name} + +%description python +Python bindings for %{name} + +%prep +%setup -q +# Remove bundled uthash.h +rm -r src/uthash.h +# Set the install prefix to /usr +sed -i "s|prefix=/usr/local|prefix=/usr|" config.mk + +%build +export CFLAGS="%{optflags}" +export LDFLAGS="%{__global_ldflags} -Wl,--as-needed" +make all %{?_smp_mflags} + +pushd lib/python +%{__python} setup.py build + +%install +%if "%{_lib}" == "lib64" +export LIB_SUFFIX=64 +%endif +%make_install + +pushd lib/python +%{__python} setup.py install --skip-build --root $RPM_BUILD_ROOT +popd + +rm -f $RPM_BUILD_ROOT%{_sysconfdir}/%{name}/*.example + +cat > mosquitto.service << FOE +[Unit] +Description=Mosquitto MQTTv3.1 Broker +Documentation=man:mosquitto.conf(5) man:mosquitto(8) + +[Service] +ExecStart=/usr/sbin/mosquitto -c /etc/mosquitto/mosquitto.conf +User=mosquitto +FOE + +mkdir -p $RPM_BUILD_ROOT%{_unitdir} +install -p -m 0644 %{name}.service $RPM_BUILD_ROOT%{_unitdir}/%{name}.service + +%check +#make test + +%pre +getent group %{name} >/dev/null || groupadd -r %{name} +getent passwd %{name} >/dev/null || \ + useradd -r -g %{name} -d %{_sysconfdir}/%{name} -s /sbin/nologin \ + -c "Mosquitto Broker" %{name} +exit 0 + +%post +%systemd_post %{name}.service +/sbin/ldconfig + +%preun +%systemd_preun %{name}.service + +%postun +%systemd_postun_with_restart %{name}.service +/sbin/ldconfig + +%files +%doc LICENSE.txt readme.txt *.example +%{_bindir}/* +%{_sbindir}/* +%{_libdir}/*.so.* +%dir %{_sysconfdir}/%{name} +%config(noreplace) %{_sysconfdir}/%{name}/%{name}.conf +%{_unitdir}/%{name}.service +%{_mandir}/man1/*.1.* +%{_mandir}/man5/*.5.* +%{_mandir}/man7/*.7.* +%{_mandir}/man8/*.8.* + +%files devel +%{_includedir}/*.h +%{_libdir}/*.so +%{_mandir}/man3/*.3.* + +%files python +%{python_sitelib}/%{name}* + +%changelog +* Sat Aug 10 2013 Rich Mattes - 1.1.3-3 +- Switch to Makefiles from CMake scripts +- Add User=mosquitto to systemd unit + +* Tue Jul 23 2013 Rich Mattes - 1.1.3-2 +- Unbundle uthash +- Add as-needed to ldflags to avoid spurious links + +* Wed May 1 2013 Rich Mattes - 1.1.3-1 +- Initial package diff --git a/sources b/sources index e69de29..a832082 100644 --- a/sources +++ b/sources @@ -0,0 +1 @@ +fd0cae17221d778b0a002c31e6c3de9e mosquitto-1.1.3.tar.gz