pkgsrc/audio/xmms/patches/patch-an
ben 043b482855 Fix xmms to build on i386 Mac OS X 10.4.7.
Remove the _ SYMBOL_PREFIX, as OpenDarwin ports does.

Disable i386 assembly optimizations.

Add OSX code to raise priority.

_INSTALL_UNSTRIPPED=yes on OSX.  Otherwise plugins, such as
lib/xmms/Input/libmpg123.so fail to load because the OSX linker can't
find symbols such as _xmms_get_gentitle_format from xmms/main.c.
2006-08-28 05:09:05 +00:00

47 lines
1.1 KiB
Text

$NetBSD: patch-an,v 1.7 2006/08/28 05:09:05 ben Exp $
--- libxmms/util.c.orig 2003-05-19 14:22:07.000000000 -0700
+++ libxmms/util.c
@@ -15,6 +15,13 @@
#include <sys/sysctl.h>
#endif
+#if defined(__APPLE__) && defined(__MACH__)
+#include <mach/mach.h>
+#include <mach/thread_policy.h>
+#include <sys/param.h>
+#include <sys/sysctl.h>
+#endif
+
#if TIME_WITH_SYS_TIME
# include <sys/time.h>
# include <time.h>
@@ -73,6 +80,28 @@ GtkWidget *xmms_show_message(gchar * tit
gboolean xmms_check_realtime_priority(void)
{
+#if defined(__APPLE__) && defined(__MACH__)
+ struct thread_time_constraint_policy ttcpolicy;
+ int bus_speed, mib [2] = { CTL_HW, HW_BUS_FREQ };
+ size_t len;
+
+ len = sizeof (bus_speed);
+ sysctl (mib, 2, &bus_speed, &len, NULL, 0);
+
+ /* Is it enough? */
+ ttcpolicy.period = bus_speed / 120;
+ ttcpolicy.computation = bus_speed / 1000;
+ ttcpolicy.constraint = bus_speed / 500;
+ ttcpolicy.preemptible = 1;
+
+ thread_policy_set (mach_thread_self (),
+ THREAD_TIME_CONSTRAINT_POLICY,
+ (int*)&ttcpolicy,
+ THREAD_TIME_CONSTRAINT_POLICY_COUNT);
+
+ return TRUE;
+#endif
+
#ifdef HAVE_SCHED_SETSCHEDULER
#ifdef __FreeBSD__
/*