xref: /unit/pkg/rpm/unit.module.spec.in (revision 1972:11b2404d9305)
1372Sdefan@nginx.com# distribution specific definitions
2372Sdefan@nginx.com%define bdir %{_builddir}/%{name}-%{version}
3372Sdefan@nginx.com
4490Sdefan@nginx.com%if (0%{?rhel} == 7 && 0%{?amzn} == 0)
5372Sdefan@nginx.com%define dist .el7
6372Sdefan@nginx.com%endif
7372Sdefan@nginx.com
8*1972Sdefan@nginx.com%%MODULE_DEFINITIONS%%
9*1972Sdefan@nginx.com
101752Sthresh@nginx.com%if 0%{?rhel}%{?fedora}
111752Sthresh@nginx.comBuildRequires: gcc
121851Sthresh@nginx.com%if 0%{?amzn2}
131851Sthresh@nginx.comBuildRequires: openssl11-devel
141851Sthresh@nginx.com%else
151752Sthresh@nginx.comBuildRequires: openssl-devel
161752Sthresh@nginx.com%endif
171851Sthresh@nginx.com%endif
181752Sthresh@nginx.com
191752Sthresh@nginx.com%if 0%{?suse_version} >= 1315
201752Sthresh@nginx.comBuildRequires: libopenssl-devel
211752Sthresh@nginx.com%endif
221752Sthresh@nginx.com
23372Sdefan@nginx.com%define unit_version %%UNIT_VERSION%%
24372Sdefan@nginx.com%define unit_release %%UNIT_RELEASE%%%{?dist}.ngx
25372Sdefan@nginx.com
26443Sdefan@nginx.com%define CC_OPT %{optflags}
27443Sdefan@nginx.com
28372Sdefan@nginx.com%define CONFIGURE_ARGS $(echo "%%CONFIGURE_ARGS%%")
29372Sdefan@nginx.com
30372Sdefan@nginx.comName: %%NAME%%
31372Sdefan@nginx.comSummary: %%SUMMARY%%
32372Sdefan@nginx.comVersion: %%VERSION%%
33372Sdefan@nginx.comRelease: %%RELEASE%%%{?dist}.ngx
34372Sdefan@nginx.comLicense: ASL 2.0
351853Sdefan@nginx.comVendor: %%PACKAGE_VENDOR%%
36372Sdefan@nginx.comURL: https://unit.nginx.org/
37372Sdefan@nginx.comGroup: System Environment/Daemons
38372Sdefan@nginx.com
39372Sdefan@nginx.comSource0: unit-%{version}.tar.gz
40372Sdefan@nginx.com%%MODULE_SOURCES%%
41372Sdefan@nginx.com
42372Sdefan@nginx.comBuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
43372Sdefan@nginx.com
441752Sthresh@nginx.comBuildRequires: pcre2-devel
451752Sthresh@nginx.com
46372Sdefan@nginx.comRequires: unit == %%UNIT_VERSION%%-%%UNIT_RELEASE%%%{?dist}.ngx
47372Sdefan@nginx.com
48372Sdefan@nginx.com%description
49372Sdefan@nginx.comNGINX Unit is a runtime and delivery environment for modern distributed
50372Sdefan@nginx.comapplications. It runs the application code in multiple languages
51372Sdefan@nginx.com(PHP, Python, Go, etc.), and tightly couples it with traffic delivery
52372Sdefan@nginx.comin and out of the application. Take this application server and proxy
53372Sdefan@nginx.comdirectly in the cloud / container environments and fully control your app
54372Sdefan@nginx.comdynamically via an API.
55372Sdefan@nginx.comThis package contains %%SUMMARY%%.
56372Sdefan@nginx.com
57372Sdefan@nginx.com%if 0%{?suse_version}
58372Sdefan@nginx.com%debug_package
59372Sdefan@nginx.com%endif
60372Sdefan@nginx.com
611016Sdefan@nginx.com%if (0%{?fedora}) || (0%{?rhel} >= 8)
62913Sdefan@nginx.com%define _debugsource_template %{nil}
63913Sdefan@nginx.com%endif
64913Sdefan@nginx.com
65372Sdefan@nginx.com%prep
66372Sdefan@nginx.com%setup -qcTn %{name}-%{unit_version}
67372Sdefan@nginx.comtar --strip-components=1 -zxf %{SOURCE0}
68372Sdefan@nginx.com
69372Sdefan@nginx.com%build
70372Sdefan@nginx.com./configure \
71372Sdefan@nginx.com	%{CONFIGURE_ARGS} \
72372Sdefan@nginx.com	--modules=%{_libdir}/unit/debug-modules \
73443Sdefan@nginx.com	--cc-opt="%{CC_OPT}" \
74372Sdefan@nginx.com	--debug
75372Sdefan@nginx.com./configure %%MODULE_CONFARGS%%
76372Sdefan@nginx.commake %%MODULE_MAKEARGS%%
77372Sdefan@nginx.com%{__mv} build build-debug
78372Sdefan@nginx.com./configure \
79372Sdefan@nginx.com	%{CONFIGURE_ARGS} \
80443Sdefan@nginx.com	--modules=%{_libdir}/unit/modules \
81443Sdefan@nginx.com	--cc-opt="%{CC_OPT}"
82372Sdefan@nginx.com./configure %%MODULE_CONFARGS%%
83372Sdefan@nginx.commake %%MODULE_MAKEARGS%%
84500Sdefan@nginx.com%{__mv} build build-nodebug
85372Sdefan@nginx.com
86372Sdefan@nginx.com%install
87372Sdefan@nginx.com%{__rm} -rf %{buildroot}
88372Sdefan@nginx.com%{__mkdir} -p %{buildroot}%{_datadir}/doc/%%NAME%%
89980Sdefan@nginx.comif [ `basename %{SOURCE100}` == COPYRIGHT.%{name} ]; then
90980Sdefan@nginx.com%{__install} -m 644 -p %{SOURCE100} \
91980Sdefan@nginx.com    %{buildroot}%{_datadir}/doc/%%NAME%%/COPYRIGHT
92980Sdefan@nginx.comelse
93372Sdefan@nginx.com%{__install} -m 644 -p NOTICE \
94372Sdefan@nginx.com    %{buildroot}%{_datadir}/doc/%%NAME%%/COPYRIGHT
95980Sdefan@nginx.comfi
96372Sdefan@nginx.com%%MODULE_PREINSTALL%%
97500Sdefan@nginx.com%{__ln_s} build-debug build
98372Sdefan@nginx.comDESTDIR=%{buildroot} make %%MODULE_INSTARGS%%
99500Sdefan@nginx.com%{__rm} -f build
100500Sdefan@nginx.com%{__ln_s} build-nodebug build
101372Sdefan@nginx.comDESTDIR=%{buildroot} make %%MODULE_INSTARGS%%
102980Sdefan@nginx.com%%MODULE_POSTINSTALL%%
103372Sdefan@nginx.com
104372Sdefan@nginx.com%check
105913Sdefan@nginx.com%{__rm} -rf %{buildroot}/usr/src
106913Sdefan@nginx.comcd %{bdir}
107913Sdefan@nginx.comgrep -v 'usr/src' debugfiles.list > debugfiles.list.new && mv debugfiles.list.new debugfiles.list
108913Sdefan@nginx.comcat /dev/null > debugsources.list
109913Sdefan@nginx.com%if 0%{?suse_version} >= 1500
110913Sdefan@nginx.comcat /dev/null > debugsourcefiles.list
111913Sdefan@nginx.com%endif
112372Sdefan@nginx.com
113372Sdefan@nginx.com%clean
114372Sdefan@nginx.com%{__rm} -rf %{buildroot}
115372Sdefan@nginx.com
116372Sdefan@nginx.com%post
117372Sdefan@nginx.comif [ $1 -eq 1 ]; then
118372Sdefan@nginx.com%%MODULE_POST%%
119372Sdefan@nginx.comfi
120372Sdefan@nginx.com
121372Sdefan@nginx.com%files
122372Sdefan@nginx.com%defattr(-,root,root,-)
123372Sdefan@nginx.com%dir %{_datadir}/doc/%%NAME%%
124372Sdefan@nginx.com%{_datadir}/doc/%%NAME%%/*
125372Sdefan@nginx.com%%MODULE_FILES%%
126372Sdefan@nginx.com
127372Sdefan@nginx.com%changelog
128