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