制作nginx和lua-nginx-module的rpm软件包

构建环境是CentOS6.6。

从 Fedora 的软件仓库中获取 LuaJIT 并重新构建。
$ wget https://dl.fedoraproject.org/pub/fedora/linux/development/rawhide/source/SRPMS/l/luajit-2.0.3-4.fc22.src.rpm
$ rpm -ivh luajit-2.0.3-4.fc22.src.rpm
$ rpmbuild -ba ~/rpmbuild/SPECS/luajit.spec
安装已重新构建的 LuaJIT。
$ sudo yum localinstall ~/rpmbuild/RPMS/x86_64/luajit-2.0.3-4.el6.x86_64.rpm  ~/rpmbuild/RPMS/x86_64/luajit-devel-2.0.3-4.el6.x86_64.rpm
从官方软件库获取Nginx并进行重建
$ wget http://nginx.org/packages/centos/6/SRPMS/nginx-1.6.2-1.el6.ngx.src.rpm
$ rpm -ivh nginx-1.6.2-1.el6.ngx.src.rpm
下载lua-nginx-module和ngx_devel_kit,并将其放置在SOURCES目录中。
$ cd ~/rpmbuild/SOURCES/
$ wget -O lua-nginx-module-0.9.12.tar.gz https://github.com/openresty/lua-nginx-module/archive/v0.9.12.tar.gz
$ wget -O ngx_devel_kit-0.2.19.tar.gz https://github.com/simpl/ngx_devel_kit/archive/v0.2.19.tar.gz
将nginx的SPEC文件按照以下方式进行修改。
@@ -42,12 +42,17 @@
 Requires(pre): pwdutils
 %endif

+%define lua_nginx_module_var 0.9.12
+%define ngx_devel_kit_var 0.2.19
+Requires: luajit
+BuildRequires: luajit-devel
+
 # end of distribution specific definitions

 Summary: High performance web server
 Name: nginx
 Version: 1.6.2
-Release: 1%{?dist}.ngx
+Release: 1%{?dist}.lua
 Vendor: nginx inc.
 URL: http://nginx.org/

@@ -61,6 +66,8 @@
 Source7: nginx.suse.init
 Source8: nginx.service
 Source9: nginx.upgrade.sh
+Source10: lua-nginx-module-%{lua_nginx_module_var}.tar.gz
+Source11: ngx_devel_kit-%{ngx_devel_kit_var}.tar.gz

 License: 2-clause BSD-like license

@@ -82,11 +89,13 @@
 Not stripped version of nginx built with the debugging log support.

 %prep
-%setup -q
+%setup -a 10 -a 11 -q

 %build
 ./configure \
         --prefix=%{_sysconfdir}/nginx \
+        --add-module=./lua-nginx-module-%{lua_nginx_module_var}/ \
+        --add-module=./ngx_devel_kit-%{ngx_devel_kit_var}/ \
         --sbin-path=%{_sbindir}/nginx \
         --conf-path=%{_sysconfdir}/nginx/nginx.conf \
         --error-log-path=%{_localstatedir}/log/nginx/error.log \
@@ -126,6 +135,8 @@
         %{_builddir}/%{name}-%{version}/objs/nginx.debug
 ./configure \
         --prefix=%{_sysconfdir}/nginx \
+        --add-module=./lua-nginx-module-%{lua_nginx_module_var}/ \
+        --add-module=./ngx_devel_kit-%{ngx_devel_kit_var}/ \
         --sbin-path=%{_sbindir}/nginx \
         --conf-path=%{_sysconfdir}/nginx/nginx.conf \
         --error-log-path=%{_localstatedir}/log/nginx/error.log \
重建
$ sudo yum-builddep ~/rpmbuild/SPECS/nginx.spec
$ rpmbuild -ba ~/rpmbuild/SPECS/nginx.spec

做完了了吗?
还没有动!
接下来我会试着动一下。

广告
将在 10 秒后关闭
bannerAds