-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnginx-module-ndk.spec.erb
57 lines (48 loc) · 1.85 KB
/
nginx-module-ndk.spec.erb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
%define name nginx-module-ndk
%define nginx_version <%= ENV['NGINX_VERSION'] %>
%define ngx_mruby_version <%= ENV['NGX_MRUBY_VERSION'] %>
%define ndk_version <%= ENV['NDK_VERSION'] %>
%define release <%= ENV['NGINX_RELEASE'].gsub(/\.ngx/, '') %>
%define version %{ndk_version}.ngx%{nginx_version}
%define buildroot %{_tmppath}/%{name}-%{version}-buildroot
%define moduledir %{buildroot}/etc/nginx/modules
BuildRoot: %{buildroot}
Summary: Nginx Development Kit for NGINX module
License: BSD 3-Clause
Packager: "Ken'ichiro OYAMA"
Name: %{name}
Version: %{version}
Release: %{release}
Prefix: %{_prefix}
Group: System Environment/Daemons
Requires: nginx >= %{nginx_version}, policycoreutils-python
BuildRequires: git
Source0: https://github.com/matsumotory/ngx_mruby/archive/v%{ngx_mruby_version}.tar.gz
Source1: http://nginx.org/download/nginx-%{nginx_version}.tar.gz
Source2: https://github.com/simpl/ngx_devel_kit/archive/v%{ndk_version}.tar.gz
%description
Nginx Development Kit for NGINX module
%prep
%setup -q -b 1 -b 2 -n ngx_mruby-%{ngx_mruby_version}
%build
./configure --with-ngx-src-root=../nginx-%{nginx_version} --enable-dynamic-module
make mrbgems_config_dynamic
cd ../nginx-%{nginx_version}
./configure --with-compat --add-dynamic-module=../ngx_devel_kit-%{ndk_version} --add-dynamic-module=../ngx_mruby-%{ngx_mruby_version}
make modules
%install
rm -rf %{buildroot}
mkdir -p %{moduledir}
cp ../nginx-%{nginx_version}/objs/ndk_http_module.so %{moduledir}/
%clean
[ "%{buildroot}" != "/" ] && rm -rf %{buildroot}
%files
%defattr(-, root, root)
/etc/nginx/modules/ndk_http_module.so
%post
semanage fcontext -a -t httpd_config_t /etc/nginx/modules/ndk_http_module.so 2>/dev/null || :
restorecon -R -v /etc/nginx/modules/ndk_http_module.so || :
%postun
if [ $1 -eq 0 ] ; then
semanage fcontext -d -t httpd_config_t /etc/nginx/modules/ndk_http_module.so 2>/dev/null || :
fi