Skip to content

ocl-icd 2.3.1 (new formula) #104619

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
52 changes: 52 additions & 0 deletions Formula/ocl-icd.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
class OclIcd < Formula
desc "OpenCL ICD loader"
homepage "https://github.com/OCL-dev/ocl-icd/"
url "https://github.com/OCL-dev/ocl-icd/archive/refs/tags/v2.3.1.tar.gz"
sha256 "a32b67c2d52ffbaf490be9fc18b46428ab807ab11eff7664d7ff75e06cfafd6d"
license "BSD-2-Clause"
head "https://github.com/OCL-dev/ocl-icd.git", branch: "master"

keg_only :shadowed_by_macos, "macOS provides OpenCL.framework"

depends_on "asciidoc" => :build
depends_on "autoconf" => :build
depends_on "automake" => :build
depends_on "libtool" => :build
depends_on "opencl-headers" => [:build, :test]
depends_on "xmlto" => :build

uses_from_macos "libxml2" => :build
uses_from_macos "libxslt" => :build
uses_from_macos "ruby" => :build

def install
ENV["XML_CATALOG_FILES"] = etc/"xml/catalog"
system "./bootstrap"
system "./configure", *std_configure_args,
"--disable-silent-rules",
"--enable-custom-vendordir=#{etc}/OpenCL/vendors"
system "make", "install"
pkgshare.install "ocl_test.c"
end

def caveats
s = "The default vendors directory is #{etc}/OpenCL/vendors\n"
on_linux do
s += <<~EOS
No OpenCL implementation is pre-installed, so all dependents will require either
installing a compatible formula or creating an ".icd" file mapping to an externally
installed implementation. Any ".icd" files copied or symlinked into
`#{etc}/OpenCL/vendors` will automatically be detected by `ocl-icd`.
A portable OpenCL implementation is available via the `pocl` formula.
EOS
end
s
end

test do
cp pkgshare/"ocl_test.c", testpath
system ENV.cc, "ocl_test.c", "-o", "test", "-I#{Formula["opencl-headers"].opt_include}", "-L#{lib}", "-lOpenCL"
ENV["OCL_ICD_VENDORS"] = testpath/"vendors"
assert_equal "No platforms found!", shell_output("./test").chomp
end
end