6
6

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

nginxとlua-nginx-moduleのrpmパッケージを作成する

Last updated at Posted at 2014-11-18

ビルド環境はCentOS6.6です

#####LuaJITをfedoraのリポジトリから持ってきてリビルドする

$ 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

完成かな?
まだ動かしてません!
次は動かしてみます

6
6
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
6
6

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?