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