class GraphvizAT238 < Formula desc "Graph visualization software from AT&T and Bell Labs" homepage "https://graphviz.org/" # versioned URLs are missing upstream as of 16 Dec 2017 url "https://www.mirrorservice.org/sites/distfiles.macports.org/graphviz/graphviz-2.38.0.tar.gz" mirror "https://src.fedoraproject.org/repo/pkgs/graphviz/graphviz-2.38.0.tar.gz/5b6a829b2ac94efcd5fa3c223ed6d3ae/graphviz-2.38.0.tar.gz" sha256 "81aa238d9d4a010afa73a9d2a704fc3221c731e1e06577c2ab3496bdef67859e" version_scheme 1 bottle do rebuild 1 sha256 "b592ce51c2a929c3da82e96ec856571ebfc54cf4dac90c2924cd3845078d7082" => :high_sierra sha256 "41b5811054f03978db12525919540fe41e073fb2c20e899247ed9c2a191f7a66" => :sierra sha256 "cab27f92a59d543e2f2c1494c28c7563a4c2d7e0dce4c4fbc22587db91cafc5b" => :el_capitan sha256 "6bd4c01e724cfc965871e1aad9a4fb2a6afef90a1e254d81e2fe33a997f50aaa" => :yosemite end head do url "https://github.com/ellson/graphviz.git" depends_on "automake" => :build depends_on "autoconf" => :build depends_on "libtool" => :build end 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 "libtool" depends_on "pango" => :optional depends_on "gts" => :optional depends_on "librsvg" => :optional depends_on "freetype" => :optional depends_on :x11 => :optional depends_on "gd" depends_on "libpng" if build.with? "bindings" depends_on "swig" => :build depends_on :java depends_on "python@2" depends_on "ruby" end def install # Only needed when using superenv, which causes qfrexp and qldexp to be # falsely detected as available. The problem is triggered by # args << "-#{ENV["HOMEBREW_OPTIMIZATION_LEVEL"]}" # during argument refurbishment of cflags. # https://github.com/Homebrew/brew/blob/ab060c9/Library/Homebrew/shims/super/cc#L241 # https://github.com/Homebrew/legacy-homebrew/issues/14566 # Alternative fixes include using stdenv or using "xcrun make" inreplace "lib/sfio/features/sfio", "lib qfrexp\nlib qldexp\n", "" if build.with? "bindings" # the ruby pkg-config file is version specific inreplace "configure" do |s| s.gsub! "ruby-1.9", "ruby-#{Formula["ruby"].stable.version.to_f}" s.gsub! "if test `$SWIG -php7 2>&1", "if test `$SWIG -php0 2>&1" end end args = %W[ --disable-debug --disable-dependency-tracking --prefix=#{prefix} --without-qt --with-quartz --disable-php ] 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.head? system "./autogen.sh", *args else system "./configure", *args end system "make", "install" if build.with? "app" cd "macosx" do xcodebuild "SDKROOT=#{MacOS.sdk_path}", "-configuration", "Release", "SYMROOT=build", "PREFIX=#{prefix}", "ONLY_ACTIVE_ARCH=YES", "MACOSX_DEPLOYMENT_TARGET=#{MacOS.version}" end prefix.install "macosx/build/Release/Graphviz.app" end (bin/"gvmap.sh").unlink end test do (testpath/"sample.dot").write <<~EOS digraph G { a -> b } EOS system "#{bin}/dot", "-Tpdf", "-o", "sample.pdf", "sample.dot" end end