1# distribution specific definitions 2%define bdir %{_builddir}/%{name}-%{version} 3 4%%MODULE_DEFINITIONS%% 5 6%if (0%{?rhel} == 7 && 0%{?amzn} == 0) 7%define dist .el7 8%endif 9 10%if 0%{?rhel}%{?fedora} 11BuildRequires: gcc 12%if 0%{?amzn2} 13BuildRequires: openssl11-devel 14%else 15BuildRequires: openssl-devel 16%endif 17%endif 18 19%if 0%{?suse_version} >= 1315 20BuildRequires: libopenssl-devel 21%endif 22 23%define unit_version %%UNIT_VERSION%% 24%define unit_release %%UNIT_RELEASE%%%{?dist}.ngx 25 26%define CC_OPT %{optflags} 27 28%define CONFIGURE_ARGS $(echo "%%CONFIGURE_ARGS%%") 29 30Name: %%NAME%% 31Summary: %%SUMMARY%% 32Version: %%VERSION%% 33Release: %%RELEASE%%%{?dist}.ngx 34License: ASL 2.0 35Vendor: Nginx Software, Inc. 36URL: https://unit.nginx.org/ 37Packager: Nginx Software, Inc. <https://www.nginx.com> 38Group: System Environment/Daemons 39 40Source0: unit-%{version}.tar.gz 41%%MODULE_SOURCES%% 42 43BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) 44 45BuildRequires: pcre2-devel 46 47Requires: unit == %%UNIT_VERSION%%-%%UNIT_RELEASE%%%{?dist}.ngx 48 49%description 50NGINX Unit is a runtime and delivery environment for modern distributed 51applications. It runs the application code in multiple languages 52(PHP, Python, Go, etc.), and tightly couples it with traffic delivery 53in and out of the application. Take this application server and proxy 54directly in the cloud / container environments and fully control your app 55dynamically via an API. 56This package contains %%SUMMARY%%. 57 58%if 0%{?suse_version} 59%debug_package 60%endif 61 62%if (0%{?fedora}) || (0%{?rhel} >= 8) 63%define _debugsource_template %{nil} 64%endif 65 66%prep 67%setup -qcTn %{name}-%{unit_version} 68tar --strip-components=1 -zxf %{SOURCE0} 69 70%build 71./configure \ 72 %{CONFIGURE_ARGS} \ 73 --modules=%{_libdir}/unit/debug-modules \ 74 --cc-opt="%{CC_OPT}" \ 75 --debug 76./configure %%MODULE_CONFARGS%% 77make %%MODULE_MAKEARGS%% 78%{__mv} build build-debug 79./configure \ 80 %{CONFIGURE_ARGS} \ 81 --modules=%{_libdir}/unit/modules \ 82 --cc-opt="%{CC_OPT}" 83./configure %%MODULE_CONFARGS%% 84make %%MODULE_MAKEARGS%% 85%{__mv} build build-nodebug 86 87%install 88%{__rm} -rf %{buildroot} 89%{__mkdir} -p %{buildroot}%{_datadir}/doc/%%NAME%% 90if [ `basename %{SOURCE100}` == COPYRIGHT.%{name} ]; then 91%{__install} -m 644 -p %{SOURCE100} \ 92 %{buildroot}%{_datadir}/doc/%%NAME%%/COPYRIGHT 93else 94%{__install} -m 644 -p NOTICE \ 95 %{buildroot}%{_datadir}/doc/%%NAME%%/COPYRIGHT 96fi 97%%MODULE_PREINSTALL%% 98%{__ln_s} build-debug build 99DESTDIR=%{buildroot} make %%MODULE_INSTARGS%% 100%{__rm} -f build 101%{__ln_s} build-nodebug build 102DESTDIR=%{buildroot} make %%MODULE_INSTARGS%% 103%%MODULE_POSTINSTALL%% 104 105%check 106%{__rm} -rf %{buildroot}/usr/src 107cd %{bdir} 108grep -v 'usr/src' debugfiles.list > debugfiles.list.new && mv debugfiles.list.new debugfiles.list 109cat /dev/null > debugsources.list 110%if 0%{?suse_version} >= 1500 111cat /dev/null > debugsourcefiles.list 112%endif 113 114%clean 115%{__rm} -rf %{buildroot} 116 117%post 118if [ $1 -eq 1 ]; then 119%%MODULE_POST%% 120fi 121 122%files 123%defattr(-,root,root,-) 124%dir %{_datadir}/doc/%%NAME%% 125%{_datadir}/doc/%%NAME%%/* 126%%MODULE_FILES%% 127 128%changelog 129