├── Aliases ├── unit@1.34.2 └── php-embed@8.4 ├── README.md ├── Formula ├── unit-wasm.rb ├── unit-php.rb ├── unit-perl.rb ├── unit-java.rb ├── unit-python.rb ├── unit-python3.rb ├── unit-ruby.rb ├── unit.rb └── php-embed.rb └── .github └── workflows ├── main.yml └── manual.yml /Aliases/unit@1.34.2: -------------------------------------------------------------------------------- 1 | ../Formula/unit.rb -------------------------------------------------------------------------------- /Aliases/php-embed@8.4: -------------------------------------------------------------------------------- 1 | ../Formula/php-embed.rb -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | [![Project Status: Unsupported – The project has reached a stable, usable state, but the author(s) have ceased all work on it. A new maintainer is desired.](https://www.repostatus.org/badges/latest/unsupported.svg)](https://www.repostatus.org/#unsupported) 2 | 3 | ## Note: This repository has been archived. There will likely be no further development at this repo, and security vulnerabilities may be unaddressed. 4 | ## The repo may be cloned and used under its current license. 5 | 6 | 7 | # NGINX Unit tap 8 | 9 | This is official [Homebrew](https://brew.sh) tap for [NGINX Unit](https://unit.nginx.org), lightweight, dynamic, open-source server. 10 | 11 | ## How do I install these formulae? 12 | `brew install nginx/unit/` 13 | 14 | Or `brew tap nginx/unit` and then `brew install `. 15 | 16 | ## Documentation 17 | `brew help`, `man brew` or check [Homebrew's documentation](https://docs.brew.sh). 18 | -------------------------------------------------------------------------------- /Formula/unit-wasm.rb: -------------------------------------------------------------------------------- 1 | class UnitWasm < Formula 2 | desc "Ruby module for Unit application server" 3 | homepage "https://unit.nginx.org" 4 | url "https://github.com/nginx/unit.git", 5 | tag: "1.34.2", 6 | revision: "8ab74a8cc929272eb8683d3f6ab4cb406465fd34" 7 | head "https://github.com/nginx/unit.git", branch: "master" 8 | 9 | depends_on "rust" => :build 10 | depends_on "openssl@3" 11 | depends_on "unit@1.34.2" 12 | depends_on "wasmtime" 13 | 14 | def install 15 | system "./configure", 16 | "--prefix=#{prefix}", 17 | "--sbindir=#{bin}", 18 | "--logdir=#{var}/log", 19 | "--log=#{var}/log/unit/unit.log", 20 | "--runstatedir=#{var}/run", 21 | "--pid=#{var}/run/unit/unit.pid", 22 | "--control=unix:#{var}/run/unit/control.sock", 23 | "--modulesdir=#{HOMEBREW_PREFIX}/lib/unit/modules", 24 | "--statedir=#{var}/state/unit", 25 | "--tmpdir=/tmp", 26 | "--openssl", 27 | "--cc-opt=-I#{Formula["openssl"].opt_prefix}/include -DNXT_HAVE_ISOLATION_ROOTFS=1", 28 | "--ld-opt=-L#{Formula["openssl"].opt_prefix}/lib" 29 | 30 | inreplace "build/autoconf.data", 31 | "NXT_MODULESDIR='#{HOMEBREW_PREFIX}/lib/unit/modules'", 32 | "NXT_MODULESDIR='#{lib}/unit/modules'" 33 | 34 | system "./configure", "wasm", "--module=wasm", 35 | "--include-path=#{HOMEBREW_PREFIX}/usr/include/", 36 | "--lib-path=#{HOMEBREW_PREFIX}/lib/" 37 | system "make", "wasm-install" 38 | 39 | system "./configure", "wasm-wasi-component" 40 | system "make", "wasm-wasi-component-install" 41 | end 42 | end 43 | -------------------------------------------------------------------------------- /Formula/unit-php.rb: -------------------------------------------------------------------------------- 1 | class UnitPhp < Formula 2 | desc "PHP module for Unit application server" 3 | homepage "https://unit.nginx.org" 4 | url "https://github.com/nginx/unit.git", 5 | tag: "1.34.2", 6 | revision: "8ab74a8cc929272eb8683d3f6ab4cb406465fd34" 7 | head "https://github.com/nginx/unit.git", branch: "master" 8 | 9 | depends_on "openssl@3" 10 | depends_on "php-embed" 11 | depends_on "unit@1.34.2" 12 | 13 | def install 14 | system "./configure", 15 | "--prefix=#{prefix}", 16 | "--sbindir=#{bin}", 17 | "--logdir=#{var}/log", 18 | "--log=#{var}/log/unit/unit.log", 19 | "--runstatedir=#{var}/run", 20 | "--pid=#{var}/run/unit/unit.pid", 21 | "--control=unix:#{var}/run/unit/control.sock", 22 | "--modulesdir=#{HOMEBREW_PREFIX}/lib/unit/modules", 23 | "--statedir=#{var}/state/unit", 24 | "--tmpdir=/tmp", 25 | "--openssl", 26 | "--cc-opt=-I#{Formula["openssl"].opt_prefix}/include", 27 | "--ld-opt=-L#{Formula["openssl"].opt_prefix}/lib" 28 | 29 | inreplace "build/autoconf.data", 30 | "NXT_MODULESDIR='#{HOMEBREW_PREFIX}/lib/unit/modules'", 31 | "NXT_MODULESDIR='#{lib}/unit/modules'" 32 | 33 | system "./configure", "php" 34 | system "make", "php-install" 35 | end 36 | 37 | test do 38 | require "socket" 39 | 40 | server = TCPServer.new(0) 41 | port = server.addr[1] 42 | server.close 43 | 44 | expected_output = "Hello world!" 45 | (testpath/"unit.conf").write <<~EOS 46 | { 47 | "listeners": { "*:#{port}": { "pass": "applications/test" } }, 48 | "applications": { 49 | "test": { "type": "php", "root": "#{testpath}" } 50 | } 51 | } 52 | EOS 53 | (testpath/"index.php").write <<~EOS 54 | 55 | EOS 56 | (testpath/"state/certs").mkpath 57 | 58 | system "#{HOMEBREW_PREFIX}/bin/unitd", "--log", "#{testpath}/unit.log", 59 | "--control", "unix:#{testpath}/control.sock", 60 | "--pid", "#{testpath}/unit.pid", 61 | "--statedir", "#{testpath}/state" 62 | sleep 3 63 | 64 | pid = File.open(testpath/"unit.pid").gets.chop.to_i 65 | 66 | system "curl", "-s", "--unix-socket", "#{testpath}/control.sock", 67 | "-X", "PUT", 68 | "-d", "@#{testpath}/unit.conf", "127.0.0.1/config" 69 | 70 | assert_match expected_output, shell_output("curl -s 127.0.0.1:#{port}") 71 | ensure 72 | Process.kill("TERM", pid) 73 | end 74 | end 75 | -------------------------------------------------------------------------------- /Formula/unit-perl.rb: -------------------------------------------------------------------------------- 1 | class UnitPerl < Formula 2 | desc "Perl module for Unit application server" 3 | homepage "https://unit.nginx.org" 4 | url "https://github.com/nginx/unit.git", 5 | tag: "1.34.2", 6 | revision: "8ab74a8cc929272eb8683d3f6ab4cb406465fd34" 7 | head "https://github.com/nginx/unit.git", branch: "master" 8 | 9 | depends_on "openssl@3" 10 | depends_on "perl" 11 | depends_on "unit@1.34.2" 12 | 13 | def install 14 | system "./configure", 15 | "--prefix=#{prefix}", 16 | "--sbindir=#{bin}", 17 | "--logdir=#{var}/log", 18 | "--log=#{var}/log/unit/unit.log", 19 | "--runstatedir=#{var}/run", 20 | "--pid=#{var}/run/unit/unit.pid", 21 | "--control=unix:#{var}/run/unit/control.sock", 22 | "--modulesdir=#{HOMEBREW_PREFIX}/lib/unit/modules", 23 | "--statedir=#{var}/state/unit", 24 | "--tmpdir=/tmp", 25 | "--openssl", 26 | "--cc-opt=-I#{Formula["openssl"].opt_prefix}/include -Wno-compound-token-split-by-macro", 27 | "--ld-opt=-L#{Formula["openssl"].opt_prefix}/lib" 28 | 29 | inreplace "build/autoconf.data", 30 | "NXT_MODULESDIR='#{HOMEBREW_PREFIX}/lib/unit/modules'", 31 | "NXT_MODULESDIR='#{lib}/unit/modules'" 32 | 33 | system "./configure", "perl" 34 | system "make", "perl" 35 | system "make", "perl-install" 36 | end 37 | 38 | test do 39 | require "socket" 40 | 41 | server = TCPServer.new(0) 42 | port = server.addr[1] 43 | server.close 44 | 45 | expected_output = "Hello world!" 46 | (testpath/"unit.conf").write <<~EOS 47 | { 48 | "listeners": { "*:#{port}": { "pass": "applications/test" } }, 49 | "applications": { 50 | "test": { "type": "perl", "script": "#{testpath}/psgi.pl" } 51 | } 52 | } 53 | EOS 54 | (testpath/"psgi.pl").write <<~EOS 55 | my $app = sub { 56 | my ($environ) = @_; 57 | 58 | return ['200', [], ['#{expected_output}']]; 59 | }; 60 | EOS 61 | (testpath/"state/certs").mkpath 62 | 63 | system "#{HOMEBREW_PREFIX}/bin/unitd", "--log", "#{testpath}/unit.log", 64 | "--control", "unix:#{testpath}/control.sock", 65 | "--pid", "#{testpath}/unit.pid", 66 | "--statedir", "#{testpath}/state" 67 | sleep 3 68 | 69 | pid = File.open(testpath/"unit.pid").gets.chop.to_i 70 | 71 | system "curl", "-s", "--unix-socket", "#{testpath}/control.sock", 72 | "-X", "PUT", 73 | "-d", "@#{testpath}/unit.conf", "127.0.0.1/config" 74 | 75 | assert_match expected_output, shell_output("curl -s 127.0.0.1:#{port}") 76 | ensure 77 | Process.kill("TERM", pid) 78 | end 79 | end 80 | -------------------------------------------------------------------------------- /Formula/unit-java.rb: -------------------------------------------------------------------------------- 1 | class UnitJava < Formula 2 | desc "Java module for Unit application server" 3 | homepage "https://unit.nginx.org" 4 | url "https://github.com/nginx/unit.git", 5 | tag: "1.34.2", 6 | revision: "8ab74a8cc929272eb8683d3f6ab4cb406465fd34" 7 | head "https://github.com/nginx/unit.git", branch: "master" 8 | 9 | depends_on "openjdk@11" 10 | depends_on "openssl@3" 11 | depends_on "unit@1.34.2" 12 | 13 | def install 14 | system "./configure", 15 | "--prefix=#{prefix}", 16 | "--sbindir=#{bin}", 17 | "--logdir=#{var}/log", 18 | "--log=#{var}/log/unit/unit.log", 19 | "--runstatedir=#{var}/run", 20 | "--pid=#{var}/run/unit/unit.pid", 21 | "--control=unix:#{var}/run/unit/control.sock", 22 | "--modulesdir=#{HOMEBREW_PREFIX}/lib/unit/modules", 23 | "--statedir=#{var}/state/unit", 24 | "--tmpdir=/tmp", 25 | "--openssl", 26 | "--cc-opt=-I#{Formula["openssl"].opt_prefix}/include", 27 | "--ld-opt=-L#{Formula["openssl"].opt_prefix}/lib" 28 | 29 | inreplace "build/autoconf.data", 30 | "NXT_MODULESDIR='#{HOMEBREW_PREFIX}/lib/unit/modules'", 31 | "NXT_MODULESDIR='#{lib}/unit/modules'" 32 | 33 | inreplace "auto/modules/java", 34 | "$NXT_JAVAC -version 2>&1", "$NXT_JAVAC -version 2>/dev/null" 35 | 36 | system "./configure", "java" 37 | system "make", "java" 38 | system "make", "java-install" 39 | end 40 | 41 | test do 42 | require "socket" 43 | 44 | server = TCPServer.new(0) 45 | port = server.addr[1] 46 | server.close 47 | 48 | expected_output = "Hello world!" 49 | (testpath/"unit.conf").write <<~EOS 50 | { 51 | "listeners": { "*:#{port}": { "pass": "applications/test" } }, 52 | "applications": { 53 | "test": { "type": "java", "webapp": "#{testpath}" } 54 | } 55 | } 56 | EOS 57 | (testpath/"index.jsp").write <<~EOS 58 | <%@ page contentType="text/plain"%>#{expected_output} 59 | EOS 60 | (testpath/"state/certs").mkpath 61 | 62 | system "#{HOMEBREW_PREFIX}/bin/unitd", "--log", "#{testpath}/unit.log", 63 | "--control", "unix:#{testpath}/control.sock", 64 | "--pid", "#{testpath}/unit.pid", 65 | "--statedir", "#{testpath}/state" 66 | sleep 3 67 | 68 | pid = File.open(testpath/"unit.pid").gets.chop.to_i 69 | 70 | system "curl", "-s", "--unix-socket", "#{testpath}/control.sock", 71 | "-X", "PUT", 72 | "-d", "@#{testpath}/unit.conf", "127.0.0.1/config" 73 | 74 | assert_match expected_output, shell_output("curl -s 127.0.0.1:#{port}") 75 | ensure 76 | Process.kill("TERM", pid) 77 | end 78 | end 79 | -------------------------------------------------------------------------------- /Formula/unit-python.rb: -------------------------------------------------------------------------------- 1 | class UnitPython < Formula 2 | desc "Python module for Unit application server" 3 | homepage "https://unit.nginx.org" 4 | url "https://github.com/nginx/unit.git", 5 | tag: "1.34.2", 6 | revision: "8ab74a8cc929272eb8683d3f6ab4cb406465fd34" 7 | head "https://github.com/nginx/unit.git", branch: "master" 8 | 9 | depends_on :macos 10 | depends_on maximum_macos: :big_sur 11 | depends_on "openssl@3" 12 | depends_on "unit@1.34.2" 13 | uses_from_macos "python" 14 | 15 | def install 16 | system "./configure", 17 | "--prefix=#{prefix}", 18 | "--sbindir=#{bin}", 19 | "--logdir=#{var}/log", 20 | "--log=#{var}/log/unit/unit.log", 21 | "--runstatedir=#{var}/run", 22 | "--pid=#{var}/run/unit/unit.pid", 23 | "--control=unix:#{var}/run/unit/control.sock", 24 | "--modulesdir=#{HOMEBREW_PREFIX}/lib/unit/modules", 25 | "--statedir=#{var}/state/unit", 26 | "--tmpdir=/tmp", 27 | "--openssl", 28 | "--cc-opt=-I#{Formula["openssl"].opt_prefix}/include", 29 | "--ld-opt=-L#{Formula["openssl"].opt_prefix}/lib" 30 | 31 | inreplace "build/autoconf.data", 32 | "NXT_MODULESDIR='#{HOMEBREW_PREFIX}/lib/unit/modules'", 33 | "NXT_MODULESDIR='#{lib}/unit/modules'" 34 | 35 | system "./configure", "python" 36 | system "make", "python-install" 37 | end 38 | 39 | test do 40 | require "socket" 41 | 42 | server = TCPServer.new(0) 43 | port = server.addr[1] 44 | server.close 45 | 46 | expected_output = "Hello world!" 47 | (testpath/"unit.conf").write <<~EOS 48 | { 49 | "listeners": { "*:#{port}": { "pass": "applications/test" } }, 50 | "applications": { 51 | "test": { "type": "python 2", "path": "#{testpath}", "module": "wsgi" } 52 | } 53 | } 54 | EOS 55 | (testpath/"wsgi.py").write <<~EOS 56 | def application(environ, start_response): 57 | start_response('200 OK', [('Content-type', 'text/plain')]) 58 | return b"#{expected_output}" 59 | EOS 60 | (testpath/"state/certs").mkpath 61 | 62 | system "#{HOMEBREW_PREFIX}/bin/unitd", "--log", "#{testpath}/unit.log", 63 | "--control", "unix:#{testpath}/control.sock", 64 | "--pid", "#{testpath}/unit.pid", 65 | "--statedir", "#{testpath}/state" 66 | sleep 3 67 | 68 | pid = File.open(testpath/"unit.pid").gets.chop.to_i 69 | 70 | system "curl", "-s", "--unix-socket", "#{testpath}/control.sock", 71 | "-X", "PUT", 72 | "-d", "@#{testpath}/unit.conf", "127.0.0.1/config" 73 | 74 | assert_match expected_output, shell_output("curl -s 127.0.0.1:#{port}") 75 | ensure 76 | Process.kill("TERM", pid) 77 | end 78 | end 79 | -------------------------------------------------------------------------------- /Formula/unit-python3.rb: -------------------------------------------------------------------------------- 1 | class UnitPython3 < Formula 2 | desc "Python3 module for Unit application server" 3 | homepage "https://unit.nginx.org" 4 | url "https://github.com/nginx/unit.git", 5 | tag: "1.34.2", 6 | revision: "8ab74a8cc929272eb8683d3f6ab4cb406465fd34" 7 | head "https://github.com/nginx/unit.git", branch: "master" 8 | 9 | depends_on "openssl@3" 10 | depends_on "python@3.12" 11 | depends_on "unit@1.34.2" 12 | 13 | def install 14 | system "./configure", 15 | "--prefix=#{prefix}", 16 | "--sbindir=#{bin}", 17 | "--logdir=#{var}/log", 18 | "--log=#{var}/log/unit/unit.log", 19 | "--runstatedir=#{var}/run", 20 | "--pid=#{var}/run/unit/unit.pid", 21 | "--control=unix:#{var}/run/unit/control.sock", 22 | "--modulesdir=#{HOMEBREW_PREFIX}/lib/unit/modules", 23 | "--statedir=#{var}/state/unit", 24 | "--tmpdir=/tmp", 25 | "--openssl", 26 | "--cc-opt=-I#{Formula["openssl"].opt_prefix}/include", 27 | "--ld-opt=-L#{Formula["openssl"].opt_prefix}/lib" 28 | 29 | inreplace "build/autoconf.data", 30 | "NXT_MODULESDIR='#{HOMEBREW_PREFIX}/lib/unit/modules'", 31 | "NXT_MODULESDIR='#{lib}/unit/modules'" 32 | 33 | system "./configure", "python", 34 | "--module=python3", 35 | "--config=python3-config" 36 | system "make", "python3-install" 37 | end 38 | 39 | test do 40 | require "socket" 41 | 42 | server = TCPServer.new(0) 43 | port = server.addr[1] 44 | server.close 45 | 46 | expected_output = "Hello world!" 47 | (testpath/"unit.conf").write <<~EOS 48 | { 49 | "listeners": { "*:#{port}": { "pass": "applications/test" } }, 50 | "applications": { 51 | "test": { "type": "python 3", "path": "#{testpath}", "module": "wsgi" } 52 | } 53 | } 54 | EOS 55 | (testpath/"wsgi.py").write <<~EOS 56 | def application(environ, start_response): 57 | start_response('200 OK', [('Content-type', 'text/plain')]) 58 | return b"#{expected_output}" 59 | EOS 60 | (testpath/"state/certs").mkpath 61 | 62 | system "#{HOMEBREW_PREFIX}/bin/unitd", "--log", "#{testpath}/unit.log", 63 | "--control", "unix:#{testpath}/control.sock", 64 | "--pid", "#{testpath}/unit.pid", 65 | "--statedir", "#{testpath}/state" 66 | sleep 3 67 | 68 | pid = File.open(testpath/"unit.pid").gets.chop.to_i 69 | 70 | system "curl", "-s", "--unix-socket", "#{testpath}/control.sock", 71 | "-X", "PUT", 72 | "-d", "@#{testpath}/unit.conf", "127.0.0.1/config" 73 | 74 | assert_match expected_output, shell_output("curl -s 127.0.0.1:#{port}") 75 | ensure 76 | Process.kill("TERM", pid) 77 | end 78 | end 79 | -------------------------------------------------------------------------------- /Formula/unit-ruby.rb: -------------------------------------------------------------------------------- 1 | class UnitRuby < Formula 2 | desc "Ruby module for Unit application server" 3 | homepage "https://unit.nginx.org" 4 | url "https://github.com/nginx/unit.git", 5 | tag: "1.34.2", 6 | revision: "8ab74a8cc929272eb8683d3f6ab4cb406465fd34" 7 | head "https://github.com/nginx/unit.git", branch: "master" 8 | 9 | depends_on "openssl@3" 10 | depends_on "ruby" 11 | depends_on "unit@1.34.2" 12 | 13 | def install 14 | system "./configure", 15 | "--prefix=#{prefix}", 16 | "--sbindir=#{bin}", 17 | "--logdir=#{var}/log", 18 | "--log=#{var}/log/unit/unit.log", 19 | "--runstatedir=#{var}/run", 20 | "--pid=#{var}/run/unit/unit.pid", 21 | "--control=unix:#{var}/run/unit/control.sock", 22 | "--modulesdir=#{HOMEBREW_PREFIX}/lib/unit/modules", 23 | "--statedir=#{var}/state/unit", 24 | "--tmpdir=/tmp", 25 | "--openssl", 26 | "--cc-opt=-I#{Formula["openssl"].opt_prefix}/include -DNXT_HAVE_ISOLATION_ROOTFS=1", 27 | "--ld-opt=-L#{Formula["openssl"].opt_prefix}/lib" 28 | 29 | inreplace "build/autoconf.data", 30 | "NXT_MODULESDIR='#{HOMEBREW_PREFIX}/lib/unit/modules'", 31 | "NXT_MODULESDIR='#{lib}/unit/modules'" 32 | 33 | system "./configure", "ruby", "--module=ruby", 34 | "--ruby=#{Formula["ruby"].opt_prefix}/bin/ruby" 35 | system "make", "ruby-install" 36 | end 37 | 38 | def caveats 39 | <<~EOS 40 | Make sure rack gem installed: 41 | #{Formula["ruby"].opt_prefix}/bin/gem install rack 42 | EOS 43 | end 44 | 45 | test do 46 | require "socket" 47 | 48 | server = TCPServer.new(0) 49 | port = server.addr[1] 50 | server.close 51 | 52 | expected_output = "Hello world!" 53 | (testpath/"unit.conf").write <<~EOS 54 | { 55 | "listeners": { "*:#{port}": { "pass": "applications/test" } }, 56 | "applications": { 57 | "test": { "type": "ruby", "script": "#{testpath}/oper.ru" } 58 | } 59 | } 60 | EOS 61 | (testpath/"oper.ru").write <<~EOS 62 | app = Proc.new do |env| 63 | ['200', { 'Content-Type' => 'text/plain', }, ["#{expected_output}"]] 64 | end 65 | 66 | run app 67 | EOS 68 | (testpath/"state/certs").mkpath 69 | 70 | system "#{Formula["ruby"].opt_prefix}/bin/gem", "install", "rack" 71 | 72 | system "#{HOMEBREW_PREFIX}/bin/unitd", "--log", "#{testpath}/unit.log", 73 | "--control", "unix:#{testpath}/control.sock", 74 | "--pid", "#{testpath}/unit.pid", 75 | "--statedir", "#{testpath}/state" 76 | sleep 3 77 | 78 | pid = File.open(testpath/"unit.pid").gets.chop.to_i 79 | 80 | system "curl", "-s", "--unix-socket", "#{testpath}/control.sock", 81 | "-X", "PUT", 82 | "-d", "@#{testpath}/unit.conf", "127.0.0.1/config" 83 | 84 | assert_match expected_output, shell_output("curl -s 127.0.0.1:#{port}") 85 | ensure 86 | Process.kill("TERM", pid) 87 | end 88 | end 89 | -------------------------------------------------------------------------------- /.github/workflows/main.yml: -------------------------------------------------------------------------------- 1 | name: brew test-bot 2 | 3 | on: 4 | pull_request: 5 | 6 | jobs: 7 | check-generate: 8 | runs-on: macOS-14 9 | outputs: 10 | matrix: ${{ steps.generate-matrix.outputs.matrix }} 11 | steps: 12 | - name: Set up Homebrew 13 | id: set-up-homebrew 14 | uses: Homebrew/actions/setup-homebrew@master 15 | with: 16 | core: true 17 | 18 | - name: Cache Homebrew Bundler RubyGems 19 | id: cache 20 | uses: actions/cache@v4 21 | with: 22 | path: ${{ steps.set-up-homebrew.outputs.gems-path }} 23 | key: ${{ runner.os }}-rubygems-${{ steps.set-up-homebrew.outputs.gems-hash }} 24 | restore-keys: ${{ runner.os }}-rubygems- 25 | 26 | - name: Install Homebrew Bundler RubyGems 27 | if: steps.cache.outputs.cache-hit != 'true' 28 | run: brew install-bundler-gems 29 | 30 | - run: brew test-bot --only-tap-syntax 31 | 32 | - run: brew test-bot --only-formulae-detect 33 | id: formulae-detect 34 | 35 | - name: generate matrix 36 | id: generate-matrix 37 | run: | 38 | JSON="{\"include\":[" 39 | for os in macos-14 ubuntu-24.04; do 40 | for formula in $( echo ${{ steps.formulae-detect.outputs.testing_formulae }} | tr ',' ' ' ); do 41 | JSON="$JSON$( jq -nRr '( $ARGS.positional[] | { os: $os, formulae: . }) | tojson' --arg os "$os" --args "$formula" )," 42 | done 43 | done 44 | 45 | if [[ "$JSON" == *, ]]; then 46 | JSON="${JSON%?}" 47 | fi 48 | JSON="$JSON]}" 49 | echo "$JSON" 50 | echo "matrix=$JSON" >> "$GITHUB_OUTPUT" 51 | 52 | build-formulae: 53 | name: ${{ matrix.os }}, ${{ matrix.formulae }} 54 | needs: check-generate 55 | runs-on: ${{ matrix.os }} 56 | strategy: 57 | matrix: ${{fromJson(needs.check-generate.outputs.matrix)}} 58 | 59 | steps: 60 | - name: Set up Homebrew 61 | id: set-up-homebrew 62 | uses: Homebrew/actions/setup-homebrew@master 63 | with: 64 | core: true 65 | 66 | - name: Cache Homebrew Bundler RubyGems 67 | id: cache 68 | uses: actions/cache@v4 69 | with: 70 | path: ${{ steps.set-up-homebrew.outputs.gems-path }} 71 | key: ${{ runner.os }}-rubygems-${{ steps.set-up-homebrew.outputs.gems-hash }} 72 | restore-keys: ${{ runner.os }}-rubygems- 73 | 74 | - name: Install Homebrew Bundler RubyGems 75 | if: steps.cache.outputs.cache-hit != 'true' 76 | run: brew install-bundler-gems 77 | 78 | - run: brew test-bot --only-cleanup-before 79 | 80 | - run: brew test-bot --only-setup 81 | 82 | - name: build ${{ matrix.formulae }} 83 | run: | 84 | formula=${{ matrix.formulae }} 85 | case "$formula" in 86 | *-php) 87 | formula="nginx/unit/php-embed,nginx/unit/unit,$formula" 88 | ;; 89 | *unit-*) 90 | formula="nginx/unit/unit,$formula" 91 | ;; 92 | esac 93 | brew test-bot --only-formulae --testing-formulae="$formula" --fail-fast 94 | -------------------------------------------------------------------------------- /.github/workflows/manual.yml: -------------------------------------------------------------------------------- 1 | name: Rebuild everything 2 | on: 3 | schedule: 4 | - cron: '30 0 * * Mon' 5 | workflow_dispatch: 6 | jobs: 7 | test-bot: 8 | name: Check syntax 9 | runs-on: macOS-14 10 | steps: 11 | - name: Set up Homebrew 12 | id: set-up-homebrew 13 | uses: Homebrew/actions/setup-homebrew@master 14 | with: 15 | core: true 16 | 17 | - run: brew test-bot --only-cleanup-before 18 | 19 | - run: brew test-bot --only-setup 20 | 21 | - run: brew test-bot --only-tap-syntax 22 | 23 | build-unit: 24 | name: Build Unit 25 | needs: test-bot 26 | runs-on: ${{ matrix.os }} 27 | strategy: 28 | fail-fast: false 29 | matrix: 30 | os: [ubuntu-24.04, macOS-13, macOS-14, macOS-15] 31 | steps: 32 | - name: Set up Homebrew 33 | id: set-up-homebrew 34 | uses: Homebrew/actions/setup-homebrew@master 35 | with: 36 | core: true 37 | 38 | - name: Build Unit 39 | run: 40 | brew install --build-from-source unit 41 | 42 | build-unit-perl: 43 | name: Build Unit Perl module 44 | needs: build-unit 45 | runs-on: ${{ matrix.os }} 46 | strategy: 47 | fail-fast: false 48 | matrix: 49 | os: [ubuntu-24.04, macOS-13, macOS-14, macOS-15] 50 | steps: 51 | - name: Set up Homebrew 52 | id: set-up-homebrew 53 | uses: Homebrew/actions/setup-homebrew@master 54 | with: 55 | core: true 56 | 57 | - name: Build Unit Perl module 58 | run: | 59 | brew install --build-from-source perl 60 | brew install --build-from-source Formula/unit-perl.rb 61 | 62 | build-unit-python3: 63 | name: Build Unit Python 3 module 64 | needs: build-unit 65 | runs-on: ${{ matrix.os }} 66 | strategy: 67 | fail-fast: false 68 | matrix: 69 | os: [ubuntu-24.04, macOS-13, macOS-14, macOS-15] 70 | steps: 71 | - name: Set up Homebrew 72 | id: set-up-homebrew 73 | uses: Homebrew/actions/setup-homebrew@master 74 | with: 75 | core: true 76 | 77 | - name: Build Unit Python 3 module 78 | run: 79 | brew install --build-from-source Formula/unit-python3.rb 80 | 81 | build-unit-java: 82 | name: Build Unit Java module 83 | needs: build-unit 84 | runs-on: ${{ matrix.os }} 85 | strategy: 86 | fail-fast: false 87 | matrix: 88 | os: [ubuntu-24.04, macOS-13, macOS-14, macOS-15] 89 | steps: 90 | - name: Set up Homebrew 91 | id: set-up-homebrew 92 | uses: Homebrew/actions/setup-homebrew@master 93 | with: 94 | core: true 95 | 96 | - name: Build Unit Java module 97 | run: 98 | brew install --build-from-source Formula/unit-java.rb 99 | 100 | build-unit-ruby: 101 | name: Build Unit Ruby module 102 | needs: build-unit 103 | runs-on: ${{ matrix.os }} 104 | strategy: 105 | fail-fast: false 106 | matrix: 107 | os: [ubuntu-24.04, macOS-13, macOS-14, macOS-15] 108 | steps: 109 | - name: Set up Homebrew 110 | id: set-up-homebrew 111 | uses: Homebrew/actions/setup-homebrew@master 112 | with: 113 | core: true 114 | 115 | - name: Build Unit Ruby module 116 | run: 117 | brew install --build-from-source Formula/unit-ruby.rb 118 | 119 | build-unit-php: 120 | name: Build Unit PHP module 121 | needs: build-unit 122 | runs-on: ${{ matrix.os }} 123 | strategy: 124 | fail-fast: false 125 | matrix: 126 | os: [ubuntu-24.04, macOS-13, macOS-14, macOS-15] 127 | steps: 128 | - name: Set up Homebrew 129 | id: set-up-homebrew 130 | uses: Homebrew/actions/setup-homebrew@master 131 | with: 132 | core: true 133 | 134 | - name: Build Unit PHP module 135 | run: 136 | brew install --build-from-source Formula/unit-php.rb 137 | 138 | build-unit-wasm: 139 | name: Build Unit WASM module 140 | needs: build-unit 141 | runs-on: ${{ matrix.os }} 142 | strategy: 143 | fail-fast: false 144 | matrix: 145 | os: [ubuntu-24.04, macOS-13, macOS-14, macOS-15] 146 | steps: 147 | - name: Set up Homebrew 148 | id: set-up-homebrew 149 | uses: Homebrew/actions/setup-homebrew@master 150 | with: 151 | core: true 152 | 153 | - name: Build Unit WASM module 154 | run: 155 | brew install --build-from-source Formula/unit-wasm.rb 156 | -------------------------------------------------------------------------------- /Formula/unit.rb: -------------------------------------------------------------------------------- 1 | class Unit < Formula 2 | desc "Dynamic web and application server" 3 | homepage "https://unit.nginx.org" 4 | url "https://github.com/nginx/unit.git", 5 | tag: "1.34.2", 6 | revision: "8ab74a8cc929272eb8683d3f6ab4cb406465fd34" 7 | head "https://github.com/nginx/unit.git", branch: "master" 8 | 9 | depends_on "rust" => :build 10 | depends_on "libedit" 11 | depends_on "openssl@3" 12 | depends_on "pcre2" 13 | depends_on "pkg-config" 14 | 15 | resource "njs" do 16 | url "https://github.com/nginx/njs.git", 17 | tag: "0.8.8", 18 | revision: "78e3edf7505cd04a5df0b7936bcd2d89e95bdda8" 19 | end 20 | 21 | resource "unitctl" do 22 | src_repo = "https://github.com/nginx/unit" 23 | if OS.mac? && Hardware::CPU.intel? 24 | url "#{src_repo}/releases/download/#{Unit.version}/unitctl-#{Unit.version}-x86_64-apple-darwin" 25 | sha256 "370b709f4b2cb76e633afde66de6b6bec75943697061fdc8b0036f8209118d1d" 26 | elsif OS.mac? && Hardware::CPU.arm? 27 | url "#{src_repo}/releases/download/#{Unit.version}/unitctl-#{Unit.version}-aarch64-apple-darwin" 28 | sha256 "7fc20ce207b5a3e3f6906d658c441347499013d6eaaff782564432783a60fa14" 29 | elsif OS.linux? && Hardware::CPU.intel? 30 | url "#{src_repo}/releases/download/#{Unit.version}/unitctl-#{Unit.version}-x86_64-unknown-linux-gnu" 31 | sha256 "2dd37ee2c663c1f5394ab7c4de79884327aad98ff4e3164b9f0a1b27859789c4" 32 | elsif OS.linux? && Hardware::CPU.arm? && Hardware::CPU.is_64_bit? 33 | url "#{src_repo}/releases/download/#{Unit.version}/unitctl-#{Unit.version}-aarch64-unknown-linux-gnu" 34 | sha256 "0019dfc4b32d63c1392aa264aed2253c1e0c2fb09216f8e2cc269bbfb8bb49b5" 35 | else 36 | odie "Unsupported architecture" 37 | end 38 | end 39 | 40 | def install 41 | resource("unitctl").stage buildpath/"unitctl" 42 | cd "unitctl" do 43 | bin.install Dir.glob("unitctl-*").first => "unitctl" 44 | end 45 | 46 | resource("njs").stage buildpath/"njs" 47 | cd "njs" do 48 | system "./configure", "--no-libxml2", "--no-zlib", "--no-openssl", "--no-quickjs" 49 | system "make", "libnjs", "njs" 50 | bin.install "build/njs" => "njs-unit" 51 | end 52 | 53 | ENV.prepend_path "PKG_CONFIG_PATH", buildpath/"njs/build" 54 | system "./configure", 55 | "--prefix=#{prefix}", 56 | "--sbindir=#{bin}", 57 | "--logdir=#{var}/log", 58 | "--log=#{var}/log/unit/unit.log", 59 | "--runstatedir=#{var}/run", 60 | "--pid=#{var}/run/unit/unit.pid", 61 | "--control=unix:#{var}/run/unit/control.sock", 62 | "--modulesdir=#{HOMEBREW_PREFIX}/lib/unit/modules", 63 | "--statedir=#{var}/state/unit", 64 | "--tmpdir=/tmp", 65 | "--openssl", 66 | "--njs", 67 | "--otel", 68 | "--cc-opt=-I#{Formula["openssl"].opt_prefix}/include", 69 | "--ld-opt=-L#{Formula["openssl"].opt_prefix}/lib" 70 | 71 | system "make" 72 | system "make", "install", "libunit-install" 73 | bin.install "tools/setup-unit" 74 | bin.install "tools/unitc" 75 | end 76 | 77 | def post_install 78 | (lib/"unit/modules").mkpath 79 | (var/"log/unit").mkpath 80 | (var/"run/unit").mkpath 81 | (var/"state/unit/certs").mkpath 82 | end 83 | 84 | service do 85 | run [opt_bin/"unitd", "--no-daemon"] 86 | run_type :immediate 87 | end 88 | 89 | test do 90 | require "socket" 91 | 92 | server = TCPServer.new(0) 93 | port = server.addr[1] 94 | server.close 95 | 96 | expected_output = "Hello world!" 97 | (testpath/"index.html").write expected_output 98 | (testpath/"unit.conf").write <<~EOS 99 | { 100 | "routes": [ { "action": { "share": "#{testpath}/$uri" } } ], 101 | "listeners": { "*:#{port}": { "pass": "routes" } } 102 | } 103 | EOS 104 | 105 | system bin/"unitd", "--log", "#{testpath}/unit.log", 106 | "--control", "unix:#{testpath}/control.sock", 107 | "--pid", "#{testpath}/unit.pid", 108 | "--statedir", "#{testpath}/state" 109 | sleep 3 110 | 111 | pid = File.open(testpath/"unit.pid").gets.chop.to_i 112 | 113 | system "curl", "-s", "--unix-socket", "#{testpath}/control.sock", 114 | "-X", "PUT", 115 | "-d", "@#{testpath}/unit.conf", "127.0.0.1/config" 116 | 117 | assert_match expected_output, shell_output("curl -s 127.0.0.1:#{port}") 118 | ensure 119 | Process.kill("TERM", pid) 120 | end 121 | end 122 | -------------------------------------------------------------------------------- /Formula/php-embed.rb: -------------------------------------------------------------------------------- 1 | class PhpEmbed < Formula 2 | desc "PHP library for embedding in applications" 3 | homepage "https://www.php.net/" 4 | # Should only be updated if the new version is announced on the homepage, https://www.php.net/ 5 | url "https://www.php.net/distributions/php-8.4.2.tar.xz" 6 | mirror "https://fossies.org/linux/www/php-8.4.2.tar.xz" 7 | sha256 "92636453210f7f2174d6ee6df17a5811368f556a6c2c2cbcf019321e36456e01" 8 | license "PHP-3.01" 9 | 10 | livecheck do 11 | url "https://www.php.net/downloads" 12 | regex(/href=.*?php[._-]v?(\d+(?:\.\d+)+)\.t/i) 13 | end 14 | 15 | head do 16 | url "https://github.com/php/php-src.git" 17 | 18 | depends_on "bison" => :build # bison >= 3.0.0 required to generate parsers 19 | depends_on "re2c" => :build # required to generate PHP lexers 20 | end 21 | 22 | depends_on "pkgconf" => :build 23 | depends_on "argon2" 24 | depends_on "curl" 25 | depends_on "freetds" 26 | depends_on "gd" 27 | depends_on "gettext" 28 | depends_on "gmp" 29 | depends_on "icu4c@76" 30 | depends_on "krb5" 31 | depends_on "libpq" 32 | depends_on "libsodium" 33 | depends_on "libzip" 34 | depends_on "net-snmp" 35 | depends_on "oniguruma" 36 | depends_on "openldap" 37 | depends_on "openssl@3" 38 | depends_on "pcre2" 39 | depends_on "php" 40 | depends_on "sqlite" 41 | depends_on "tidy-html5" 42 | depends_on "unixodbc" 43 | 44 | uses_from_macos "xz" => :build 45 | uses_from_macos "bzip2" 46 | uses_from_macos "libedit" 47 | uses_from_macos "libffi", since: :catalina 48 | uses_from_macos "libxml2" 49 | uses_from_macos "libxslt" 50 | uses_from_macos "zlib" 51 | 52 | on_macos do 53 | # PHP build system incorrectly links system libraries 54 | # see https://github.com/php/php-src/issues/10680 55 | patch :DATA 56 | end 57 | 58 | def install 59 | # buildconf required due to system library linking bug patch 60 | system "./buildconf", "--force" 61 | 62 | inreplace "configure" do |s| 63 | s.gsub! "$APXS_HTTPD -V 2>/dev/null | grep 'threaded:.*yes' >/dev/null 2>&1", 64 | "false" 65 | s.gsub! "APXS_LIBEXECDIR='$(INSTALL_ROOT)'$($APXS -q LIBEXECDIR)", 66 | "APXS_LIBEXECDIR='$(INSTALL_ROOT)#{lib}/httpd/modules'" 67 | s.gsub! "-z $($APXS -q SYSCONFDIR)", 68 | "-z ''" 69 | s.gsub! "${wl}-flat_namespace ${wl}-undefined ${wl}suppress", 70 | "${wl}-twolevel_namespace" 71 | end 72 | 73 | # Update error message in apache sapi to better explain the requirements 74 | # of using Apache http in combination with php if the non-compatible MPM 75 | # has been selected. Homebrew has chosen not to support being able to 76 | # compile a thread safe version of PHP and therefore it is not 77 | # possible to recompile as suggested in the original message 78 | inreplace "sapi/apache2handler/sapi_apache2.c", 79 | "You need to recompile PHP.", 80 | "Homebrew PHP does not support a thread-safe php binary. " \ 81 | "To use the PHP apache sapi please change " \ 82 | "your httpd config to use the prefork MPM" 83 | 84 | inreplace "sapi/fpm/php-fpm.conf.in", ";daemonize = yes", "daemonize = no" 85 | 86 | config_path = etc/"php/#{php_version}" 87 | # Prevent system pear config from inhibiting pear install 88 | (config_path/"pear.conf").delete if (config_path/"pear.conf").exist? 89 | 90 | # Prevent homebrew from hardcoding path to sed shim in phpize script 91 | ENV["lt_cv_path_SED"] = "sed" 92 | 93 | # system pkg-config missing 94 | ENV["KERBEROS_CFLAGS"] = " " 95 | if OS.mac? 96 | ENV["SASL_CFLAGS"] = "-I#{MacOS.sdk_path_if_needed}/usr/include/sasl" 97 | ENV["SASL_LIBS"] = "-lsasl2" 98 | else 99 | ENV["SQLITE_CFLAGS"] = "-I#{Formula["sqlite"].opt_include}" 100 | ENV["SQLITE_LIBS"] = "-lsqlite3" 101 | ENV["BZIP_DIR"] = Formula["bzip2"].opt_prefix 102 | end 103 | 104 | # Each extension that is built on Mojave needs a direct reference to the 105 | # sdk path or it won't find the headers 106 | headers_path = "=#{MacOS.sdk_path_if_needed}/usr" if OS.mac? 107 | 108 | # `_www` only exists on macOS. 109 | fpm_user = OS.mac? ? "_www" : "www-data" 110 | fpm_group = OS.mac? ? "_www" : "www-data" 111 | 112 | args = %W[ 113 | --prefix=#{prefix} 114 | --localstatedir=#{var} 115 | --sysconfdir=#{config_path} 116 | --with-config-file-path=#{config_path} 117 | --with-config-file-scan-dir=#{config_path}/conf.d 118 | --with-pear=#{pkgshare}/pear 119 | --enable-bcmath 120 | --enable-calendar 121 | --enable-dba 122 | --enable-exif 123 | --enable-ftp 124 | --enable-fpm 125 | --enable-gd 126 | --enable-intl 127 | --enable-mbregex 128 | --enable-mbstring 129 | --enable-mysqlnd 130 | --enable-pcntl 131 | --enable-phpdbg 132 | --enable-phpdbg-readline 133 | --enable-shmop 134 | --enable-soap 135 | --enable-sockets 136 | --enable-sysvmsg 137 | --enable-sysvsem 138 | --enable-sysvshm 139 | --enable-embed=shared 140 | --with-bz2#{headers_path} 141 | --with-curl 142 | --with-external-gd 143 | --with-external-pcre 144 | --with-ffi 145 | --with-fpm-user=#{fpm_user} 146 | --with-fpm-group=#{fpm_group} 147 | --with-gettext=#{Formula["gettext"].opt_prefix} 148 | --with-gmp=#{Formula["gmp"].opt_prefix} 149 | --with-iconv#{headers_path} 150 | --with-layout=GNU 151 | --with-ldap=#{Formula["openldap"].opt_prefix} 152 | --with-libxml 153 | --with-libedit 154 | --with-mhash#{headers_path} 155 | --with-mysql-sock=/tmp/mysql.sock 156 | --with-mysqli=mysqlnd 157 | --with-ndbm#{headers_path} 158 | --with-openssl 159 | --with-password-argon2=#{Formula["argon2"].opt_prefix} 160 | --with-pdo-dblib=#{Formula["freetds"].opt_prefix} 161 | --with-pdo-mysql=mysqlnd 162 | --with-pdo-odbc=unixODBC,#{Formula["unixodbc"].opt_prefix} 163 | --with-pdo-pgsql=#{Formula["libpq"].opt_prefix} 164 | --with-pdo-sqlite 165 | --with-pgsql=#{Formula["libpq"].opt_prefix} 166 | --with-pic 167 | --with-snmp=#{Formula["net-snmp"].opt_prefix} 168 | --with-sodium 169 | --with-sqlite3 170 | --with-tidy=#{Formula["tidy-html5"].opt_prefix} 171 | --with-unixODBC 172 | --with-xsl 173 | --with-zip 174 | --with-zlib 175 | ] 176 | 177 | if OS.mac? 178 | args << "--enable-dtrace" 179 | args << "--with-ldap-sasl" 180 | args << "--with-os-sdkpath=#{MacOS.sdk_path_if_needed}" 181 | else 182 | args << "--disable-dtrace" 183 | args << "--without-ldap-sasl" 184 | args << "--without-ndbm" 185 | args << "--without-gdbm" 186 | end 187 | 188 | system "./configure", *args 189 | 190 | inreplace "Makefile", " -module", "" 191 | 192 | system "make", "libphp.la" 193 | 194 | lib.mkpath 195 | cp ".libs/libphp.dylib", "#{lib}/" if OS.mac? 196 | cp ".libs/libphp.so", "#{lib}/" if OS.linux? 197 | end 198 | 199 | def php_version 200 | version.to_s.split(".")[0..1].join(".") 201 | end 202 | end 203 | 204 | __END__ 205 | diff --git a/build/php.m4 b/build/php.m4 206 | index e45b22b7..4624b390 100644 207 | --- a/build/php.m4 208 | +++ b/build/php.m4 209 | @@ -429,7 +429,7 @@ dnl 210 | dnl Adds a path to linkpath/runpath (LDFLAGS). 211 | dnl 212 | AC_DEFUN([PHP_ADD_LIBPATH],[ 213 | - if test "$1" != "/usr/$PHP_LIBDIR" && test "$1" != "/usr/lib"; then 214 | + if test "$1" != "$PHP_OS_SDKPATH/usr/$PHP_LIBDIR" && test "$1" != "/usr/lib"; then 215 | PHP_EXPAND_PATH($1, ai_p) 216 | ifelse([$2],,[ 217 | _PHP_ADD_LIBPATH_GLOBAL([$ai_p]) 218 | @@ -476,7 +476,7 @@ dnl paths are prepended to the beginning of INCLUDES. 219 | dnl 220 | AC_DEFUN([PHP_ADD_INCLUDE], [ 221 | for include_path in m4_normalize(m4_expand([$1])); do 222 | - AS_IF([test "$include_path" != "/usr/include"], [ 223 | + AS_IF([test "$include_path" != "$PHP_OS_SDKPATH/usr/include"], [ 224 | PHP_EXPAND_PATH([$include_path], [ai_p]) 225 | PHP_RUN_ONCE([INCLUDEPATH], [$ai_p], [m4_ifnblank([$2], 226 | [INCLUDES="-I$ai_p $INCLUDES"], 227 | diff --git a/configure.ac b/configure.ac 228 | index 36c6e5e3e2..71b1a16607 100644 229 | --- a/configure.ac 230 | +++ b/configure.ac 231 | @@ -190,6 +190,14 @@ PHP_ARG_WITH([libdir], 232 | [lib], 233 | [no]) 234 | 235 | +dnl Support systems with system libraries/includes in e.g. /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk. 236 | +PHP_ARG_WITH([os-sdkpath], 237 | + [for system SDK directory], 238 | + [AS_HELP_STRING([--with-os-sdkpath=NAME], 239 | + [Ignore system libraries and includes in NAME rather than /])], 240 | + [], 241 | + [no]) 242 | + 243 | PHP_ARG_ENABLE([rpath], 244 | [whether to enable runpaths], 245 | [AS_HELP_STRING([--disable-rpath], 246 | --------------------------------------------------------------------------------