Skip to content

Commit

Permalink
Updated Unit to 1.34.0
Browse files Browse the repository at this point in the history
  • Loading branch information
thresheek committed Dec 19, 2024
1 parent eab96e6 commit e138a08
Show file tree
Hide file tree
Showing 9 changed files with 32 additions and 77 deletions.
File renamed without changes.
6 changes: 3 additions & 3 deletions Formula/unit-java.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ class UnitJava < Formula
desc "Java module for Unit application server"
homepage "https://unit.nginx.org"
url "https://github.com/nginx/unit.git",
tag: "1.33.0",
revision: "24ed91f40634372d99f67f0e4e3c2ac0abde81bd"
tag: "1.34.0",
revision: "27bde184dedcbf687db2f314c60c037623318a8d"
head "https://github.com/nginx/unit.git", branch: "master"

depends_on "openjdk@11"
depends_on "openssl@3"
depends_on "unit@1.33.0"
depends_on "unit@1.34.0"

def install
system "./configure",
Expand Down
6 changes: 3 additions & 3 deletions Formula/unit-perl.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ class UnitPerl < Formula
desc "Perl module for Unit application server"
homepage "https://unit.nginx.org"
url "https://github.com/nginx/unit.git",
tag: "1.33.0",
revision: "24ed91f40634372d99f67f0e4e3c2ac0abde81bd"
tag: "1.34.0",
revision: "27bde184dedcbf687db2f314c60c037623318a8d"
head "https://github.com/nginx/unit.git", branch: "master"

depends_on "openssl@3"
depends_on "perl"
depends_on "unit@1.33.0"
depends_on "unit@1.34.0"

def install
system "./configure",
Expand Down
6 changes: 3 additions & 3 deletions Formula/unit-php.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ class UnitPhp < Formula
desc "PHP module for Unit application server"
homepage "https://unit.nginx.org"
url "https://github.com/nginx/unit.git",
tag: "1.33.0",
revision: "24ed91f40634372d99f67f0e4e3c2ac0abde81bd"
tag: "1.34.0",
revision: "27bde184dedcbf687db2f314c60c037623318a8d"
head "https://github.com/nginx/unit.git", branch: "master"

depends_on "openssl@3"
depends_on "php-embed"
depends_on "unit@1.33.0"
depends_on "unit@1.34.0"

def install
system "./configure",
Expand Down
6 changes: 3 additions & 3 deletions Formula/unit-python.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ class UnitPython < Formula
desc "Python module for Unit application server"
homepage "https://unit.nginx.org"
url "https://github.com/nginx/unit.git",
tag: "1.33.0",
revision: "24ed91f40634372d99f67f0e4e3c2ac0abde81bd"
tag: "1.34.0",
revision: "27bde184dedcbf687db2f314c60c037623318a8d"
head "https://github.com/nginx/unit.git", branch: "master"

depends_on :macos
depends_on maximum_macos: :big_sur
depends_on "openssl@3"
depends_on "unit@1.33.0"
depends_on "unit@1.34.0"
uses_from_macos "python"

def install
Expand Down
6 changes: 3 additions & 3 deletions Formula/unit-python3.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ class UnitPython3 < Formula
desc "Python3 module for Unit application server"
homepage "https://unit.nginx.org"
url "https://github.com/nginx/unit.git",
tag: "1.33.0",
revision: "24ed91f40634372d99f67f0e4e3c2ac0abde81bd"
tag: "1.34.0",
revision: "27bde184dedcbf687db2f314c60c037623318a8d"
head "https://github.com/nginx/unit.git", branch: "master"

depends_on "openssl@3"
depends_on "python@3.12"
depends_on "unit@1.33.0"
depends_on "unit@1.34.0"

def install
system "./configure",
Expand Down
6 changes: 3 additions & 3 deletions Formula/unit-ruby.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,13 @@ class UnitRuby < Formula
desc "Ruby module for Unit application server"
homepage "https://unit.nginx.org"
url "https://github.com/nginx/unit.git",
tag: "1.33.0",
revision: "24ed91f40634372d99f67f0e4e3c2ac0abde81bd"
tag: "1.34.0",
revision: "27bde184dedcbf687db2f314c60c037623318a8d"
head "https://github.com/nginx/unit.git", branch: "master"

depends_on "openssl@3"
depends_on "ruby"
depends_on "unit@1.33.0"
depends_on "unit@1.34.0"

def install
system "./configure",
Expand Down
53 changes: 3 additions & 50 deletions Formula/unit-wasm.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,15 @@ class UnitWasm < Formula
desc "Ruby module for Unit application server"
homepage "https://unit.nginx.org"
url "https://github.com/nginx/unit.git",
tag: "1.33.0",
revision: "24ed91f40634372d99f67f0e4e3c2ac0abde81bd"
tag: "1.34.0",
revision: "27bde184dedcbf687db2f314c60c037623318a8d"
head "https://github.com/nginx/unit.git", branch: "master"

depends_on "rust" => :build
depends_on "openssl@3"
depends_on "unit@1.33.0"
depends_on "unit@1.34.0"
depends_on "wasmtime"

# a fix to build with current wasmtime
patch :DATA

def install
system "./configure",
"--prefix=#{prefix}",
Expand Down Expand Up @@ -43,47 +40,3 @@ def install
system "make", "wasm-wasi-component-install"
end
end

__END__
commit 6cc4d706fba2577babc076ad0d2ef145c0c648d7
Author: Sergey A. Osokin <sergey.osokin@nginx.com>
Date: Fri Nov 22 22:13:18 2024 -0500

