aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Formula/gtkextra.rb
blob: e8ee7f97e9c26d6945c864cb5fa2758b4b657efe (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
class Gtkextra < Formula
  homepage "http://gtkextra.sourceforge.net/"
  url "https://downloads.sourceforge.net/project/gtkextra/3.1/gtkextra-3.1.2.tar.gz"
  sha1 "f3c85b7edb3980ae2390d951d62c24add4b45eb9"

  bottle do
    cellar :any
    sha1 "6ff80fc1fdcc15aad24dbba2428006d2cb6ef491" => :yosemite
    sha1 "0854acd0dd2d38123a2aa98c7e4449e89c532900" => :mavericks
    sha1 "a8d200588c69a98b063b16426cc49f29c549cf4a" => :mountain_lion
  end

  # uses whatever backend gtk+ is built with: x11 or quartz
  depends_on "gtk+"
  # needed at runtime only for the test block
  depends_on "pkg-config"

  def install
    system "./configure", "--disable-debug",
                          "--disable-dependency-tracking",
                          "--disable-silent-rules",
                          "--enable-tests",
                          "--prefix=#{prefix}"
    system "make"
    system "make", "install"
  end

  test do
    ENV.prepend "PKG_CONFIG_PATH", OS::Mac::X11.lib/"pkgconfig"
    (testpath/"test.c").write <<-EOS.undent
    #include <gtkextra/gtkextra.h>
    int main(int argc, char *argv[]) {
      GtkWidget *canvas = gtk_plot_canvas_new(GTK_PLOT_A4_H, GTK_PLOT_A4_W, 0.8);
      return 0;
    }

    EOS
    cflags = `pkg-config --cflags gtkextra-3.0`.chomp.split
    libs = `pkg-config --libs gtkextra-3.0`.chomp.split
    system ENV.cc, "-o", "test", "test.c", *(cflags+libs)
    system "./test"
  end
end