xref: /unit/pkg/rpm/unit.module.spec.in (revision 2549:ef8ddca63f2c)
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
81972Sdefan@nginx.com%%MODULE_DEFINITIONS%%
91972Sdefan@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
19372Sdefan@nginx.com%define unit_version %%UNIT_VERSION%%
20372Sdefan@nginx.com%define unit_release %%UNIT_RELEASE%%%{?dist}.ngx
21372Sdefan@nginx.com
22443Sdefan@nginx.com%define CC_OPT %{optflags}
23443Sdefan@nginx.com
24372Sdefan@nginx.com%define CONFIGURE_ARGS $(echo "%%CONFIGURE_ARGS%%")
25372Sdefan@nginx.com
26372Sdefan@nginx.comName: %%NAME%%
27372Sdefan@nginx.comSummary: %%SUMMARY%%
28372Sdefan@nginx.comVersion: %%VERSION%%
29372Sdefan@nginx.comRelease: %%RELEASE%%%{?dist}.ngx
30372Sdefan@nginx.comLicense: ASL 2.0
311853Sdefan@nginx.comVendor: %%PACKAGE_VENDOR%%
32372Sdefan@nginx.comURL: https://unit.nginx.org/
33372Sdefan@nginx.comGroup: System Environment/Daemons
34372Sdefan@nginx.com
35372Sdefan@nginx.comSource0: unit-%{version}.tar.gz
36372Sdefan@nginx.com%%MODULE_SOURCES%%
37372Sdefan@nginx.com
38372Sdefan@nginx.comBuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
39372Sdefan@nginx.com
401752Sthresh@nginx.comBuildRequires: pcre2-devel
411752Sthresh@nginx.com
422239Sthresh@nginx.comRequires: unit-r%%UNIT_VERSION%%
43372Sdefan@nginx.com
44372Sdefan@nginx.com%description
45372Sdefan@nginx.comNGINX Unit is a runtime and delivery environment for modern distributed
46372Sdefan@nginx.comapplications. It runs the application code in multiple languages
47372Sdefan@nginx.com(PHP, Python, Go, etc.), and tightly couples it with traffic delivery
48372Sdefan@nginx.comin and out of the application. Take this application server and proxy
49372Sdefan@nginx.comdirectly in the cloud / container environments and fully control your app
50372Sdefan@nginx.comdynamically via an API.
51372Sdefan@nginx.comThis package contains %%SUMMARY%%.
52372Sdefan@nginx.com
531016Sdefan@nginx.com%if (0%{?fedora}) || (0%{?rhel} >= 8)
54913Sdefan@nginx.com%define _debugsource_template %{nil}
55913Sdefan@nginx.com%endif
56913Sdefan@nginx.com
57372Sdefan@nginx.com%prep
58372Sdefan@nginx.com%setup -qcTn %{name}-%{unit_version}
59372Sdefan@nginx.comtar --strip-components=1 -zxf %{SOURCE0}
60372Sdefan@nginx.com
61372Sdefan@nginx.com%build
62*2524Sthresh@nginx.com%%MODULE_PREBUILD%%
63372Sdefan@nginx.com./configure \
64372Sdefan@nginx.com	%{CONFIGURE_ARGS} \
652319Sthresh@nginx.com	--modulesdir=%{_libdir}/unit/debug-modules \
66443Sdefan@nginx.com	--cc-opt="%{CC_OPT}" \
67372Sdefan@nginx.com	--debug
68372Sdefan@nginx.com./configure %%MODULE_CONFARGS%%
69372Sdefan@nginx.commake %%MODULE_MAKEARGS%%
70372Sdefan@nginx.com%{__mv} build build-debug
71372Sdefan@nginx.com./configure \
72372Sdefan@nginx.com	%{CONFIGURE_ARGS} \
732319Sthresh@nginx.com	--modulesdir=%{_libdir}/unit/modules \
74443Sdefan@nginx.com	--cc-opt="%{CC_OPT}"
75372Sdefan@nginx.com./configure %%MODULE_CONFARGS%%
76372Sdefan@nginx.commake %%MODULE_MAKEARGS%%
77500Sdefan@nginx.com%{__mv} build build-nodebug
78372Sdefan@nginx.com
79372Sdefan@nginx.com%install
80372Sdefan@nginx.com%{__rm} -rf %{buildroot}
81372Sdefan@nginx.com%{__mkdir} -p %{buildroot}%{_datadir}/doc/%%NAME%%
82980Sdefan@nginx.comif [ `basename %{SOURCE100}` == COPYRIGHT.%{name} ]; then
83980Sdefan@nginx.com%{__install} -m 644 -p %{SOURCE100} \
84980Sdefan@nginx.com    %{buildroot}%{_datadir}/doc/%%NAME%%/COPYRIGHT
85980Sdefan@nginx.comelse
86372Sdefan@nginx.com%{__install} -m 644 -p NOTICE \
87372Sdefan@nginx.com    %{buildroot}%{_datadir}/doc/%%NAME%%/COPYRIGHT
88980Sdefan@nginx.comfi
89372Sdefan@nginx.com%%MODULE_PREINSTALL%%
90500Sdefan@nginx.com%{__ln_s} build-debug build
91372Sdefan@nginx.comDESTDIR=%{buildroot} make %%MODULE_INSTARGS%%
92500Sdefan@nginx.com%{__rm} -f build
93500Sdefan@nginx.com%{__ln_s} build-nodebug build
94372Sdefan@nginx.comDESTDIR=%{buildroot} make %%MODULE_INSTARGS%%
95980Sdefan@nginx.com%%MODULE_POSTINSTALL%%
96372Sdefan@nginx.com
97372Sdefan@nginx.com%check
98913Sdefan@nginx.com%{__rm} -rf %{buildroot}/usr/src
99913Sdefan@nginx.comcd %{bdir}
100913Sdefan@nginx.comgrep -v 'usr/src' debugfiles.list > debugfiles.list.new && mv debugfiles.list.new debugfiles.list
101913Sdefan@nginx.comcat /dev/null > debugsources.list
102372Sdefan@nginx.com
103372Sdefan@nginx.com%clean
104372Sdefan@nginx.com%{__rm} -rf %{buildroot}
105372Sdefan@nginx.com
106372Sdefan@nginx.com%post
107372Sdefan@nginx.comif [ $1 -eq 1 ]; then
108372Sdefan@nginx.com%%MODULE_POST%%
109372Sdefan@nginx.comfi
110372Sdefan@nginx.com
111372Sdefan@nginx.com%files
112372Sdefan@nginx.com%defattr(-,root,root,-)
113372Sdefan@nginx.com%dir %{_datadir}/doc/%%NAME%%
114372Sdefan@nginx.com%{_datadir}/doc/%%NAME%%/*
115372Sdefan@nginx.com%%MODULE_FILES%%
116372Sdefan@nginx.com
117372Sdefan@nginx.com%changelog
118