!1 Package init

From: @zhengyaohui
Reviewed-by: @small_leek
Signed-off-by: @small_leek
This commit is contained in:
openeuler-ci-bot 2021-09-13 08:37:21 +00:00 committed by Gitee
commit 474a5a96a0
2 changed files with 91 additions and 0 deletions

BIN
mosquitto-1.6.15.tar.gz Normal file

Binary file not shown.

91
mosquitto.spec Normal file
View File

@ -0,0 +1,91 @@
Name: mosquitto
Version: 1.6.15
Release: 1
Summary: Open Source MQTT v3.1/v3.1.1 Broker
License: BSD
URL: http://mosquitto.org/
Source0: http://mosquitto.org/files/source/%{name}-%{version}.tar.gz
BuildRequires: c-ares-devel gcc-c++ libuuid-devel libwebsockets-devel openssl-devel
BuildRequires: systemd-devel
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
* Tue Sep 7 2021 zhengyaohui <zhengyaohui1@huawei.com> - 1.6.15-1
- package init