Skip to content

Commit cdeb1d2

Browse files
committed
libblastrampoline 5.11.0 (new formula)
1 parent 55462ba commit cdeb1d2

File tree

1 file changed

+57
-0
lines changed

1 file changed

+57
-0
lines changed

Formula/lib/libblastrampoline.rb

Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
class Libblastrampoline < Formula
2+
desc "Using PLT trampolines to provide a BLAS and LAPACK demuxing library"
3+
homepage "https://github.com/JuliaLinearAlgebra/libblastrampoline"
4+
url "https://github.com/JuliaLinearAlgebra/libblastrampoline/archive/refs/tags/v5.11.0.tar.gz"
5+
sha256 "4ea6c134843bd868f78d7ee0c61bf8bdda5334f20deaa6d3cd5bc6caafc4af17"
6+
license all_of: [
7+
"MIT",
8+
"BSD-2-Clause-Views", # include/common/f77blas.h
9+
"BSD-3-Clause", # include/common/lapacke*
10+
]
11+
12+
depends_on "openblas" => :test
13+
14+
def install
15+
system "make", "-C", "src", "install", "prefix=#{prefix}"
16+
(pkgshare/"test").install "test/dgemm_test/dgemm_test.c"
17+
end
18+
19+
test do
20+
cp pkgshare/"test/dgemm_test.c", testpath
21+
22+
(testpath/"api_test.c").write <<~EOS
23+
#include <assert.h>
24+
#include <stdio.h>
25+
#include <libblastrampoline.h>
26+
27+
int main() {
28+
const lbt_config_t * config = lbt_get_config();
29+
assert(config != NULL);
30+
31+
lbt_library_info_t ** libs = config->loaded_libs;
32+
assert(libs != NULL);
33+
assert(sizeof(libs) == sizeof(lbt_library_info_t *));
34+
assert(libs[0] != NULL);
35+
36+
printf("%s", libs[0]->libname);
37+
return 0;
38+
}
39+
EOS
40+
41+
system ENV.cc, "dgemm_test.c", "-I#{include}", "-L#{lib}", "-lblastrampoline", "-o", "dgemm_test"
42+
system ENV.cc, "api_test.c", "-I#{include}", "-L#{lib}", "-lblastrampoline", "-o", "api_test"
43+
44+
test_libs = [shared_library("libopenblas")]
45+
if OS.mac?
46+
test_libs << "/System/Library/Frameworks/Accelerate.framework/Accelerate"
47+
ENV["DYLD_LIBRARY_PATH"] = Formula["openblas"].opt_lib.to_s
48+
end
49+
50+
test_libs.each do |test_lib|
51+
with_env(LBT_DEFAULT_LIBS: test_lib) do
52+
assert_equal test_lib, shell_output("./api_test")
53+
system "./dgemm_test"
54+
end
55+
end
56+
end
57+
end

0 commit comments

Comments
 (0)