From b920dd16f491e894ab8c9f163d4d0e76b09d91e7 Mon Sep 17 00:00:00 2001 From: jperkin Date: Thu, 24 Oct 2013 17:48:53 +0000 Subject: Fix build on OSX 10.6, and possibly later. --- audio/pulseaudio/Makefile | 9 +- audio/pulseaudio/distinfo | 5 +- .../patches/patch-src_pulsecore_semaphore-osx.c | 101 +++++++++++++++++++++ .../patches/patch-src_pulsecore_svolume__mmx.c | 24 +++++ .../patches/patch-src_pulsecore_svolume__sse.c | 24 +++++ 5 files changed, 160 insertions(+), 3 deletions(-) create mode 100644 audio/pulseaudio/patches/patch-src_pulsecore_semaphore-osx.c create mode 100644 audio/pulseaudio/patches/patch-src_pulsecore_svolume__mmx.c create mode 100644 audio/pulseaudio/patches/patch-src_pulsecore_svolume__sse.c (limited to 'audio/pulseaudio') diff --git a/audio/pulseaudio/Makefile b/audio/pulseaudio/Makefile index 8d099896eb8..79310b4a25a 100644 --- a/audio/pulseaudio/Makefile +++ b/audio/pulseaudio/Makefile @@ -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 @@ CONFIGURE_ARGS+= --sysconfdir=${PKG_SYSCONFBASEDIR:Q} 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.sun= yes PLIST.hal= yes PLIST.oss= yes . endif -.else +.elif ${OPSYS} != "Darwin" PLIST.hal= yes PLIST.oss= yes .endif diff --git a/audio/pulseaudio/distinfo b/audio/pulseaudio/distinfo index 0fb4bff9777..f0e02a5d952 100644 --- a/audio/pulseaudio/distinfo +++ b/audio/pulseaudio/distinfo @@ -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-aa) = 59dbd4e6670bc401d2254226b6ba1f4549f35ff7 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 diff --git a/audio/pulseaudio/patches/patch-src_pulsecore_semaphore-osx.c b/audio/pulseaudio/patches/patch-src_pulsecore_semaphore-osx.c new file mode 100644 index 00000000000..9278cdca43f --- /dev/null +++ b/audio/pulseaudio/patches/patch-src_pulsecore_semaphore-osx.c @@ -0,0 +1,101 @@ +$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 ++ 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 + #endif + +-#include ++#include ++#include ++#include ++#include ++#include ++#include + + #include + #include ++#include ++#include + + #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); + } diff --git a/audio/pulseaudio/patches/patch-src_pulsecore_svolume__mmx.c b/audio/pulseaudio/patches/patch-src_pulsecore_svolume__mmx.c new file mode 100644 index 00000000000..706c0d41f02 --- /dev/null +++ b/audio/pulseaudio/patches/patch-src_pulsecore_svolume__mmx.c @@ -0,0 +1,24 @@ +$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(); diff --git a/audio/pulseaudio/patches/patch-src_pulsecore_svolume__sse.c b/audio/pulseaudio/patches/patch-src_pulsecore_svolume__sse.c new file mode 100644 index 00000000000..721608f595e --- /dev/null +++ b/audio/pulseaudio/patches/patch-src_pulsecore_svolume__sse.c @@ -0,0 +1,24 @@ +$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(); -- cgit v1.2.3