aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGaƫtan Lehmann2014-10-03 18:32:12 +0200
committerMike McQuaid2014-10-21 20:09:27 +0100
commit3281d62bdd524df45ed61b500b144f900079c28a (patch)
tree6ce2eb36aeb28b9e135ec986ef243699a2f4188c
parenta2e80889577f9c6ffe9b215ec611d0e0b2f2115e (diff)
downloadhomebrew-3281d62bdd524df45ed61b500b144f900079c28a.tar.bz2
jsoncpp 0.6.0-rc2 (new formula)
-rw-r--r--Library/Formula/jsoncpp.rb57
1 files changed, 57 insertions, 0 deletions
diff --git a/Library/Formula/jsoncpp.rb b/Library/Formula/jsoncpp.rb
new file mode 100644
index 000000000..cc96aca46
--- /dev/null
+++ b/Library/Formula/jsoncpp.rb
@@ -0,0 +1,57 @@
+require "formula"
+
+class Jsoncpp < Formula
+ homepage "https://github.com/open-source-parsers/jsoncpp"
+ url "https://github.com/open-source-parsers/jsoncpp/archive/svn-release-0.6.0-rc2.tar.gz"
+ sha1 "6cc51ed1f31e742637a512201b585e0bc4e06980"
+
+ depends_on "scons" => :build
+
+ patch :p1 do
+ # use the usual environment variables for the compilation flags
+ url "https://github.com/open-source-parsers/jsoncpp/pull/55.patch"
+ sha1 "d2e985a0877fc811acfb34f62713a35ba4742452"
+ end
+
+ def install
+ gccversion = `g++ -dumpversion`.strip
+ libs = buildpath/"libs/linux-gcc-#{gccversion}/"
+
+ scons "platform=linux-gcc"
+ system "install_name_tool", "-id", lib/"libjsoncpp.dylib", libs/"libjson_linux-gcc-#{gccversion}_libmt.dylib"
+
+ lib.install libs/"libjson_linux-gcc-#{gccversion}_libmt.dylib" => "libjsoncpp.dylib"
+ lib.install libs/"libjson_linux-gcc-#{gccversion}_libmt.a" =>"libjsoncpp.a"
+ (include/"jsoncpp").install buildpath/"include/json"
+
+ (lib/"pkgconfig/jsoncpp.pc").write <<-EOS.undent
+ prefix=#{prefix}
+ exec_prefix=${prefix}
+ libdir=#{lib}
+ includedir=#{include}
+
+ Name: jsoncpp
+ Description: API for manipulating JSON
+ Version: #{version}
+ URL: https://github.com/open-source-parsers/jsoncpp
+ Libs: -L${libdir} -ljsoncpp
+ Cflags: -I${includedir}/jsoncpp/
+ EOS
+ end
+
+ test do
+ (testpath/"test.cpp").write <<-EOS.undent
+ #include <json/json.h>
+ int main() {
+ Json::Value root;
+ Json::Reader reader;
+ return reader.parse("[1, 2, 3]", root) ? 0: 1;
+ }
+ EOS
+ system ENV.cxx, "test.cpp", "-o", "test",
+ "-I#{include}/jsoncpp",
+ "-L#{lib}",
+ "-ljsoncpp"
+ system "./test"
+ end
+end