Skip to content

Commit

Permalink
ninja: build using cmake
Browse files Browse the repository at this point in the history
Closes #60467.

Signed-off-by: chenrui <chenrui333@gmail.com>
Signed-off-by: BrewTestBot <1589480+BrewTestBot@users.noreply.github.com>
  • Loading branch information
dtrodrigues authored and BrewTestBot committed Sep 1, 2020
1 parent 511829e commit 10a872e
Showing 1 changed file with 20 additions and 5 deletions.
25 changes: 20 additions & 5 deletions Formula/ninja.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ class Ninja < Formula
url "https://github.com/ninja-build/ninja/archive/v1.10.1.tar.gz"
sha256 "a6b6f7ac360d4aabd54e299cc1d8fa7b234cd81b9401693da21221c62569a23e"
license "Apache-2.0"
revision 1
head "https://github.com/ninja-build/ninja.git"

livecheck do
Expand All @@ -18,15 +19,23 @@ class Ninja < Formula
sha256 "8070023444b46cc29d7e52b71cdda279c4734d96d29c7785302ae0ffe27b1245" => :high_sierra
end

depends_on "cmake" => :build
depends_on "re2c"

# from https://github.com/ninja-build/ninja/pull/1836, remove in next release
patch do
url "https://github.com/ninja-build/ninja/commit/2f3e5275e2ea67cb634488957adbb997c2ff685f.diff?full_index=1"
sha256 "aee7a3e862c8ded377e4a948390519bc7ff17cae69ae779d3c5172562d9559f2"
end

def install
system "python", "configure.py", "--bootstrap"
system "cmake", "-Bbuild-cmake", "-H.", *std_cmake_args
system "cmake", "--build", "build-cmake"

# Quickly test the build
system "./configure.py"
system "./ninja", "ninja_test"
system "./ninja_test", "--gtest_filter=-SubprocessTest.SetWithLots"
system "./build-cmake/ninja_test"

bin.install "ninja"
bin.install "build-cmake/ninja"
bash_completion.install "misc/bash-completion" => "ninja-completion.sh"
zsh_completion.install "misc/zsh-completion" => "_ninja"
end
Expand All @@ -41,5 +50,11 @@ def install
build foo.o: cc foo.c
EOS
system bin/"ninja", "-t", "targets"
port = free_port
fork do
exec bin/"ninja", "-t", "browse", "--port=#{port}", "--no-browser", "foo.o"
end
sleep 2
assert_match "foo.c", shell_output("curl -s http://localhost:#{port}?foo.o")
end
end

0 comments on commit 10a872e

Please sign in to comment.