aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Formula/pocl.rb
blob: 5333a4957468fc1f816dbe742ba3cf969ac7c1fc (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
require 'formula'

class Pocl < Formula
  homepage 'http://pocl.sourceforge.net'
  url 'http://pocl.sourceforge.net/downloads/pocl-0.9.tar.gz'
  sha1 'd6e30f3120c7952dec9004db1db91a11d08c7b74'

  depends_on 'pkg-config' => :build
  depends_on 'hwloc'
  depends_on 'llvm' => 'with-clang'
  depends_on :libltdl

  def patches
    # Check if ndebug flag is required for compiling pocl didn't work on osx
    # for some reason. Information if bug is fixed is found from
    # https://github.com/pocl/pocl/issues/59
    DATA
  end

  def install
    ENV.j1
    system "./configure", "--disable-debug",
                          "--enable-direct-linkage",
                          "--disable-icd",
                          "--enable-testsuites=",
                          "--prefix=#{prefix}"
    system "make", "install"
  end

  test do
    (testpath/'foo.cl').write <<-EOS.undent
      kernel void foo(int *in, int *out) {
        int i = get_global_id(0);
        out[i] = in[i];
      }
    EOS
    system "#{bin}/pocl-standalone -h head.h -o foo.bc foo.cl"
    system "\"#{Formula["llvm"].opt_bin}/llvm-dis\" < foo.bc | grep foo_workgroup"
    system "pkg-config pocl --modversion | grep #{version}"
  end
end

__END__
diff --git a/configure b/configure
index 01d3e24..55bf55c 100755
--- a/configure
+++ b/configure
@@ -18375,6 +18375,11 @@ else
   LLVM_HAS_ASSERTIONS_FALSE=
 fi

+# Hardcoded information that llvm compiled by homebrew has asserts
+# for some reason test above did not give correct result
+# https://github.com/pocl/pocl/issues/59
+LLVM_HAS_ASSERTIONS_TRUE=
+LLVM_HAS_ASSERTIONS_FALSE='#'

 fi
 rm -f core conftest.err conftest.$ac_objext \