-
Notifications
You must be signed in to change notification settings - Fork 200
/
Copy pathopenresty.rb
90 lines (80 loc) · 3.15 KB
/
openresty.rb
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
class Openresty < Formula
desc "Scalable Web Platform by Extending NGINX with Lua"
homepage "https://openresty.org"
VERSION = "1.15.8.3".freeze
url "https://openresty.org/download/openresty-#{VERSION}.tar.gz"
sha256 "b68cf3aa7878db16771c96d9af9887ce11f3e96a1e5e68755637ecaff75134a8"
revision 2
option "with-debug", "Compile with support for debug logging"
option "with-postgresql", "Compile with ngx_http_postgres_module"
option "with-iconv", "Compile with ngx_http_iconv_module"
option "with-slice", "Compile with ngx_http_slice_module"
depends_on "denji/nginx/openresty-openssl"
depends_on "geoip"
depends_on "pcre"
depends_on "postgresql" => :optional
skip_clean "site"
skip_clean "pod"
skip_clean "nginx"
skip_clean "luajit"
def install
# Configure
cc_opt = "-I#{HOMEBREW_PREFIX}/include -I#{Formula["pcre"].opt_include}"
cc_opt += " -I#{Formula["denji/nginx/openresty-openssl"].opt_include}"
ld_opt = "-L#{HOMEBREW_PREFIX}/lib -L#{Formula["pcre"].opt_lib}"
ld_opt += " -L#{Formula["denji/nginx/openresty-openssl"].opt_lib}"
args = ["-j#{ENV.make_jobs}",
"--prefix=#{prefix}",
"--pid-path=#{var}/run/openresty.pid",
"--lock-path=#{var}/run/openresty.lock",
"--conf-path=#{etc}/openresty/nginx.conf",
"--http-log-path=#{var}/log/nginx/access.log",
"--error-log-path=#{var}/log/nginx/error.log",
"--with-cc-opt=#{cc_opt}",
"--with-ld-opt=#{ld_opt}",
"--with-pcre-jit",
"--without-http_rds_json_module",
"--without-http_rds_csv_module",
"--without-lua_rds_parser",
"--with-ipv6",
"--with-stream",
"--with-stream_ssl_module",
"--with-stream_ssl_preread_module",
"--with-http_v2_module",
"--without-mail_pop3_module",
"--without-mail_imap_module",
"--without-mail_smtp_module",
"--with-http_stub_status_module",
"--with-http_realip_module",
"--with-http_addition_module",
"--with-http_auth_request_module",
"--with-http_secure_link_module",
"--with-http_random_index_module",
"--with-http_geoip_module",
"--with-http_gzip_static_module",
"--with-http_sub_module",
"--with-http_dav_module",
"--with-http_flv_module",
"--with-http_mp4_module",
"--with-http_gunzip_module",
"--with-threads",
"--with-luajit-xcflags=-DLUAJIT_NUMMODE=2 -DLUAJIT_ENABLE_LUA52COMPAT -fno-stack-check",
"--with-dtrace-probes"]
args << "--with-http_postgres_module" if build.with? "postgresql"
args << "--with-http_iconv_module" if build.with? "iconv"
args << "--with-http_slice_module" if build.with? "slice"
args << "--with-debug" if build.with? "debug"
system "./configure", *args
# Install
system "make"
system "make", "install"
end
service do
run [opt_bin/"openresty", "-g", "daemon off;"]
working_dir HOMEBREW_PREFIX
keep_alive false
end
test do
system "#{bin}/openresty", "-V"
end
end