# If run as a non-root user, this setting has no effect.
# Note that on Windows this has no effect and so mosquitto should
# be started by the user you wish it to run as.
-#user mosquitto
+user root
# =================================================================
# Default listener
# subscriptions, currently in-flight messages and retained
# messages.
# retained_persistence is a synonym for this option.
-#persistence false
+persistence false
# The filename to use for the persistent database, not including
# the path.
# username/password or TLS-PSK checks, then `allow_anonymous` defaults to
# false.
#
-#allow_anonymous true
+allow_anonymous true
# -----------------------------------------------------------------
# Default authentication and topic access control
--- /dev/null
+Name: mosquitto
+Summary: MQTT version 5.0/3.1.1/3.1 compatible message broker
+Version: 1.6.8
+Release: 1
+Group: Network & Connectivity/Other
+License: EPL-1.0 and EDL-1.0
+Source0: %{name}-%{version}.tar.gz
+Source1001: %{name}.manifest
+Source1002: %{name}.service
+
+BuildRequires: pkgconfig(libcares)
+BuildRequires: pkgconfig(openssl1.1)
+BuildRequires: pkgconfig(libwebsockets)
+BuildRequires: systemd-devel
+
+Requires(post): /sbin/ldconfig
+Requires(postun): /sbin/ldconfig
+
+%description
+This is a message broker that supports version 5.0, 3.1 and 3.1.1 of the MQTT
+protocol.
+
+MQTT provides a method of carrying out messaging using a publish/subscribe
+model. It is lightweight, both in terms of bandwidth usage and ease of
+implementation. This makes it particularly useful at the edge of the network
+where a sensor or other simple device may be implemented using an arduino for
+example.
+
+%package devel
+Summary: Development files for Mosquitto
+Group: Development/Libraries
+
+%description devel
+Development headers and libraries for %{name}
+
+%prep
+%setup -q
+cp %{SOURCE1001} ./%{name}.manifest
+
+%build
+export CFLAGS+=" -Wno-error=shadow -Wno-error=sign-compare -Wno-error=format="
+make all %{?_smp_mflags}
+
+%install
+%if "%{_lib}" == "lib64"
+export LIB_SUFFIX=64
+%endif
+%make_install
+
+mkdir -p %{buildroot}%{_unitdir}
+install -p -m 0644 %{SOURCE1002} %{buildroot}%{_unitdir}/%{name}.service
+%install_service multi-user.target.wants %{name}.service
+mv %{buildroot}%{_sysconfdir}/%{name}/%{name}.conf.example %{buildroot}%{_sysconfdir}/%{name}/%{name}.conf
+
+%post
+
+%files
+%manifest %{name}.manifest
+%license LICENSE.txt epl-v10 edl-v10
+%{_bindir}/%{name}*
+%{_sbindir}/%{name}
+%{_libdir}/*.so.*
+%dir %{_sysconfdir}/%{name}
+%config(noreplace) %{_sysconfdir}/%{name}/%{name}.conf
+%config %{_sysconfdir}/%{name}/*.example
+%{_unitdir}/%{name}.service
+%{_unitdir}/multi-user.target.wants/%{name}.service
+
+%files devel
+%license LICENSE.txt epl-v10 edl-v10
+%{_includedir}/*.h
+%{_libdir}/*.so
+%{_libdir}/pkgconfig/*.pc