class Plplot < Formula desc "Cross-platform software package for creating scientific plots" homepage "https://plplot.sourceforge.io" url "https://downloads.sourceforge.net/project/plplot/plplot/5.13.0%20Source/plplot-5.13.0.tar.gz" sha256 "ec36bbee8b03d9d1c98f8fd88f7dc3415560e559b53eb1aa991c2dcf61b25d2b" revision 2 bottle do sha256 "5d03802bdf08371e6dee4ad0d10d2cc12ab0d7dea900ea33c604cc67eba80c65" => :high_sierra sha256 "d683b840e6301fdff46ec3470164ab2c4051cd72a1d6785caf3465299877bbec" => :sierra sha256 "acb1c5c672552dd9ba8e34c7e6f799c161ff3897c0edf7469aad29fc5e86af2d" => :el_capitan end depends_on "cmake" => :build depends_on "pkg-config" => :build depends_on "cairo" depends_on "freetype" depends_on "gcc" # for gfortran depends_on "pango" depends_on :java => :optional depends_on :x11 => :optional def install args = std_cmake_args + %w[ -DENABLE_ada=OFF -DENABLE_d=OFF -DENABLE_qt=OFF -DENABLE_lua=OFF -DENABLE_tk=OFF -DENABLE_python=OFF -DENABLE_tcl=OFF -DPLD_xcairo=OFF -DPLD_wxwidgets=OFF -DENABLE_wxwidgets=OFF -DENABLE_DYNDRIVERS=OFF ] args << "-DENABLE_java=OFF" if build.without? "java" args << "-DPLD_xwin=OFF" if build.without? "x11" mkdir "plplot-build" do system "cmake", "..", *args system "make" system "make", "install" end end test do (testpath/"test.c").write <<~EOS #include int main(int argc, char *argv[]) { plparseopts(&argc, argv, PL_PARSE_FULL); plsdev("extcairo"); plinit(); return 0; } EOS system ENV.cc, "test.c", "-o", "test", "-I#{include}/plplot", "-L#{lib}", "-lcsirocsa", "-lm", "-lplplot", "-lqsastime" system "./test" end end