Thu Oct 24 17:48:53 2013 UTC ()
Fix build on OSX 10.6, and possibly later.
(jperkin)
diff -r1.77 -r1.78 pkgsrc/audio/pulseaudio/Makefile
diff -r1.36 -r1.37 pkgsrc/audio/pulseaudio/distinfo
diff -r0 -r1.1 pkgsrc/audio/pulseaudio/patches/patch-src_pulsecore_semaphore-osx.c
diff -r0 -r1.1 pkgsrc/audio/pulseaudio/patches/patch-src_pulsecore_svolume__mmx.c
diff -r0 -r1.1 pkgsrc/audio/pulseaudio/patches/patch-src_pulsecore_svolume__sse.c
--- pkgsrc/audio/pulseaudio/Makefile 2013/10/10 14:42:00 1.77
+++ pkgsrc/audio/pulseaudio/Makefile 2013/10/24 17:48:53 1.78
@@ -1,4 +1,4 @@
-# $NetBSD: Makefile,v 1.77 2013/10/10 14:42:00 ryoon Exp $
+# $NetBSD: Makefile,v 1.78 2013/10/24 17:48:53 jperkin Exp $
#
DISTNAME= pulseaudio-2.1
@@ -46,6 +46,11 @@
PLIST.evdev= yes
.endif
+# Find the appropriate SDK
+.if !empty(MACHINE_PLATFORM:MDarwin-10.*)
+CONFIGURE_ARGS+= --with-mac-sysroot=/Developer/SDKs/MacOSX10.6.sdk
+.endif
+
.include "options.mk"
PKGCONFIG_OVERRIDE+= libpulse-mainloop-glib.pc.in
@@ -80,7 +85,7 @@
PLIST.hal= yes
PLIST.oss= yes
. endif
-.else
+.elif ${OPSYS} != "Darwin"
PLIST.hal= yes
PLIST.oss= yes
.endif
--- pkgsrc/audio/pulseaudio/distinfo 2013/05/06 20:44:18 1.36
+++ pkgsrc/audio/pulseaudio/distinfo 2013/10/24 17:48:53 1.37
@@ -1,4 +1,4 @@
-$NetBSD: distinfo,v 1.36 2013/05/06 20:44:18 markd Exp $
+$NetBSD: distinfo,v 1.37 2013/10/24 17:48:53 jperkin Exp $
SHA1 (pulseaudio-2.1.tar.xz) = 56b4ad9207ea3aec0ad1b8be4b55793b426a4f01
RMD160 (pulseaudio-2.1.tar.xz) = 87f6051bbbe59c26e505a9765f388d3ee4d3a485
@@ -7,3 +7,6 @@
SHA1 (patch-configure) = 79f938c79a2c3a714d9c81b22030084a421da360
SHA1 (patch-dc) = 48baff12528f09940d63c6bdaf4369cab7e56de3
SHA1 (patch-src_Makefile.in) = 21daf6069ae067dd235de6d43a013e4e70bbca78
+SHA1 (patch-src_pulsecore_semaphore-osx.c) = f9b1962a700932434e05471b2d4df4a5ff5c1b00
+SHA1 (patch-src_pulsecore_svolume__mmx.c) = a3af18563fd11e3813d7a474ff8807ee9bf62390
+SHA1 (patch-src_pulsecore_svolume__sse.c) = 6d2406ad0889219bae96f52f9b525da9b19b9af9
$NetBSD: patch-src_pulsecore_semaphore-osx.c,v 1.1 2013/10/24 17:48:53 jperkin Exp $
Add patch to fix OSX build, from:
https://bugs.freedesktop.org/attachment.cgi?id=77310
--- src/pulsecore/semaphore-osx.c
+++ src/pulsecore/semaphore-osx.c
@@ -1,7 +1,8 @@
/***
This file is part of PulseAudio.
- Copyright 2009 Kim Lester <kim@dfusion.com.au>
+ Copyright 2006 Lennart Poettering
+ Copyright 2013 Albert Zeyer
PulseAudio is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published
@@ -23,40 +24,72 @@
#include <config.h>
#endif
-#include <Multiprocessing.h>
+#include <stdio.h>
+#include <errno.h>
+#include <pthread.h>
+#include <semaphore.h>
+#include <sys/types.h>
+#include <unistd.h>
#include <pulse/xmalloc.h>
#include <pulsecore/macro.h>
+#include <pulsecore/atomic.h>
+#include <pulsecore/core-util.h>
#include "semaphore.h"
+/*
+OSX doesn't support unnamed semaphores (via sem_init).
+Thus, we use a counter to give them enumerated names.
+*/
+
+static pa_atomic_t id_counter = PA_ATOMIC_INIT(0);
+
struct pa_semaphore {
- MPSemaphoreID sema;
+ sem_t* sem;
+ int id;
};
-pa_semaphore* pa_semaphore_new(unsigned int value) {
- /* NOTE: Can't assume boolean - ie value = 0,1, so use UINT_MAX (boolean more efficient ?) */
+static char *sem_name(char *fn, size_t l, int id) {
+ pa_snprintf(fn, l, "/pulse-sem-%u-%u", getpid(), id);
+ return fn;
+}
+
+pa_semaphore* pa_semaphore_new(unsigned value) {
pa_semaphore *s;
s = pa_xnew(pa_semaphore, 1);
- pa_assert_se(MPCreateSemaphore(UINT_MAX, value, &s->sema) == 0);
-
+ s->id = pa_atomic_inc(&id_counter);
+ char fn[32]; sem_name(fn, sizeof(fn), s->id);
+ sem_unlink(fn); // in case it already exists
+ if((s->sem = sem_open(fn, O_CREAT|O_EXCL, 0700, value)) == SEM_FAILED) {
+ perror("pa_semaphore_new: sem_open");
+ abort();
+ }
return s;
}
void pa_semaphore_free(pa_semaphore *s) {
pa_assert(s);
- pa_assert_se(MPDeleteSemaphore(s->sema) == 0);
+ pa_assert_se(sem_close(s->sem) == 0);
+ char fn[32]; sem_name(fn, sizeof(fn), s->id);
+ if(sem_unlink(fn) != 0)
+ perror("pa_semaphore_free: sem_unlink");
pa_xfree(s);
}
void pa_semaphore_post(pa_semaphore *s) {
pa_assert(s);
- pa_assert_se(MPSignalSemaphore(s->sema) == 0);
+ pa_assert_se(sem_post(s->sem) == 0);
}
void pa_semaphore_wait(pa_semaphore *s) {
+ int ret;
pa_assert(s);
- /* should probably check return value (-ve is error), noErr is ok. */
- pa_assert_se(MPWaitOnSemaphore(s->sema, kDurationForever) == 0);
+
+ do {
+ ret = sem_wait(s->sem);
+ } while (ret < 0 && errno == EINTR);
+
+ pa_assert(ret == 0);
}
$NetBSD: patch-src_pulsecore_svolume__mmx.c,v 1.1 2013/10/24 17:48:53 jperkin Exp $
Avoid bad register usage on OSX 32-bit.
--- src/pulsecore/svolume_mmx.c.orig 2012-07-19 11:29:39.000000000 +0000
+++ src/pulsecore/svolume_mmx.c
@@ -34,7 +34,7 @@
#include "sample-util.h"
-#if defined (__i386__) || defined (__amd64__)
+#if (defined (__i386__) && !defined(__APPLE__)) || defined (__amd64__)
/* in s: 2 int16_t samples
* in v: 2 int32_t volumes, fixed point 16:16
* out s: contains scaled and clamped int16_t samples.
@@ -328,7 +328,7 @@ static void run_test(void) {
void pa_volume_func_init_mmx(pa_cpu_x86_flag_t flags) {
-#if defined (__i386__) || defined (__amd64__)
+#if (defined (__i386__) && !defined(__APPLE__)) || defined (__amd64__)
#ifdef RUN_TEST
run_test();
$NetBSD: patch-src_pulsecore_svolume__sse.c,v 1.1 2013/10/24 17:48:53 jperkin Exp $
Avoid bad register usage on OSX 32-bit.
--- src/pulsecore/svolume_sse.c.orig 2012-07-19 11:29:39.000000000 +0000
+++ src/pulsecore/svolume_sse.c
@@ -34,7 +34,7 @@
#include "sample-util.h"
-#if defined (__i386__) || defined (__amd64__)
+#if (defined (__i386__) && !defined(__APPLE__)) || defined (__amd64__)
#define VOLUME_32x16(s,v) /* .. | vh | vl | */ \
" pxor %%xmm4, %%xmm4 \n\t" /* .. | 0 | 0 | */ \
@@ -335,7 +335,7 @@ static void run_test(void) {
#endif /* defined (__i386__) || defined (__amd64__) */
void pa_volume_func_init_sse(pa_cpu_x86_flag_t flags) {
-#if defined (__i386__) || defined (__amd64__)
+#if (defined (__i386__) && !defined(__APPLE__)) || defined (__amd64__)
#ifdef RUN_TEST
run_test();