aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Formula/ecasound.rb
blob: fe3cf9b49af4c310478d05e902fcdaa88ace8d3f (plain)
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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
require 'formula'

class Ecasound < Formula
  homepage 'http://www.eca.cx/ecasound/'
  url 'http://ecasound.seul.org/download/ecasound-2.9.0.tar.gz'
  sha1 'aed604742968085a8e95cdebb21dc62f1d90d2b5'

  option "with-ruby", "Compile with ruby support"

  # 2.9.0 uses clock_gettime which is not available on OS X, patch upstream:
  # http://sourceforge.net/p/ecasound/code/ci/6524048e0717dfbbf7e243edb5b96b40e5983782/tree/kvutils/kvu_threads.cpp?diff=4db2d070691fbabf6af47c68f054a9efcb6d8d47
  def patches; DATA; end

  fails_with :clang do
    build 500
    cause <<-EOS.undent
      clang does not like the fstream imports ecasound uses.
      EOS
  end

  def install
    args = %W[
      --disable-debug
      --disable-dependency-tracking
      --prefix=#{prefix}
    ]
    args << ("--enable-rubyecasound=" + ((build.with? 'ruby') ? 'yes' : 'no'))
    system "./configure", *args
    system "make install"
  end
end

__END__
--- a/kvutils/kvu_threads.cpp
+++ b/kvutils/kvu_threads.cpp
@@ -122,8 +122,15 @@
 #endif
   }
   else {
+#if defined(CLOCK_REALTIME)
     res = clock_gettime(CLOCK_REALTIME, out);
     out->tv_sec += seconds;
+#else
+    struct timeval tv;
+    res = gettimeofday(&tv, NULL);
+    out->tv_sec = tv.tv_sec + seconds;
+    out->tv_nsec = tv.tv_usec * 1000;
+#endif
   }

   return res;