mosquitto/mosquitto.spec
2023-05-10 15:47:34 +08:00

116 lines
3.4 KiB
RPMSpec

Name: mosquitto
Version: 2.0.15
Release: 1
Summary: Open Source MQTT v3.1/v3.1.1 Broker
License: EPL-1.0
URL: http://mosquitto.org/
Source0: http://mosquitto.org/files/source/%{name}-%{version}.tar.gz
Patch0001: add-usage-output.patch
Patch0002: fix-usage-exit-code.patch
BuildRequires: c-ares-devel gcc-c++ libuuid-devel libwebsockets-devel openssl-devel
BuildRequires: systemd-devel cjson-devel
BuildRequires: make
Provides: bundled(uthash)
Requires(pre): shadow-utils
Requires(post): systemd
Requires(preun): systemd
Requires(postun): systemd
%description
Mosquitto is an open source message broker that implements the MQ Telemetry
Transport protocol version 3.1 and 3.1.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} = %{version}-%{release}
Summary: Development files for %{name}
%description devel
Development headers and libraries for %{name}
%prep
%autosetup -p1
sed -i "s|prefix?=/usr/local|prefix?=/usr|" config.mk
sed -i "s|(INSTALL) -s|(INSTALL)|g" lib/Makefile src/Makefile client/Makefile
%build
export CFLAGS="%{optflags}"
export LDFLAGS="%{optflags} %{__global_ldflags} -Wl,--as-needed"
make all %{?_smp_mflags} WITH_WEBSOCKETS=yes WITH_SYSTEMD=yes
%install
%if "%{_lib}" == "lib64"
export LIB_SUFFIX=64
%endif
%make_install
mkdir -p %{buildroot}%{_unitdir}
install -p -m 0644 service/systemd/%{name}.service.notify %{buildroot}%{_unitdir}/%{name}.service
mv %{buildroot}%{_sysconfdir}/%{name}/%{name}.conf.example %{buildroot}%{_sysconfdir}/%{name}/%{name}.conf
%check
%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
%license LICENSE.txt
%doc ChangeLog.txt CONTRIBUTING.md README.md
%{_bindir}/*
%{_sbindir}/*
%{_libdir}/*.so.*
%dir %{_sysconfdir}/%{name}
%config(noreplace) %{_sysconfdir}/%{name}/%{name}.conf
%config%{_sysconfdir}/%{name}/*.example
%{_unitdir}/%{name}.service
%{_mandir}/man1/*.1.*
%{_mandir}/man5/*.5.*
%{_mandir}/man7/*.7.*
%{_mandir}/man8/*.8.*
%files devel
%{_includedir}/*.h
%{_libdir}/*.so
%{_libdir}/pkgconfig/*.pc
%{_mandir}/man3/*.3.*
%changelog
* Wed May 10 2023 Ge Wang <wang__ge@126.com> - 2.0.15-1
- Update to version 2.0.15
* Mon May 9 2022 caodongxia <caodongxia@h-partners.com> - 1.6.15-7
- License compliance rectification
* Thu Feb 24 2022 yaoxin <yaoxin30@huawei.com> - 1.6.15-6
- Fix CVE-2021-34432 and modify the CVE-2021-41039.patch.
* Thu Dec 30 2021 houyingchao <houyingchao@huawei.com> - 1.6.15-5
- Fix CVE-2021-41039
* Thu Sep 30 2021 lingsheng <lingsheng@huawei.com> - 1.6.15-4
- fix usage exit code
* Thu Sep 30 2021 lingsheng <lingsheng@huawei.com> - 1.6.15-3
- add usage output
* Tue Sep 24 2021 zhengyaohui <zhengyaohui1@huawei.com> - 1.6.15-2
- add buildrequires make
* Tue Sep 7 2021 zhengyaohui <zhengyaohui1@huawei.com> - 1.6.15-1
- package init