# distribution specific definitions %define bdir %{_builddir}/%{name}-%{version} %define dotests 0 %if 0%{?rhel}%{?fedora} BuildRequires: gcc %if 0%{?amzn2} BuildRequires: openssl11-devel %else BuildRequires: openssl-devel %endif %endif %if 0%{?rhel} %if 0%{?amzn} == 0 %define dist .el%{?rhel} %endif %endif %if 0%{?suse_version} >= 1315 BuildRequires: libopenssl-devel %endif %define CC_OPT %{optflags} -fPIC %define LD_OPT -Wl,-z,relro -Wl,-z,now -pie %define CONFIGURE_ARGS $(echo "%%CONFIGURE_ARGS%%") Provides: nginx-unit Name: unit Summary: NGINX Unit Version: %%VERSION%% Release: %%RELEASE%%%{?dist}.ngx License: ASL 2.0 Vendor: %%PACKAGE_VENDOR%% URL: https://unit.nginx.org/ Group: System Environment/Daemons Source0: unit-%{version}.tar.gz Source1: unit.service Source2: unit-debug.service Source3: unit.example.config Source4: unit.logrotate BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) BuildRequires: systemd Requires(post): systemd Requires(preun): systemd Requires(postun): systemd BuildRequires: pcre2-devel %description NGINX Unit is a runtime and delivery environment for modern distributed applications. It runs the application code in multiple languages (PHP, Python, Go, etc.), and tightly couples it with traffic delivery in and out of the application. Take this application server and proxy directly in the cloud / container environments and fully control your app dynamically via an API. %if 0%{?suse_version} %debug_package %endif %if (0%{?fedora}) || (0%{?rhel} >= 8) %define _debugsource_template %{nil} %endif %package devel Summary: NGINX Unit (development files) Version: %%VERSION%% Release: %%RELEASE%%%{?dist}.ngx Group: Development/Libraries Requires: unit == %%VERSION%%-%%RELEASE%%%{?dist}.ngx %description devel Library and include files required for NGINX Unit modules development. %prep %setup -q %build ./configure \ %{CONFIGURE_ARGS} \ --modules=%{_libdir}/unit/debug-modules \ --libdir=%{_libdir} \ --cc-opt="%{CC_OPT}" \ --ld-opt="%{LD_OPT}" \ --debug %{__make} %{?_smp_mflags} %{__make} %{?_smp_mflags} build/libunit.a %{__mv} build build-debug ./configure \ %{CONFIGURE_ARGS} \ --modules=%{_libdir}/unit/modules \ --libdir=%{_libdir} \ --cc-opt="%{CC_OPT}" \ --ld-opt="%{LD_OPT}" %{__make} %{?_smp_mflags} %{__mv} build build-nodebug %install %{__rm} -rf %{buildroot} %{__ln_s} build-nodebug build DESTDIR=%{buildroot} make unitd-install libunit-install manpage-install %{__install} -m755 %{bdir}/build-debug/unitd \ %{buildroot}%{_sbindir}/unitd-debug %{__install} -m644 %{bdir}/build-debug/libunit.a \ %{buildroot}%{_libdir}/libunit-debug.a %{__mkdir} -p %{buildroot}%{_libdir}/unit/modules %{__mkdir} -p %{buildroot}%{_libdir}/unit/debug-modules %{__mkdir} -p %{buildroot}%{_sharedstatedir}/unit %{__mkdir} -p %{buildroot}%{_localstatedir}/log/unit %{__mkdir} -p %{buildroot}%{_localstatedir}/run/unit %{__mkdir} -p %{buildroot}%{_sysconfdir}/logrotate.d %{__install} -m 644 -p %{SOURCE4} \ %{buildroot}%{_sysconfdir}/logrotate.d/unit %{__mkdir} -p %{buildroot}%{_sysconfdir}/unit %{__mkdir} -p %{buildroot}%{_datadir}/doc/unit/examples %{__install} -m 644 -p %{SOURCE3} \ %{buildroot}%{_datadir}/doc/unit/examples/example.config %{__install} -m 644 -p CHANGES \ %{buildroot}%{_datadir}/doc/unit/ %{__install} -m 644 -p NOTICE \ %{buildroot}%{_datadir}/doc/unit/COPYRIGHT %{__install} -m 644 -p README.md \ %{buildroot}%{_datadir}/doc/unit/ %{__install} -m 644 -p CONTRIBUTING.md \ %{buildroot}%{_datadir}/doc/unit/ %{__rm} -rf %{buildroot}%{_initrddir}/ %{__install} -p -D -m 0644 %{SOURCE1} %{buildroot}%{_unitdir}/unit.service %{__install} -p -D -m 0644 %{SOURCE2} %{buildroot}%{_unitdir}/unit-debug.service QA_SKIP_BUILD_ROOT=1 export QA_SKIP_BUILD_ROOT %check %if %{dotests} cd %{bdir} && make tests && ./build/tests %endif %{__rm} -rf %{buildroot}/usr/src cd %{bdir} grep -v 'usr/src' debugfiles.list > debugfiles.list.new && mv debugfiles.list.new debugfiles.list cat /dev/null > debugsources.list %if 0%{?suse_version} >= 1500 cat /dev/null > debugsourcefiles.list %endif %clean %{__rm} -rf %{buildroot} %post getent group unit >/dev/null || groupadd -r unit getent passwd unit >/dev/null || \ useradd -r -g unit -s /sbin/nologin \ -d /nonexistent -c "unit user" unit if [ $1 -eq 1 ]; then /usr/bin/systemctl preset unit.service >/dev/null 2>&1 ||: /usr/bin/systemctl preset unit-debug.service >/dev/null 2>&1 ||: cat </dev/null 2>&1 ||: /usr/bin/systemctl stop unit.service >/dev/null 2>&1 ||: fi %postun /usr/bin/systemctl daemon-reload >/dev/null 2>&1 ||: if [ $1 -ge 1 ]; then /usr/bin/systemctl try-restart unit.service >/dev/null 2>&1 ||: fi %triggerpostun -- unit < 1.22.0 cat <