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.46.0.tar.gz"
sha256 "c466ae98fd26ac8a30d1b35a899201eaf0ede593b0a3f61f806c49261acb6982"
bottle do
sha256 "6ce9137f9a6da46f1bb36d40c8381df3006d0627efc9d267941a3eb325ee1eec" => :catalina
sha256 "598867fbc663ab2d593c27e7a66cc72ea318d1f4f8495516e4f70b66aaa3f7dd" => :mojave
sha256 "7a0b840e198d3e6e210375c9393ec554c947c79e44e6c1813a0d202e7e5b2430" => :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