aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Formula/libepoxy.rb
blob: 6cf169bf6f408019d30714572f5115593b1ffd7d (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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
class Libepoxy < Formula
  homepage "https://github.com/anholt/libepoxy"
  url "https://github.com/anholt/libepoxy/archive/v1.2.tar.gz"
  sha256 "42c328440f60a5795835c5ec4bdfc1329e75bba16b6e22b3a87ed17e9679e8f6"

  bottle do
    cellar :any
    sha1 "dabb8e5118bc90e09ecd908200dc2d3e7b4318a2" => :yosemite
    sha1 "0f3d1752a4a3b6783ea5a94327bfdb67428c5041" => :mavericks
    sha1 "d09e2a326f2bc061fae07f39c5a57421951bcda5" => :mountain_lion
  end

  depends_on "pkg-config" => :build
  depends_on "automake" => :build
  depends_on "autoconf" => :build
  depends_on "libtool" => :build

  resource "xorg-macros" do
    url "http://xorg.freedesktop.org/releases/individual/util/util-macros-1.19.0.tar.bz2"
    sha256 "2835b11829ee634e19fa56517b4cfc52ef39acea0cd82e15f68096e27cbed0ba"
  end

  # This patch disables GLX on OSX, so that we don't have a runtime
  # dependency on x11.
  # It has been submitted at https://github.com/anholt/libepoxy/pull/28 and
  # will be included in the next release, according to libepoxy's author.
  patch :DATA

  def install
    resource("xorg-macros").stage do
      system "./configure", "--prefix=#{buildpath}/xorg-macros"
      system "make", "install"
    end

    ENV.append_path "PKG_CONFIG_PATH", "#{buildpath}/xorg-macros/share/pkgconfig"
    ENV.append_path "ACLOCAL_PATH", "#{buildpath}/xorg-macros/share/aclocal"

    system "./autogen.sh", "--disable-dependency-tracking",
                           "--prefix=#{prefix}"
    system "make"
    system "make", "install"
  end

  test do
    (testpath/"test.c").write <<-EOS.undent

      #include <epoxy/gl.h>
      #include <OpenGL/CGLContext.h>
      #include <OpenGL/CGLTypes.h>
      int main()
      {
          CGLPixelFormatAttribute attribs[] = {0};
          CGLPixelFormatObj pix;
          int npix;
          CGLContextObj ctx;

          CGLChoosePixelFormat( attribs, &pix, &npix );
          CGLCreateContext(pix, (void*)0, &ctx);

          glClear(GL_COLOR_BUFFER_BIT);
          CGLReleasePixelFormat(pix);
          CGLReleaseContext(pix);
          return 0;
      }
    EOS
    system ENV.cc, "test.c", "-lepoxy", "-framework", "OpenGL", "-o", "test"
    system "ls", "-lh", "test"
    system "file", "test"
    system "./test"
  end
end
__END__
diff --git a/configure.ac b/configure.ac
index f97c9b0..01842a4 100644
--- a/configure.ac
+++ b/configure.ac
@@ -78,7 +65,7 @@ case $host_os in
         ;;
     darwin*)
         build_egl=no
-        build_glx=yes
+        build_glx=no
         build_wgl=no
         build_apple=yes
         has_znow=no
diff --git a/src/dispatch_common.h b/src/dispatch_common.h
index a4eb0f0..6b8503a 100644
--- a/src/dispatch_common.h
+++ b/src/dispatch_common.h
@@ -30,7 +30,7 @@
 #define EPOXY_IMPORTEXPORT __declspec(dllexport)
 #elif defined(__APPLE__)
 #define PLATFORM_HAS_EGL 0
-#define PLATFORM_HAS_GLX 1
+#define PLATFORM_HAS_GLX 0
 #define PLATFORM_HAS_WGL 0
 #define EPOXY_IMPORTEXPORT
 #elif defined(ANDROID)