Fix build on OSX 10.6, and possibly later.diff -r1.77 -r1.78 pkgsrc/audio/pulseaudio/Makefile
(jperkin)
@@ -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 | |||
4 | DISTNAME= pulseaudio-2.1 | 4 | DISTNAME= pulseaudio-2.1 | |
5 | PKGREVISION= 11 | 5 | PKGREVISION= 11 | |
6 | CATEGORIES= audio | 6 | CATEGORIES= audio | |
7 | MASTER_SITES= http://freedesktop.org/software/pulseaudio/releases/ | 7 | MASTER_SITES= http://freedesktop.org/software/pulseaudio/releases/ | |
8 | EXTRACT_SUFX= .tar.xz | 8 | EXTRACT_SUFX= .tar.xz | |
9 | 9 | |||
10 | MAINTAINER= pkgsrc-users@NetBSD.org | 10 | MAINTAINER= pkgsrc-users@NetBSD.org | |
11 | HOMEPAGE= http://www.freedesktop.org/wiki/Software/PulseAudio | 11 | HOMEPAGE= http://www.freedesktop.org/wiki/Software/PulseAudio | |
12 | COMMENT= Sound server for POSIX and Win32 systems | 12 | COMMENT= Sound server for POSIX and Win32 systems | |
13 | LICENSE= gnu-lgpl-v2.1 AND gnu-gpl-v2 | 13 | LICENSE= 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 | |||
36 | CONFIGURE_ARGS+= --sysconfdir=${PKG_SYSCONFBASEDIR:Q} | 36 | CONFIGURE_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) | |
46 | PLIST.evdev= yes | 46 | PLIST.evdev= yes | |
47 | .endif | 47 | .endif | |
48 | 48 | |||
49 | # Find the appropriate SDK | |||
50 | .if !empty(MACHINE_PLATFORM:MDarwin-10.*) | |||
51 | CONFIGURE_ARGS+= --with-mac-sysroot=/Developer/SDKs/MacOSX10.6.sdk | |||
52 | .endif | |||
53 | ||||
49 | .include "options.mk" | 54 | .include "options.mk" | |
50 | 55 | |||
51 | PKGCONFIG_OVERRIDE+= libpulse-mainloop-glib.pc.in | 56 | PKGCONFIG_OVERRIDE+= libpulse-mainloop-glib.pc.in | |
52 | PKGCONFIG_OVERRIDE+= libpulse-simple.pc.in | 57 | PKGCONFIG_OVERRIDE+= libpulse-simple.pc.in | |
53 | PKGCONFIG_OVERRIDE+= libpulse.pc.in | 58 | PKGCONFIG_OVERRIDE+= libpulse.pc.in | |
54 | 59 | |||
55 | LIBS.NetBSD+= ${LIBOSSAUDIO} | 60 | LIBS.NetBSD+= ${LIBOSSAUDIO} | |
56 | 61 | |||
57 | INSTALLATION_DIRS= share/examples/pulse | 62 | INSTALLATION_DIRS= share/examples/pulse | |
58 | 63 | |||
59 | PULSE_USER?= pulse | 64 | PULSE_USER?= pulse | |
60 | PULSE_GROUP?= pulse | 65 | PULSE_GROUP?= pulse | |
61 | PULSE_GROUP_REALTIME?= pulsert | 66 | PULSE_GROUP_REALTIME?= pulsert | |
@@ -70,27 +75,27 @@ CONF_FILES+= ${EGDIR}/daemon.conf ${PKG_ | @@ -70,27 +75,27 @@ CONF_FILES+= ${EGDIR}/daemon.conf ${PKG_ | |||
70 | CONF_FILES+= ${EGDIR}/default.pa ${PKG_SYSCONFDIR}/default.pa | 75 | CONF_FILES+= ${EGDIR}/default.pa ${PKG_SYSCONFDIR}/default.pa | |
71 | CONF_FILES+= ${EGDIR}/system.pa ${PKG_SYSCONFDIR}/system.pa | 76 | CONF_FILES+= ${EGDIR}/system.pa ${PKG_SYSCONFDIR}/system.pa | |
72 | CONF_FILES+= ${EGDIR}/pulseaudio-system.conf \ | 77 | CONF_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 | |||
75 | PLIST_VARS+= evdev hal oss sun | 80 | PLIST_VARS+= evdev hal oss sun | |
76 | 81 | |||
77 | .if ${OPSYS} == "SunOS" | 82 | .if ${OPSYS} == "SunOS" | |
78 | PLIST.sun= yes | 83 | PLIST.sun= yes | |
79 | . if ${OS_VERSION} == "5.11" | 84 | . if ${OS_VERSION} == "5.11" | |
80 | PLIST.hal= yes | 85 | PLIST.hal= yes | |
81 | PLIST.oss= yes | 86 | PLIST.oss= yes | |
82 | . endif | 87 | . endif | |
83 | .else | 88 | .elif ${OPSYS} != "Darwin" | |
84 | PLIST.hal= yes | 89 | PLIST.hal= yes | |
85 | PLIST.oss= yes | 90 | PLIST.oss= yes | |
86 | .endif | 91 | .endif | |
87 | 92 | |||
88 | PKG_GROUPS= ${PULSE_GROUP} | 93 | PKG_GROUPS= ${PULSE_GROUP} | |
89 | PKG_GROUPS+= ${PULSE_GROUP_REALTIME} | 94 | PKG_GROUPS+= ${PULSE_GROUP_REALTIME} | |
90 | PKG_GROUPS+= ${PULSE_GROUP_ACCESS} | 95 | PKG_GROUPS+= ${PULSE_GROUP_ACCESS} | |
91 | PKG_USERS= ${PULSE_USER}:${PULSE_GROUP} | 96 | PKG_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" |
@@ -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 | |||
3 | SHA1 (pulseaudio-2.1.tar.xz) = 56b4ad9207ea3aec0ad1b8be4b55793b426a4f01 | 3 | SHA1 (pulseaudio-2.1.tar.xz) = 56b4ad9207ea3aec0ad1b8be4b55793b426a4f01 | |
4 | RMD160 (pulseaudio-2.1.tar.xz) = 87f6051bbbe59c26e505a9765f388d3ee4d3a485 | 4 | RMD160 (pulseaudio-2.1.tar.xz) = 87f6051bbbe59c26e505a9765f388d3ee4d3a485 | |
5 | Size (pulseaudio-2.1.tar.xz) = 1355004 bytes | 5 | Size (pulseaudio-2.1.tar.xz) = 1355004 bytes | |
6 | SHA1 (patch-aa) = 59dbd4e6670bc401d2254226b6ba1f4549f35ff7 | 6 | SHA1 (patch-aa) = 59dbd4e6670bc401d2254226b6ba1f4549f35ff7 | |
7 | SHA1 (patch-configure) = 79f938c79a2c3a714d9c81b22030084a421da360 | 7 | SHA1 (patch-configure) = 79f938c79a2c3a714d9c81b22030084a421da360 | |
8 | SHA1 (patch-dc) = 48baff12528f09940d63c6bdaf4369cab7e56de3 | 8 | SHA1 (patch-dc) = 48baff12528f09940d63c6bdaf4369cab7e56de3 | |
9 | SHA1 (patch-src_Makefile.in) = 21daf6069ae067dd235de6d43a013e4e70bbca78 | 9 | SHA1 (patch-src_Makefile.in) = 21daf6069ae067dd235de6d43a013e4e70bbca78 | |
10 | SHA1 (patch-src_pulsecore_semaphore-osx.c) = f9b1962a700932434e05471b2d4df4a5ff5c1b00 | |||
11 | SHA1 (patch-src_pulsecore_svolume__mmx.c) = a3af18563fd11e3813d7a474ff8807ee9bf62390 | |||
12 | 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();