class Graphviz < Formula desc "Graph visualization software from AT&T and Bell Labs" homepage "https://www.graphviz.org/" # versioned URLs are missing upstream as of 16 Dec 2017 url "https://www.mirrorservice.org/sites/distfiles.macports.org/graphviz/graphviz-2.40.1.tar.gz" mirror "https://fossies.org/linux/misc/graphviz-2.40.1.tar.gz" sha256 "ca5218fade0204d59947126c38439f432853543b0818d9d728c589dfe7f3a421" version_scheme 1 bottle do rebuild 2 sha256 "554a0f729bf393301fb3fd796d771a63c51871d6aaf498a7af6c7f98a64979bd" => :mojave sha256 "769e9c92c5e08e803b54d2940df74aeb7202e5bc5019eb602d36116ea7cddcf3" => :high_sierra sha256 "4267fe0d22373837bc22dfca35e8a925ed660e3b403b76af791a30fc074130c9" => :sierra end head do url "https://gitlab.com/graphviz/graphviz.git" depends_on "autoconf" => :build depends_on "automake" => :build depends_on "libtool" => :build end depends_on "pkg-config" => :build depends_on "gd" depends_on "gts" depends_on "libpng" depends_on "libtool" 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", "" unless build.head? args = %W[ --disable-debug --disable-dependency-tracking --prefix=#{prefix} --disable-php --disable-swig --with-quartz --without-freetype2 --without-qt --without-x --with-gts ] if build.head? system "./autogen.sh", *args else system "./configure", *args end system "make", "install" (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