wasm: Fix build with wasmtime 27.0.0

Wasmtime 27.0.0 adjusted the C API to start flowing through the
directory and file permission bits of the underlying rust
wasi_config_preopen_dir() implementation.

The directory permissions control whether a directory is read-only or
whether you can create/modify files within.

You always need at least WASMTIME_WASI_DIR_PERMS_READ.

The file permissions control whether you can read or read/write files.

WASMTIME_WASI_FILE_PERMS_WRITE seems to imply
WASMTIME_WASI_FILE_PERMS_READ (but we add both just to make it clear
what we want)

[ Permissions tweak and commit message - Andrew ]
Signed-off-by: Andrew Clayton <a.clayton@nginx.com>

diff --git a/src/wasm/nxt_rt_wasmtime.c b/src/wasm/nxt_rt_wasmtime.c
index bf0b0a0f..64ef775d 100644
--- a/src/wasm/nxt_rt_wasmtime.c
+++ b/src/wasm/nxt_rt_wasmtime.c
@@ -281,7 +281,13 @@ nxt_wasmtime_wasi_init(const nxt_wasm_ctx_t *ctx)
wasi_config_inherit_stderr(wasi_config);

for (dir = ctx->dirs; dir != NULL && *dir != NULL; dir++) {
+#if defined(WASMTIME_VERSION_MAJOR) && (WASMTIME_VERSION_MAJOR >= 27)
+ wasi_config_preopen_dir(wasi_config, *dir, *dir,
+ WASMTIME_WASI_DIR_PERMS_READ|WASMTIME_WASI_DIR_PERMS_WRITE,
+ WASMTIME_WASI_FILE_PERMS_READ|WASMTIME_WASI_FILE_PERMS_WRITE);
+#else
wasi_config_preopen_dir(wasi_config, *dir, *dir);
+#endif
}

error = wasmtime_context_set_wasi(rt_ctx->ctx, wasi_config);
20 changes: 11 additions & 9 deletions Formula/unit.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,34 +2,35 @@ class Unit < Formula
desc "Dynamic web and application server"
homepage "https://unit.nginx.org"
url "https://github.com/nginx/unit.git",
tag: "1.33.0",
revision: "24ed91f40634372d99f67f0e4e3c2ac0abde81bd"
tag: "1.34.0",
revision: "27bde184dedcbf687db2f314c60c037623318a8d"
head "https://github.com/nginx/unit.git", branch: "master"

depends_on "rust" => :build
depends_on "openssl@3"
depends_on "pcre2"
depends_on "pkg-config"

resource "njs" do
url "https://github.com/nginx/njs.git",
tag: "0.8.5",
revision: "9d4bf6c60aa60a828609f64d1b5c50f71bb7ef62"
tag: "0.8.8",
revision: "78e3edf7505cd04a5df0b7936bcd2d89e95bdda8"
end

resource "unitctl" do
src_repo = "https://github.com/nginx/unit"
if OS.mac? && Hardware::CPU.intel?
url "#{src_repo}/releases/download/#{Unit.version}/unitctl-#{Unit.version}-x86_64-apple-darwin"
sha256 "e649163262ec4839eccf2178e7852abf9057c852ace84db7a3d82a7347c3e05e"
sha256 "3dcc9367bcda782c366d93d86287a30d902c63c5d26b4e80db41f2b5f53449a4"
elsif OS.mac? && Hardware::CPU.arm?
url "#{src_repo}/releases/download/#{Unit.version}/unitctl-#{Unit.version}-aarch64-apple-darwin"
sha256 "d49c3da15534b2ed20d70a0fb2ff47d5d0911140229bc1ebabf8a7ec62b01083"
sha256 "2789f5d39229800cac942324ad9b17832d7bf5b628c232af81bd5af96a20fc85"
elsif OS.linux? && Hardware::CPU.intel?
url "#{src_repo}/releases/download/#{Unit.version}/unitctl-#{Unit.version}-x86_64-unknown-linux-gnu"
sha256 "484a70cfc1bb4ccae41ede0f22e6a552adf4cc609280d178b600142a424d5840"
sha256 "b83d2c20bc072eeb05fedb21e536248d105ed5f25e895c0a8bd8bca48dcb0b13"
elsif OS.linux? && Hardware::CPU.arm? && Hardware::CPU.is_64_bit?
url "#{src_repo}/releases/download/#{Unit.version}/unitctl-#{Unit.version}-aarch64-unknown-linux-gnu"
sha256 "ca690c1c7d625e507aa110020dbb930569247d91107e1e75a21b1e3b298a4dc7"
sha256 "f7c98e35b1ac8a946e3c0653e0a34473d25b0ed27152757d5b9f42ef06eb12a4"
else
odie "Unsupported architecture"
end
Expand All @@ -43,7 +44,7 @@ def install

resource("njs").stage buildpath/"njs"
cd "njs" do
system "./configure", "--no-libxml2", "--no-zlib", "--no-openssl"
system "./configure", "--no-libxml2", "--no-zlib", "--no-openssl", "--no-quickjs"
system "make", "libnjs", "njs"
bin.install "build/njs" => "njs-unit"
end
Expand All @@ -62,6 +63,7 @@ def install
"--tmpdir=/tmp",
"--openssl",
"--njs",
"--otel",
"--cc-opt=-I#{Formula["openssl"].opt_prefix}/include",
"--ld-opt=-L#{Formula["openssl"].opt_prefix}/lib"

Expand Down

0 comments on commit e138a08

Please # to comment.