homebrew-core/Formula/libgr.rb

53 lines
1.6 KiB
Ruby

class Libgr < Formula
desc "GR framework: a graphics library for visualisation applications"
homepage "https://gr-framework.org/"
url "https://github.com/sciapp/gr/archive/v0.50.0.tar.gz"
sha256 "59947975c364b8ce98940eee4cf98a665ede66083362e60f3e3520d9c7d8bc1e"
bottle do
sha256 "ad9c9b780448fd1d0cdaff04cef2e8ecbff39cb3a1630dd07be28a522121f115" => :catalina
sha256 "661c8cf3318eed81b35b8ebdd6edb65540e06eff91d349536304dac581283f1b" => :mojave
sha256 "9d5836a1715c143db817744b3c9c65e4502771b237448390582bbffb8c786b43" => :high_sierra
end
depends_on :xcode => :build
depends_on "cairo"
depends_on "glfw"
depends_on "libtiff"
depends_on "qt"
depends_on "zeromq"
def install
# TODO: Remove this when released archive includes
# the fix of https://github.com/sciapp/gr/pull/101 .
ENV.deparallelize
system "make", "GRDIR=#{prefix}"
system "make", "GRDIR=#{prefix}", "install"
end
test do
(testpath/"test.c").write <<~EOS
#include <stdio.h>
#include <gr.h>
int main(void) {
gr_opengks();
gr_openws(1, "test.png", 140);
gr_activatews(1);
double x[] = {0, 0.2, 0.4, 0.6, 0.8, 1.0};
double y[] = {0.3, 0.5, 0.4, 0.2, 0.6, 0.7};
gr_polyline(6, x, y);
gr_axes(gr_tick(0, 1), gr_tick(0, 1), 0, 0, 1, 1, -0.01);
gr_updatews();
gr_emergencyclosegks();
return 0;
}
EOS
system ENV.cc, "test.c", "-o", "test", "-I#{include}", "-L#{lib}", "-lGR"
system "./test"
assert_predicate testpath/"test.png", :exist?
end
end