-
Notifications
You must be signed in to change notification settings - Fork 8
/
libmysofa.rb
36 lines (31 loc) · 1.1 KB
/
libmysofa.rb
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
class Libmysofa < Formula
desc "Library for reading AES SOFA files"
homepage "https://github.com/hoene/libmysofa"
url "https://github.com/hoene/libmysofa/archive/refs/tags/v1.3.3.tar.gz"
sha256 "a15f7236a2b492f8d8da69f6c71b5bde1ef1bac0ef428b94dfca1cabcb24c84f"
license "BSD-3-Clause"
head "https://github.com/hoene/libmysofa.git", branch: "main"
depends_on "cmake" => :build
depends_on "zlib"
def install
ENV.append "CFLAGS", (Hardware::CPU.arm? ? "-mcpu=native" : "-march=native -mtune=native") + " -Ofast -flto=thin"
system "cmake", "-S", ".", "-B", "build", *std_cmake_args, "-D BUILD_TESTS=OFF"
system "cmake", "--build", "build"
system "cmake", "--install", "build"
end
test do
(testpath/"test.c").write <<~EOS
#include <mysofa.h>
int main(void)
{
char buffer[9] = "TESTDATA";
int filter_length;
int err;
struct MYSOFA_EASY *hrtf = NULL;
hrtf = mysofa_open_data(buffer, 9, 48000, &filter_length, &err);
}
EOS
system ENV.cc, "test.c", "-L#{lib}", "-lmysofa", "-o", "test"
system "./test"
end
end