forked from Sharpie/homebrew-science
/
libcue-static.rb
31 lines (26 loc) · 862 Bytes
/
libcue-static.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
class LibcueStatic < Formula
desc "Statically-build version of libcue"
homepage "https://github.com/lipnitsk/libcue"
url "https://github.com/lipnitsk/libcue/archive/v2.2.0.tar.gz"
sha256 "328f14b8ae0a6b8d4c96928b53b88a86d72a354b4da9d846343c78ba36022879"
depends_on "cmake" => :build
keg_only "Copy of libcue library"
def install
# Shared library is hardcoded
inreplace "CMakeLists.txt", "ADD_LIBRARY(cue SHARED", "ADD_LIBRARY(cue STATIC"
system "cmake", ".", *std_cmake_args
system "make"
(pkgshare/"tests").mkpath
cp_r "t/.", pkgshare/"tests"
system "make", "test"
system "make", "install"
end
test do
cp_r (pkgshare/"tests").children, testpath
Dir["*.c"].each do |f|
system ENV.cc, f, "-o", "test", "-L#{lib}", "-lcue", "-I#{include}"
system "./test"
rm "test"
end
end
end