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

cvs diff -r1.77 -r1.78 pkgsrc/audio/pulseaudio/Makefile (expand / switch to unified diff)

--- 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,14 +1,14 @@ @@ -1,14 +1,14 @@
1# $NetBSD: Makefile,v 1.77 2013/10/10 14:42:00 ryoon Exp $ 1# $NetBSD: Makefile,v 1.78 2013/10/24 17:48:53 jperkin Exp $
2# 2#
3 3
4DISTNAME= pulseaudio-2.1 4DISTNAME= pulseaudio-2.1
5PKGREVISION= 11 5PKGREVISION= 11
6CATEGORIES= audio 6CATEGORIES= audio
7MASTER_SITES= http://freedesktop.org/software/pulseaudio/releases/ 7MASTER_SITES= http://freedesktop.org/software/pulseaudio/releases/
8EXTRACT_SUFX= .tar.xz 8EXTRACT_SUFX= .tar.xz
9 9
10MAINTAINER= pkgsrc-users@NetBSD.org 10MAINTAINER= pkgsrc-users@NetBSD.org
11HOMEPAGE= http://www.freedesktop.org/wiki/Software/PulseAudio 11HOMEPAGE= http://www.freedesktop.org/wiki/Software/PulseAudio
12COMMENT= Sound server for POSIX and Win32 systems 12COMMENT= Sound server for POSIX and Win32 systems
13LICENSE= gnu-lgpl-v2.1 AND gnu-gpl-v2 13LICENSE= gnu-lgpl-v2.1 AND gnu-gpl-v2
14 14
@@ -36,26 +36,31 @@ CONFIGURE_ARGS+= --localstatedir=${VARBA @@ -36,26 +36,31 @@ CONFIGURE_ARGS+= --localstatedir=${VARBA
36CONFIGURE_ARGS+= --sysconfdir=${PKG_SYSCONFBASEDIR:Q} 36CONFIGURE_ARGS+= --sysconfdir=${PKG_SYSCONFBASEDIR:Q}
37 37
38# Use native atomic ops on NetBSD >= 5.0, otherwise 38# Use native atomic ops on NetBSD >= 5.0, otherwise
39# fallback to libatomic_ops 39# fallback to libatomic_ops
40.if !(${OPSYS} == "NetBSD" && exists(/usr/include/sys/atomic.h)) 40.if !(${OPSYS} == "NetBSD" && exists(/usr/include/sys/atomic.h))
41.include "../../devel/libatomic_ops/buildlink3.mk" 41.include "../../devel/libatomic_ops/buildlink3.mk"
42.endif 42.endif
43 43
44# Build module-mmkbd-evdev.so under Linux 44# Build module-mmkbd-evdev.so under Linux
45.if ${OPSYS} == "Linux" && exists(/usr/include/linux/input.h) 45.if ${OPSYS} == "Linux" && exists(/usr/include/linux/input.h)
46PLIST.evdev= yes 46PLIST.evdev= yes
47.endif 47.endif
48 48
 49# Find the appropriate SDK
 50.if !empty(MACHINE_PLATFORM:MDarwin-10.*)
 51CONFIGURE_ARGS+= --with-mac-sysroot=/Developer/SDKs/MacOSX10.6.sdk
 52.endif
 53
49.include "options.mk" 54.include "options.mk"
50 55
51PKGCONFIG_OVERRIDE+= libpulse-mainloop-glib.pc.in 56PKGCONFIG_OVERRIDE+= libpulse-mainloop-glib.pc.in
52PKGCONFIG_OVERRIDE+= libpulse-simple.pc.in 57PKGCONFIG_OVERRIDE+= libpulse-simple.pc.in
53PKGCONFIG_OVERRIDE+= libpulse.pc.in 58PKGCONFIG_OVERRIDE+= libpulse.pc.in
54 59
55LIBS.NetBSD+= ${LIBOSSAUDIO} 60LIBS.NetBSD+= ${LIBOSSAUDIO}
56 61
57INSTALLATION_DIRS= share/examples/pulse 62INSTALLATION_DIRS= share/examples/pulse
58 63
59PULSE_USER?= pulse 64PULSE_USER?= pulse
60PULSE_GROUP?= pulse 65PULSE_GROUP?= pulse
61PULSE_GROUP_REALTIME?= pulsert 66PULSE_GROUP_REALTIME?= pulsert
@@ -70,27 +75,27 @@ CONF_FILES+= ${EGDIR}/daemon.conf ${PKG_ @@ -70,27 +75,27 @@ CONF_FILES+= ${EGDIR}/daemon.conf ${PKG_
70CONF_FILES+= ${EGDIR}/default.pa ${PKG_SYSCONFDIR}/default.pa 75CONF_FILES+= ${EGDIR}/default.pa ${PKG_SYSCONFDIR}/default.pa
71CONF_FILES+= ${EGDIR}/system.pa ${PKG_SYSCONFDIR}/system.pa 76CONF_FILES+= ${EGDIR}/system.pa ${PKG_SYSCONFDIR}/system.pa
72CONF_FILES+= ${EGDIR}/pulseaudio-system.conf \ 77CONF_FILES+= ${EGDIR}/pulseaudio-system.conf \
73 ${PKG_SYSCONFBASE}/dbus-1/system.d/pulseaudio-system.conf 78 ${PKG_SYSCONFBASE}/dbus-1/system.d/pulseaudio-system.conf
74 79
75PLIST_VARS+= evdev hal oss sun 80PLIST_VARS+= evdev hal oss sun
76 81
77.if ${OPSYS} == "SunOS" 82.if ${OPSYS} == "SunOS"
78PLIST.sun= yes 83PLIST.sun= yes
79. if ${OS_VERSION} == "5.11" 84. if ${OS_VERSION} == "5.11"
80PLIST.hal= yes 85PLIST.hal= yes
81PLIST.oss= yes 86PLIST.oss= yes
82. endif 87. endif
83.else 88.elif ${OPSYS} != "Darwin"
84PLIST.hal= yes 89PLIST.hal= yes
85PLIST.oss= yes 90PLIST.oss= yes
86.endif 91.endif
87 92
88PKG_GROUPS= ${PULSE_GROUP} 93PKG_GROUPS= ${PULSE_GROUP}
89PKG_GROUPS+= ${PULSE_GROUP_REALTIME} 94PKG_GROUPS+= ${PULSE_GROUP_REALTIME}
90PKG_GROUPS+= ${PULSE_GROUP_ACCESS} 95PKG_GROUPS+= ${PULSE_GROUP_ACCESS}
91PKG_USERS= ${PULSE_USER}:${PULSE_GROUP} 96PKG_USERS= ${PULSE_USER}:${PULSE_GROUP}
92 97
93.if ${OPSYS} != "Darwin" 98.if ${OPSYS} != "Darwin"
94.include "../../sysutils/consolekit/buildlink3.mk" 99.include "../../sysutils/consolekit/buildlink3.mk"
95.endif 100.endif
96.include "../../audio/libsamplerate/buildlink3.mk" 101.include "../../audio/libsamplerate/buildlink3.mk"

cvs diff -r1.36 -r1.37 pkgsrc/audio/pulseaudio/distinfo (expand / switch to unified diff)

--- 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,9 +1,12 @@ @@ -1,9 +1,12 @@
1$NetBSD: distinfo,v 1.36 2013/05/06 20:44:18 markd Exp $ 1$NetBSD: distinfo,v 1.37 2013/10/24 17:48:53 jperkin Exp $
2 2
3SHA1 (pulseaudio-2.1.tar.xz) = 56b4ad9207ea3aec0ad1b8be4b55793b426a4f01 3SHA1 (pulseaudio-2.1.tar.xz) = 56b4ad9207ea3aec0ad1b8be4b55793b426a4f01
4RMD160 (pulseaudio-2.1.tar.xz) = 87f6051bbbe59c26e505a9765f388d3ee4d3a485 4RMD160 (pulseaudio-2.1.tar.xz) = 87f6051bbbe59c26e505a9765f388d3ee4d3a485
5Size (pulseaudio-2.1.tar.xz) = 1355004 bytes 5Size (pulseaudio-2.1.tar.xz) = 1355004 bytes
6SHA1 (patch-aa) = 59dbd4e6670bc401d2254226b6ba1f4549f35ff7 6SHA1 (patch-aa) = 59dbd4e6670bc401d2254226b6ba1f4549f35ff7
7SHA1 (patch-configure) = 79f938c79a2c3a714d9c81b22030084a421da360 7SHA1 (patch-configure) = 79f938c79a2c3a714d9c81b22030084a421da360
8SHA1 (patch-dc) = 48baff12528f09940d63c6bdaf4369cab7e56de3 8SHA1 (patch-dc) = 48baff12528f09940d63c6bdaf4369cab7e56de3
9SHA1 (patch-src_Makefile.in) = 21daf6069ae067dd235de6d43a013e4e70bbca78 9SHA1 (patch-src_Makefile.in) = 21daf6069ae067dd235de6d43a013e4e70bbca78
 10SHA1 (patch-src_pulsecore_semaphore-osx.c) = f9b1962a700932434e05471b2d4df4a5ff5c1b00
 11SHA1 (patch-src_pulsecore_svolume__mmx.c) = a3af18563fd11e3813d7a474ff8807ee9bf62390
 12SHA1 (patch-src_pulsecore_svolume__sse.c) = 6d2406ad0889219bae96f52f9b525da9b19b9af9

File Added: pkgsrc/audio/pulseaudio/patches/Attic/patch-src_pulsecore_semaphore-osx.c
$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);
 }

File Added: pkgsrc/audio/pulseaudio/patches/Attic/patch-src_pulsecore_svolume__mmx.c
$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();

File Added: pkgsrc/audio/pulseaudio/patches/Attic/patch-src_pulsecore_svolume__sse.c
$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();