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.14.0%20Source/plplot-5.14.0.tar.gz" sha256 "331009037c9cad9fcefacd7dbe9c7cfae25e766f5590f9efd739a294c649df97" revision 2 bottle do sha256 "e9a8f483ae30dbc84ea5d60c93e94b644fe5f10b29caeb7e917fd86c479316de" => :mojave sha256 "02059de77e258ccc4b6ae5d5a87cc200636b656d3cda3601def0caffc2fb0fa4" => :high_sierra sha256 "f1dcba65f124b02c4133d10bced993464850ff45d4575a1e157418216ad9b30f" => :sierra end depends_on "cmake" => :build depends_on "pkg-config" => :build depends_on "cairo" depends_on "freetype" depends_on "gcc" # for gfortran depends_on "pango" def install args = std_cmake_args + %w[ -DPL_HAVE_QHULL=OFF -DENABLE_ada=OFF -DENABLE_d=OFF -DENABLE_octave=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 -DENABLE_java=OFF -DPLD_xwin=OFF ] mkdir "plplot-build" do system "cmake", "..", *args system "make" system "make", "install" end # fix rpaths cd (lib.to_s) do Dir["*.dylib"].select { |f| File.ftype(f) == "file" }.each do |f| MachO::Tools.dylibs(f).select { |d| d.start_with?("@rpath") }.each do |d| d_new = d.sub("@rpath", opt_lib.to_s) MachO::Tools.change_install_name(f, d, d_new) end end 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