Skip to content

Commit a5987f9

Browse files
cho-mdanielnachun
authored andcommitted
ocl-icd 2.3.1 (new formula)
1 parent e156c27 commit a5987f9

File tree

1 file changed

+52
-0
lines changed

1 file changed

+52
-0
lines changed

Formula/ocl-icd.rb

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
class OclIcd < Formula
2+
desc "OpenCL ICD loader"
3+
homepage "https://github.com/OCL-dev/ocl-icd/"
4+
url "https://github.com/OCL-dev/ocl-icd/archive/refs/tags/v2.3.1.tar.gz"
5+
sha256 "a32b67c2d52ffbaf490be9fc18b46428ab807ab11eff7664d7ff75e06cfafd6d"
6+
license "BSD-2-Clause"
7+
head "https://github.com/OCL-dev/ocl-icd.git", branch: "master"
8+
9+
keg_only :shadowed_by_macos, "macOS provides OpenCL.framework"
10+
11+
depends_on "asciidoc" => :build
12+
depends_on "autoconf" => :build
13+
depends_on "automake" => :build
14+
depends_on "libtool" => :build
15+
depends_on "opencl-headers" => [:build, :test]
16+
depends_on "xmlto" => :build
17+
18+
uses_from_macos "libxml2" => :build
19+
uses_from_macos "libxslt" => :build
20+
uses_from_macos "ruby" => :build
21+
22+
def install
23+
ENV["XML_CATALOG_FILES"] = etc/"xml/catalog"
24+
system "./bootstrap"
25+
system "./configure", *std_configure_args,
26+
"--disable-silent-rules",
27+
"--enable-custom-vendordir=#{etc}/OpenCL/vendors"
28+
system "make", "install"
29+
pkgshare.install "ocl_test.c"
30+
end
31+
32+
def caveats
33+
s = "The default vendors directory is #{etc}/OpenCL/vendors\n"
34+
on_linux do
35+
s += <<~EOS
36+
No OpenCL implementation is pre-installed, so all dependents will require either
37+
installing a compatible formula or creating an ".icd" file mapping to an externally
38+
installed implementation. Any ".icd" files copied or symlinked into
39+
`#{etc}/OpenCL/vendors` will automatically be detected by `ocl-icd`.
40+
A portable OpenCL implementation is available via the `pocl` formula.
41+
EOS
42+
end
43+
s
44+
end
45+
46+
test do
47+
cp pkgshare/"ocl_test.c", testpath
48+
system ENV.cc, "ocl_test.c", "-o", "test", "-I#{Formula["opencl-headers"].opt_include}", "-L#{lib}", "-lOpenCL"
49+
ENV["OCL_ICD_VENDORS"] = testpath/"vendors"
50+
assert_equal "No platforms found!", shell_output("./test").chomp
51+
end
52+
end

0 commit comments

Comments
 (0)