xref: /unit/pkg/rpm/unit.module.spec.in (revision 2549:ef8ddca63f2c)
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-r%%UNIT_VERSION%%
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%%MODULE_PREBUILD%%
63./configure \
64	%{CONFIGURE_ARGS} \
65	--modulesdir=%{_libdir}/unit/debug-modules \
66	--cc-opt="%{CC_OPT}" \
67	--debug
68./configure %%MODULE_CONFARGS%%
69make %%MODULE_MAKEARGS%%
70%{__mv} build build-debug
71./configure \
72	%{CONFIGURE_ARGS} \
73	--modulesdir=%{_libdir}/unit/modules \
74	--cc-opt="%{CC_OPT}"
75./configure %%MODULE_CONFARGS%%
76make %%MODULE_MAKEARGS%%
77%{__mv} build build-nodebug
78
79%install
80%{__rm} -rf %{buildroot}
81%{__mkdir} -p %{buildroot}%{_datadir}/doc/%%NAME%%
82if [ `basename %{SOURCE100}` == COPYRIGHT.%{name} ]; then
83%{__install} -m 644 -p %{SOURCE100} \
84    %{buildroot}%{_datadir}/doc/%%NAME%%/COPYRIGHT
85else
86%{__install} -m 644 -p NOTICE \
87    %{buildroot}%{_datadir}/doc/%%NAME%%/COPYRIGHT
88fi
89%%MODULE_PREINSTALL%%
90%{__ln_s} build-debug build
91DESTDIR=%{buildroot} make %%MODULE_INSTARGS%%
92%{__rm} -f build
93%{__ln_s} build-nodebug build
94DESTDIR=%{buildroot} make %%MODULE_INSTARGS%%
95%%MODULE_POSTINSTALL%%
96
97%check
98%{__rm} -rf %{buildroot}/usr/src
99cd %{bdir}
100grep -v 'usr/src' debugfiles.list > debugfiles.list.new && mv debugfiles.list.new debugfiles.list
101cat /dev/null > debugsources.list
102
103%clean
104%{__rm} -rf %{buildroot}
105
106%post
107if [ $1 -eq 1 ]; then
108%%MODULE_POST%%
109fi
110
111%files
112%defattr(-,root,root,-)
113%dir %{_datadir}/doc/%%NAME%%
114%{_datadir}/doc/%%NAME%%/*
115%%MODULE_FILES%%
116
117%changelog
118