Files

51 lines
1.8 KiB
Ruby

class Ninja < Formula
bottle do
root_url "https://homebrew.hyprnet/bottles"
sha256 cellar: :any_skip_relocation, arm64_sequoia: "700fe3bd75ca15b2778454947a215334a71997dcf92a3b644bfeb06f79c2508e"
sha256 cellar: :any_skip_relocation, arm64_tahoe: "d311d593a271d255b4fd6337f8ef394f825b73aa77f7ebd51236ff850cf85033"
sha256 cellar: :any_skip_relocation, sequoia: "52f936327d0ee780ae639db82cdc96b13a7ed8a4e778b3c3d53e3335899b0b2a"
sha256 cellar: :any_skip_relocation, x86_64_linux: "5b3072c3b1944cb010705840243e7590cb1105445dfdcaf90de543b3dc06b545"
end
desc "Small build system for use with gyp or CMake"
homepage "https://ninja-build.org/"
url "https://github.com/ninja-build/ninja/archive/refs/tags/v1.13.2.tar.gz"
sha256 "974d6b2f4eeefa25625d34da3cb36bdcebe7fbce40f4c16ac0835fd1c0cbae17"
license "Apache-2.0"
compatibility_version 1
head "https://github.com/ninja-build/ninja.git", branch: "master"
livecheck do
url :stable
regex(/^v?(\d+(?:\.\d+)+)$/i)
end
uses_from_macos "python" => [:build, :test]
def install
system "python3", "configure.py", "--bootstrap", "--verbose", "--with-python=python3"
bin.install "ninja"
bash_completion.install "misc/bash-completion" => "ninja"
zsh_completion.install "misc/zsh-completion" => "_ninja"
doc.install "doc/manual.asciidoc"
(share/"vim/vimfiles/syntax").install "misc/ninja.vim"
end
test do
(testpath/"build.ninja").write <<~NINJA
cflags = -Wall
rule cc
command = gcc $cflags -c $in -o $out
build foo.o: cc foo.c
NINJA
system bin/"ninja", "-t", "targets"
port = free_port
spawn bin/"ninja", "-t", "browse", "--port=#{port}", "--hostname=127.0.0.1", "--no-browser", "foo.o"
assert_match "foo.c", shell_output("curl --silent --retry 5 --retry-connrefused http://127.0.0.1:#{port}?foo.o")
end
end