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 1 bottle do sha256 "7873de96195718c4af1ce1165690317e4d6facc819d9c25e49768fbbbb042a95" => :high_sierra sha256 "d5e22de8397071f257f009c04a83baae99e0d281923b9e7973cbae4a9dda6e9a" => :sierra sha256 "cbf6d10dc59e1e27bcb6cdfafa49d6d26d52bc322af386a83e2706a0b86b35b0" => :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 "libtool" => :run 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 ] 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", "-lltdl", "-lm", "-lplplot", "-lqsastime" system "./test" end end