diff options
| author | Gaƫtan Lehmann | 2014-10-03 18:32:12 +0200 |
|---|---|---|
| committer | Mike McQuaid | 2014-10-21 20:09:27 +0100 |
| commit | 3281d62bdd524df45ed61b500b144f900079c28a (patch) | |
| tree | 6ce2eb36aeb28b9e135ec986ef243699a2f4188c | |
| parent | a2e80889577f9c6ffe9b215ec611d0e0b2f2115e (diff) | |
| download | homebrew-3281d62bdd524df45ed61b500b144f900079c28a.tar.bz2 | |
jsoncpp 0.6.0-rc2 (new formula)
| -rw-r--r-- | Library/Formula/jsoncpp.rb | 57 |
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 |
