diff --git a/Formula/ngx_openresty.rb b/Formula/ngx_openresty.rb index 9e58ec8..96945b1 100644 --- a/Formula/ngx_openresty.rb +++ b/Formula/ngx_openresty.rb @@ -13,9 +13,15 @@ class NgxOpenresty < Formula sha1 'ac87a3c40e1b459a9564ddd116cf6defb8cd25aa' end + resource "ip2location-nginx-module" do + url "https://github.com/velikanov/ip2location-nginx/archive/v7.0.0.0.tar.gz" + sha1 "6f0532737f009de34bedfe0d355626b502586c3d" + end + depends_on 'pcre' depends_on 'postgresql' => :optional depends_on 'geoip' => :optional + depends_on 'velikanov/ip2location' => :optional # openresty options option 'without-luajit', "Compile *without* support for the Lua Just-In-Time Compiler" @@ -28,8 +34,10 @@ class NgxOpenresty < Formula option 'with-webdav', "Compile with ngx_http_dav_module" option 'with-gunzip', "Compile with ngx_http_gunzip_module" option 'with-geoip', "Compile with ngx_http_geoip_module" + option 'with-ip2location', "Compile with ngx_http_ip2location_module" + option 'with-realip', "Complile with ngx_http_realip_module" - skip_clean 'logs' + skip_clean 'nginx/logs' def install args = ["--prefix=#{prefix}", @@ -45,6 +53,7 @@ def install args << "--with-http_dav_module" if build.with? 'webdav' args << "--with-http_gunzip_module" if build.with? 'gunzip' args << "--with-http_geoip_module" if build.with? 'geoip' + args << "--with-http_realip_module" if build.with? 'realip' # Debugging mode, unfortunately without debugging symbols if build.with? 'debug' @@ -60,6 +69,14 @@ def install opoo "Openresty will be built --with-debug option, but without debugging symbols. For debugging symbols you have to compile it by hand." end + if build.with? 'velikanov/ip2location' + resource("ip2location-nginx-module").stage { + (buildpath/"ngx_ip2location-7.0.0").install Dir["./*"] + } + + args << "--add-module=ngx_ip2location-7.0.0" + end + # OpenResty options args << "--with-lua51" if build.without? 'luajit'