1372Sdefan@nginx.com# distribution specific definitions 2372Sdefan@nginx.com%define bdir %{_builddir}/%{name}-%{version} 3372Sdefan@nginx.com%define dotests 0 4372Sdefan@nginx.com 5911Sremi@remirepo.net%if 0%{?rhel}%{?fedora} 6911Sremi@remirepo.netBuildRequires: gcc 71849Sthresh@nginx.com%if 0%{?amzn2} 81849Sthresh@nginx.comBuildRequires: openssl11-devel 91849Sthresh@nginx.com%else 10778Sdefan@nginx.comBuildRequires: openssl-devel 11372Sdefan@nginx.com%endif 121849Sthresh@nginx.com%endif 13372Sdefan@nginx.com 14911Sremi@remirepo.net%if 0%{?rhel} 15490Sdefan@nginx.com%if 0%{?amzn} == 0 16911Sremi@remirepo.net%define dist .el%{?rhel} 17372Sdefan@nginx.com%endif 18490Sdefan@nginx.com%endif 19372Sdefan@nginx.com 20778Sdefan@nginx.com%if 0%{?suse_version} >= 1315 21778Sdefan@nginx.comBuildRequires: libopenssl-devel 22372Sdefan@nginx.com%endif 23372Sdefan@nginx.com 24443Sdefan@nginx.com%define CC_OPT %{optflags} -fPIC 25443Sdefan@nginx.com%define LD_OPT -Wl,-z,relro -Wl,-z,now -pie 26443Sdefan@nginx.com 27372Sdefan@nginx.com%define CONFIGURE_ARGS $(echo "%%CONFIGURE_ARGS%%") 28372Sdefan@nginx.com 29372Sdefan@nginx.comProvides: nginx-unit 30372Sdefan@nginx.com 31372Sdefan@nginx.comName: unit 32372Sdefan@nginx.comSummary: NGINX Unit 33372Sdefan@nginx.comVersion: %%VERSION%% 34372Sdefan@nginx.comRelease: %%RELEASE%%%{?dist}.ngx 35372Sdefan@nginx.comLicense: ASL 2.0 361853Sdefan@nginx.comVendor: %%PACKAGE_VENDOR%% 37372Sdefan@nginx.comURL: https://unit.nginx.org/ 38372Sdefan@nginx.comGroup: System Environment/Daemons 39372Sdefan@nginx.com 40372Sdefan@nginx.comSource0: unit-%{version}.tar.gz 41372Sdefan@nginx.comSource1: unit.service 422027Sdefan@nginx.comSource2: unit-debug.service 432027Sdefan@nginx.comSource3: unit.example.config 442027Sdefan@nginx.comSource4: unit.logrotate 45372Sdefan@nginx.com 46372Sdefan@nginx.comBuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) 471751Sthresh@nginx.comBuildRequires: systemd 481751Sthresh@nginx.comRequires(post): systemd 491751Sthresh@nginx.comRequires(preun): systemd 501751Sthresh@nginx.comRequires(postun): systemd 51372Sdefan@nginx.com 521752Sthresh@nginx.comBuildRequires: pcre2-devel 531752Sthresh@nginx.com 54372Sdefan@nginx.com%description 55372Sdefan@nginx.comNGINX Unit is a runtime and delivery environment for modern distributed 56372Sdefan@nginx.comapplications. It runs the application code in multiple languages 57372Sdefan@nginx.com(PHP, Python, Go, etc.), and tightly couples it with traffic delivery 58372Sdefan@nginx.comin and out of the application. Take this application server and proxy 59372Sdefan@nginx.comdirectly in the cloud / container environments and fully control your app 60372Sdefan@nginx.comdynamically via an API. 61372Sdefan@nginx.com 62372Sdefan@nginx.com%if 0%{?suse_version} 63372Sdefan@nginx.com%debug_package 64372Sdefan@nginx.com%endif 65372Sdefan@nginx.com 661016Sdefan@nginx.com%if (0%{?fedora}) || (0%{?rhel} >= 8) 67913Sdefan@nginx.com%define _debugsource_template %{nil} 68913Sdefan@nginx.com%endif 69913Sdefan@nginx.com 70815Sdefan@nginx.com%package devel 71815Sdefan@nginx.comSummary: NGINX Unit (development files) 72815Sdefan@nginx.comVersion: %%VERSION%% 73815Sdefan@nginx.comRelease: %%RELEASE%%%{?dist}.ngx 74815Sdefan@nginx.comGroup: Development/Libraries 75859Sdefan@nginx.comRequires: unit == %%VERSION%%-%%RELEASE%%%{?dist}.ngx 76815Sdefan@nginx.com%description devel 77815Sdefan@nginx.comLibrary and include files required for NGINX Unit modules development. 78815Sdefan@nginx.com 79372Sdefan@nginx.com%prep 80372Sdefan@nginx.com%setup -q 81372Sdefan@nginx.com 82372Sdefan@nginx.com%build 83372Sdefan@nginx.com./configure \ 84372Sdefan@nginx.com %{CONFIGURE_ARGS} \ 85372Sdefan@nginx.com --modules=%{_libdir}/unit/debug-modules \ 86815Sdefan@nginx.com --libdir=%{_libdir} \ 87443Sdefan@nginx.com --cc-opt="%{CC_OPT}" \ 88443Sdefan@nginx.com --ld-opt="%{LD_OPT}" \ 89372Sdefan@nginx.com --debug 90372Sdefan@nginx.com%{__make} %{?_smp_mflags} 91815Sdefan@nginx.com%{__make} %{?_smp_mflags} build/libunit.a 92372Sdefan@nginx.com%{__mv} build build-debug 93372Sdefan@nginx.com./configure \ 94372Sdefan@nginx.com %{CONFIGURE_ARGS} \ 95443Sdefan@nginx.com --modules=%{_libdir}/unit/modules \ 96815Sdefan@nginx.com --libdir=%{_libdir} \ 97443Sdefan@nginx.com --cc-opt="%{CC_OPT}" \ 98443Sdefan@nginx.com --ld-opt="%{LD_OPT}" 99372Sdefan@nginx.com%{__make} %{?_smp_mflags} 100500Sdefan@nginx.com%{__mv} build build-nodebug 101372Sdefan@nginx.com 102372Sdefan@nginx.com%install 103372Sdefan@nginx.com%{__rm} -rf %{buildroot} 104500Sdefan@nginx.com%{__ln_s} build-nodebug build 1051827Sthresh@nginx.comDESTDIR=%{buildroot} make unitd-install libunit-install manpage-install 106372Sdefan@nginx.com%{__install} -m755 %{bdir}/build-debug/unitd \ 107372Sdefan@nginx.com %{buildroot}%{_sbindir}/unitd-debug 108815Sdefan@nginx.com%{__install} -m644 %{bdir}/build-debug/libunit.a \ 109815Sdefan@nginx.com %{buildroot}%{_libdir}/libunit-debug.a 110372Sdefan@nginx.com%{__mkdir} -p %{buildroot}%{_libdir}/unit/modules 111372Sdefan@nginx.com%{__mkdir} -p %{buildroot}%{_libdir}/unit/debug-modules 112372Sdefan@nginx.com%{__mkdir} -p %{buildroot}%{_sharedstatedir}/unit 113911Sremi@remirepo.net%{__mkdir} -p %{buildroot}%{_localstatedir}/log/unit 114911Sremi@remirepo.net%{__mkdir} -p %{buildroot}%{_localstatedir}/run/unit 1151751Sthresh@nginx.com%{__mkdir} -p %{buildroot}%{_sysconfdir}/logrotate.d 1162027Sdefan@nginx.com%{__install} -m 644 -p %{SOURCE4} \ 117911Sremi@remirepo.net %{buildroot}%{_sysconfdir}/logrotate.d/unit 118372Sdefan@nginx.com%{__mkdir} -p %{buildroot}%{_datadir}/doc/unit/examples 1192027Sdefan@nginx.com%{__install} -m 644 -p %{SOURCE3} \ 120372Sdefan@nginx.com %{buildroot}%{_datadir}/doc/unit/examples/example.config 121372Sdefan@nginx.com%{__install} -m 644 -p CHANGES \ 122372Sdefan@nginx.com %{buildroot}%{_datadir}/doc/unit/ 123372Sdefan@nginx.com%{__install} -m 644 -p NOTICE \ 124372Sdefan@nginx.com %{buildroot}%{_datadir}/doc/unit/COPYRIGHT 125*2103Sthresh@nginx.com%{__install} -m 644 -p README.md \ 126*2103Sthresh@nginx.com %{buildroot}%{_datadir}/doc/unit/ 127*2103Sthresh@nginx.com%{__install} -m 644 -p CONTRIBUTING.md \ 128372Sdefan@nginx.com %{buildroot}%{_datadir}/doc/unit/ 129372Sdefan@nginx.com 130372Sdefan@nginx.com%{__rm} -rf %{buildroot}%{_initrddir}/ 131372Sdefan@nginx.com%{__install} -p -D -m 0644 %{SOURCE1} %{buildroot}%{_unitdir}/unit.service 1322027Sdefan@nginx.com%{__install} -p -D -m 0644 %{SOURCE2} %{buildroot}%{_unitdir}/unit-debug.service 133372Sdefan@nginx.com 134372Sdefan@nginx.comQA_SKIP_BUILD_ROOT=1 135372Sdefan@nginx.comexport QA_SKIP_BUILD_ROOT 136372Sdefan@nginx.com 137372Sdefan@nginx.com%check 138372Sdefan@nginx.com%if %{dotests} 139372Sdefan@nginx.comcd %{bdir} && make tests && ./build/tests 140372Sdefan@nginx.com%endif 141913Sdefan@nginx.com%{__rm} -rf %{buildroot}/usr/src 142913Sdefan@nginx.comcd %{bdir} 143913Sdefan@nginx.comgrep -v 'usr/src' debugfiles.list > debugfiles.list.new && mv debugfiles.list.new debugfiles.list 144913Sdefan@nginx.comcat /dev/null > debugsources.list 145913Sdefan@nginx.com%if 0%{?suse_version} >= 1500 146913Sdefan@nginx.comcat /dev/null > debugsourcefiles.list 147913Sdefan@nginx.com%endif 148372Sdefan@nginx.com 149372Sdefan@nginx.com%clean 150372Sdefan@nginx.com%{__rm} -rf %{buildroot} 151372Sdefan@nginx.com 152372Sdefan@nginx.com%post 1531758Sthresh@nginx.comgetent group unit >/dev/null || groupadd -r unit 1541758Sthresh@nginx.comgetent passwd unit >/dev/null || \ 1551758Sthresh@nginx.com useradd -r -g unit -s /sbin/nologin \ 1561758Sthresh@nginx.com -d /nonexistent -c "unit user" unit 157372Sdefan@nginx.comif [ $1 -eq 1 ]; then 158372Sdefan@nginx.com /usr/bin/systemctl preset unit.service >/dev/null 2>&1 ||: 1592027Sdefan@nginx.com /usr/bin/systemctl preset unit-debug.service >/dev/null 2>&1 ||: 160372Sdefan@nginx.com cat <<BANNER 161372Sdefan@nginx.com---------------------------------------------------------------------- 162372Sdefan@nginx.com 163372Sdefan@nginx.comThank you for installing NGINX Unit! 164372Sdefan@nginx.com 165372Sdefan@nginx.comAdditional modules are available in standalone packages. 166372Sdefan@nginx.comTo see the available modules, run "yum list available unit-\*". 167372Sdefan@nginx.com 168372Sdefan@nginx.comOnline documentation is available at https://unit.nginx.org/ 169372Sdefan@nginx.com 170372Sdefan@nginx.com---------------------------------------------------------------------- 171372Sdefan@nginx.comBANNER 172372Sdefan@nginx.comfi 173372Sdefan@nginx.com 174372Sdefan@nginx.com%preun 175372Sdefan@nginx.comif [ $1 -eq 0 ]; then 176372Sdefan@nginx.com /usr/bin/systemctl --no-reload disable unit.service >/dev/null 2>&1 ||: 177372Sdefan@nginx.com /usr/bin/systemctl stop unit.service >/dev/null 2>&1 ||: 178372Sdefan@nginx.comfi 179372Sdefan@nginx.com 180372Sdefan@nginx.com%postun 181372Sdefan@nginx.com/usr/bin/systemctl daemon-reload >/dev/null 2>&1 ||: 182372Sdefan@nginx.comif [ $1 -ge 1 ]; then 183372Sdefan@nginx.com /usr/bin/systemctl try-restart unit.service >/dev/null 2>&1 ||: 184372Sdefan@nginx.comfi 185372Sdefan@nginx.com 1861753Sdefan@nginx.com%triggerpostun -- unit < 1.22.0 1871753Sdefan@nginx.comcat <<BANNER 1881753Sdefan@nginx.com---------------------------------------------------------------------- 1891753Sdefan@nginx.com 1901753Sdefan@nginx.comWARNING: 1911753Sdefan@nginx.com 1921753Sdefan@nginx.comSince version 1.22.0, Unit's non-privileged processes run as unit:unit by 1931753Sdefan@nginx.comdefault. Review your system permissions and Unit configuration so apps and 1941753Sdefan@nginx.comroutes that relied on these processes running as nobody:nogroup stay working. 1951753Sdefan@nginx.com 1961753Sdefan@nginx.comMore info: https://unit.nginx.org/installation/#official-packages 1971753Sdefan@nginx.com 1981753Sdefan@nginx.com---------------------------------------------------------------------- 1991753Sdefan@nginx.comBANNER 2001753Sdefan@nginx.com 201372Sdefan@nginx.com%files 202372Sdefan@nginx.com%defattr(-,root,root,-) 203372Sdefan@nginx.com%attr(0755,root,root) %{_sbindir}/unitd 204372Sdefan@nginx.com%attr(0755,root,root) %{_sbindir}/unitd-debug 205372Sdefan@nginx.com%{_unitdir}/unit.service 2062027Sdefan@nginx.com%{_unitdir}/unit-debug.service 207911Sremi@remirepo.net%dir %attr(0755,root,root) %ghost %{_localstatedir}/run/unit 208372Sdefan@nginx.com%dir %{_datadir}/doc/unit 209372Sdefan@nginx.com%{_datadir}/doc/unit/* 210372Sdefan@nginx.com%dir %{_libdir}/unit/modules 211372Sdefan@nginx.com%dir %{_libdir}/unit/debug-modules 212372Sdefan@nginx.com%dir %{_sharedstatedir}/unit 2131841Sdefan@nginx.com%dir %attr(0755,root,root) %{_localstatedir}/log/unit 214911Sremi@remirepo.net%config(noreplace) %{_sysconfdir}/logrotate.d/%{name} 2151827Sthresh@nginx.com%{_mandir}/man8/unitd.8* 216372Sdefan@nginx.com 217815Sdefan@nginx.com%files devel 218815Sdefan@nginx.com%{_libdir}/libunit.a 219815Sdefan@nginx.com%{_libdir}/libunit-debug.a 220815Sdefan@nginx.com%{_includedir}/nxt_*.h 221815Sdefan@nginx.com 222372Sdefan@nginx.com%changelog 223