-
-
Notifications
You must be signed in to change notification settings - Fork 12.1k
/
jsoncpp.rb
57 lines (52 loc) 路 2.7 KB
/
jsoncpp.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
class Jsoncpp < Formula
desc "Library for interacting with JSON"
homepage "https://github.com/open-source-parsers/jsoncpp"
url "https://github.com/open-source-parsers/jsoncpp/archive/refs/tags/1.9.5.tar.gz"
sha256 "f409856e5920c18d0c2fb85276e24ee607d2a09b5e7d5f0a371368903c275da2"
license "MIT"
head "https://github.com/open-source-parsers/jsoncpp.git", branch: "master"
livecheck do
url :stable
strategy :github_latest
end
bottle do
sha256 cellar: :any, arm64_sonoma: "fedc02b1840b83d1e98e7c65cce31fa60858cfc82489f108cfec42989adacfdc"
sha256 cellar: :any, arm64_ventura: "013a6b0f7beab209b744ef8119ca2a9a29a0c9c90da09f5012fc94fe5cc51ff1"
sha256 cellar: :any, arm64_monterey: "ae110e26c1c8bcb9aa833c0393ddf26f88e3a88f1056fb52c7461dd0af5d7f96"
sha256 cellar: :any, arm64_big_sur: "a7412f7e1de7b44f22c25ec31fb7a6bd65450d04e2882954f5a282a6e021236b"
sha256 cellar: :any, sonoma: "90c36c48a24d418235400ce76493e97379954a26f9e700e3e61d38762ba870a4"
sha256 cellar: :any, ventura: "68fe5f2b8a499ef699890d432985cb53e648a12fc1017e4bcb0be3c616f8982b"
sha256 cellar: :any, monterey: "be9698795e4f18a424786e6d9920409b4b98fd15fdf9b09e0ffcff5ddc6dffec"
sha256 cellar: :any, big_sur: "906ff0a3a449611cdb96c7dd0f4e6335c6a10c8564f73fef3f799de955bdb712"
sha256 cellar: :any, catalina: "3869924df0ab1d78ed2bc4448f0496c64e0f14af08834297319eb782fc070c3d"
sha256 cellar: :any_skip_relocation, x86_64_linux: "e00ec8c187ad0787b392125e31b23d0c2b0dcbb4e9f66cfd34570ca813146ab9"
end
# NOTE: Do not change this to use CMake, because the CMake build is deprecated.
# See: https://github.com/open-source-parsers/jsoncpp/wiki/Building#building-and-testing-with-cmake
# https://github.com/Homebrew/homebrew-core/pull/103386
depends_on "meson" => :build
depends_on "ninja" => :build
def install
system "meson", "setup", "build", *std_meson_args
system "meson", "compile", "-C", "build", "--verbose"
system "meson", "install", "-C", "build"
end
test do
(testpath/"test.cpp").write <<~EOS
#include <json/json.h>
int main() {
Json::Value root;
Json::CharReaderBuilder builder;
std::string errs;
std::istringstream stream1;
stream1.str("[1, 2, 3]");
return Json::parseFromStream(builder, stream1, &root, &errs) ? 0: 1;
}
EOS
system ENV.cxx, "-std=c++11", testpath/"test.cpp", "-o", "test",
"-I#{include}/jsoncpp",
"-L#{lib}",
"-ljsoncpp"
system "./test"
end
end