homebrew-core/Formula/graphviz.rb
Xu Cheng db79aba8a4 graphviz: building bindings requires java
Closes Homebrew/homebrew#37388

Closes Homebrew/homebrew#37410.

Signed-off-by: Xu Cheng <xucheng@me.com>
2015-03-05 14:00:54 +08:00

91 lines
2.8 KiB
Ruby

class Graphviz < Formula
homepage "http://graphviz.org/"
url "http://graphviz.org/pub/graphviz/stable/SOURCES/graphviz-2.38.0.tar.gz"
sha1 "053c771278909160916ca5464a0a98ebf034c6ef"
bottle do
revision 1
sha1 "a3461628baba501e16c63ceaa0414027f7e26c7f" => :yosemite
sha1 "dc7f915d199931a49fb2a8eb623b329fed6c619c" => :mavericks
sha1 "ec730f7cdd3e9549610960ecab86dac349e2f8ea" => :mountain_lion
end
# To find Ruby and Co.
env :std
option :universal
option "with-bindings", "Build Perl/Python/Ruby/etc. bindings"
option "with-pango", "Build with Pango/Cairo for alternate PDF output"
option "with-app", "Build GraphViz.app (requires full XCode install)"
option "with-gts", "Build with GNU GTS support (required by prism)"
deprecated_option "with-x" => "with-x11"
deprecated_option "with-pangocairo" => "with-pango"
depends_on "pkg-config" => :build
depends_on :xcode => :build if build.with? "app"
depends_on "pango" => :optional
depends_on "gts" => :optional
depends_on "librsvg" => :optional
depends_on "freetype" => :optional
depends_on :x11 => :optional
depends_on "libpng"
if build.with? "bindings"
depends_on "swig" => :build
depends_on :python
depends_on :java
end
fails_with :clang do
build 318
end
patch :p0 do
url "https://trac.macports.org/export/103168/trunk/dports/graphics/graphviz/files/patch-project.pbxproj.diff"
sha1 "b242fb8fa81489dd16830e5df6bbf5448a3874d5"
end
def install
ENV.universal_binary if build.universal?
args = ["--disable-debug",
"--disable-dependency-tracking",
"--prefix=#{prefix}",
"--without-qt",
"--with-quartz"]
args << "--with-gts" if build.with? "gts"
args << "--disable-swig" if build.without? "bindings"
args << "--without-pangocairo" if build.without? "pango"
args << "--without-freetype2" if build.without? "freetype"
args << "--without-x" if build.without? "x11"
args << "--without-rsvg" if build.without? "librsvg"
if build.with? "bindings"
# http://www.graphviz.org/mantisbt/view.php?id=2486
inreplace "configure", 'PYTHON_LIBS="-lpython$PYTHON_VERSION_SHORT"',
'PYTHON_LIBS="-L$PYTHON_PREFIX/lib -lpython$PYTHON_VERSION_SHORT"'
end
system "./configure", *args
system "make", "install"
if build.with? "app"
cd "macosx" do
xcodebuild "-configuration", "Release", "SYMROOT=build", "PREFIX=#{prefix}", "ONLY_ACTIVE_ARCH=YES"
end
prefix.install "macosx/build/Release/Graphviz.app"
end
(bin+"gvmap.sh").unlink
end
test do
(testpath/"sample.dot").write <<-EOS.undent
digraph G {
a -> b
}
EOS
system "#{bin}/dot", "-Tpdf", "-o", "sample.pdf", "sample.dot"
end
end