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