Skip to content

Instantly share code, notes, and snippets.

@TagPro-PreciousRoy
Last active August 29, 2015 14:06
Show Gist options
  • Save TagPro-PreciousRoy/256f90d88ce2dfb4d82f to your computer and use it in GitHub Desktop.
Save TagPro-PreciousRoy/256f90d88ce2dfb4d82f to your computer and use it in GitHub Desktop.
Homebrew formula for pulseaudio 5.0 on Mac OS 10.9.5
diff --git a/src/daemon/default.pa.in b/src/daemon/default.pa.in
index 4e77ae9..eb1ae73 100755
--- a/src/daemon/default.pa.in
+++ b/src/daemon/default.pa.in
@@ -75,7 +75,7 @@ load-module module-udev-detect
.ifexists module-detect@PA_SOEXT@
])dnl
### Use the static hardware detection module (for systems that lack udev support)
-load-module module-detect
+#load-module module-detect
.endif
### Automatically connect sink and source if JACK server is present
diff --git a/src/pulsecore/core-rtclock.c b/src/pulsecore/core-rtclock.c
index ee04554..3fac811 100644
--- a/src/pulsecore/core-rtclock.c
+++ b/src/pulsecore/core-rtclock.c
@@ -58,6 +58,10 @@
static int64_t counter_freq = 0;
#endif
+#ifdef OS_IS_DARWIN
+static mach_timebase_info_data_t sTimebaseInfo;
+#endif
+
pa_usec_t pa_rtclock_age(const struct timeval *tv) {
struct timeval now;
pa_assert(tv);
@@ -68,11 +72,15 @@ pa_usec_t pa_rtclock_age(const struct timeval *tv) {
struct timeval *pa_rtclock_get(struct timeval *tv) {
#if defined(OS_IS_DARWIN)
+
uint64_t val, abs_time = mach_absolute_time();
- Nanoseconds nanos;
+ uint64_t nanos;
+
+ if (sTimebaseInfo.denom == 0) {
+ (void) mach_timebase_info(&sTimebaseInfo);
+ }
- nanos = AbsoluteToNanoseconds(*(AbsoluteTime *) &abs_time);
- val = *(uint64_t *) &nanos;
+ val = abs_time * sTimebaseInfo.numer / sTimebaseInfo.denom;
tv->tv_sec = val / PA_NSEC_PER_SEC;
tv->tv_usec = (val % PA_NSEC_PER_SEC) / PA_NSEC_PER_USEC;
require 'formula'
class Pulseaudio < Formula
homepage "http://pulseaudio.org"
url "http://freedesktop.org/software/pulseaudio/releases/pulseaudio-5.0.tar.xz"
sha1 "e420931a0b9cf37331cd06e30ba415046317ab85"
option "with-nls", "Build with native language support"
option :universal
depends_on "pkg-config" => :build
depends_on "libtool" => :build
depends_on "intltool" => :build if build.with? "nls"
depends_on "gettext" => :build if build.with? "nls"
depends_on "json-c"
depends_on "libsndfile"
depends_on "libsamplerate"
depends_on :x11 => :optional
depends_on "glib" => :optional
depends_on "gconf" => :optional
depends_on "d-bus" => :optional
depends_on "gtk+3" => :optional
depends_on "jack" => :optional
# i386 patch per MacPorts
patch :p0 do
url "https://trac.macports.org/export/119615/trunk/dports/audio/pulseaudio/files/i386.patch"
sha1 "4193a6112f90d103875d2ca91462c26d811a9386"
end
patch :p0 do
url "https://gist.githubusercontent.com/aycabta/e02c1c5096ea562ecd27/raw/configure.diff"
sha1 "c781e508e50076d26d968fd27bd8b8ff2603d775"
end
patch :p1 do
url "https://gist.githubusercontent.com/TagPro-PreciousRoy/256f90d88ce2dfb4d82f/raw/fedb61c988e506be2863f5fef7c14b2bce05ab6c/pulseaudio-5.0.diff"
sha1 "84e3ad906c827f0491df6b083070746473db9a52"
end
fails_with :clang do
build 421
cause "error: thread-local storage is unsupported for the current target"
end
def install
args = %W[
--disable-dependency-tracking
--disable-silent-rules
--prefix=#{prefix}
--enable-coreaudio-output
--disable-neon-opt
--with-mac-sysroot=/
]
args << "--with-mac-sysroot=#{MacOS.sdk_path}"
args << "--with-mac-version-min=#{MacOS.version}"
args << "--disable-nls" if build.without? "nls"
if build.universal?
args << "--enable-mac-universal"
ENV.universal_binary
end
system "./configure", *args
system "make", "install"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment