pulsecoreincludedir=$(includedir)/pulsecore
pulseconfdir=$(sysconfdir)/pulse
pulselibexecdir=$(libexecdir)/pulse
+if HAVE_X11
xdgautostartdir=$(sysconfdir)/xdg/autostart
+endif
+if HAVE_ALSA
alsaprofilesetsdir=$(datadir)/pulseaudio/alsa-mixer/profile-sets
alsapathsdir=$(datadir)/pulseaudio/alsa-mixer/paths
+endif
+if HAVE_DBUS
dbuspolicydir=$(sysconfdir)/dbus-1/system.d
+endif
###################################
# Defines #
###################################
PA_BINARY=$(bindir)/pulseaudio$(EXEEXT)
-if OS_IS_WIN32
-PA_DEFAULT_CONFIG_DIR=%PULSE_ROOT%
-else
PA_DEFAULT_CONFIG_DIR=$(pulseconfdir)
-endif
###################################
# Compiler/linker flags #
WINSOCK_LIBS=-lwsock32 -lws2_32 -lwininet
endif
+ if OS_IS_DARWIN
+ AM_LDFLAGS+=-headerpad_max_install_names
+ endif
+
FOREIGN_CFLAGS = -w
MODULE_LDFLAGS = $(AM_LDFLAGS) -module -disable-static -avoid-version $(LDFLAGS_NOUNDEFINED)
MODULE_LIBADD = $(AM_LIBADD) libpulsecore-@PA_MAJORMINOR@.la libpulsecommon-@PA_MAJORMINOR@.la libpulse.la
xdgautostart_in_files = \
daemon/pulseaudio.desktop.in \
daemon/pulseaudio-kde.desktop.in
-endif
xdgautostart_DATA = $(xdgautostart_in_files:.desktop.in=.desktop)
@INTLTOOL_DESKTOP_RULE@
+endif
###################################
pulsecore/flist.c pulsecore/flist.h \
pulsecore/hashmap.c pulsecore/hashmap.h \
pulsecore/idxset.c pulsecore/idxset.h \
- pulsecore/inet_ntop.c pulsecore/inet_ntop.h \
- pulsecore/inet_pton.c pulsecore/inet_pton.h \
+ pulsecore/arpa-inet.c pulsecore/arpa-inet.h \
pulsecore/iochannel.c pulsecore/iochannel.h \
pulsecore/ioline.c pulsecore/ioline.h \
pulsecore/ipacl.h pulsecore/ipacl.c \
# COREAUDIO
- module_coreaudio_detect_la_SOURCES = modules/coreaudio/module-coreaudio-detect.c
+ module_coreaudio_detect_la_SOURCES = modules/macosx/module-coreaudio-detect.c
module_coreaudio_detect_la_LDFLAGS = $(MODULE_LDFLAGS) \
-Wl,-framework -Wl,Cocoa -framework CoreAudio \
-Wl,-framework -Wl,AudioUnit -framework AudioUnit
module_coreaudio_detect_la_LIBADD = $(MODULE_LIBADD)
- module_coreaudio_device_la_SOURCES = modules/coreaudio/module-coreaudio-device.c
+ module_coreaudio_device_la_SOURCES = modules/macosx/module-coreaudio-device.c
module_coreaudio_device_la_LDFLAGS = $(MODULE_LDFLAGS) \
-Wl,-framework -Wl,Cocoa -framework CoreAudio \
-Wl,-framework -Wl,AudioUnit -framework AudioUnit
# Bonjour
- module_bonjour_publish_la_SOURCES = modules/module-bonjour-publish.c
+ module_bonjour_publish_la_SOURCES = modules/macosx/module-bonjour-publish.c
module_bonjour_publish_la_LDFLAGS = $(MODULE_LDFLAGS) \
-Wl,-framework -Wl,CoreFoundation -framework CoreFoundation
module_bonjour_publish_la_LIBADD = $(MODULE_LIBADD)
$(AM_V_GEN) sed -e 's,@PA_DLSEARCHPATH\@,$(modlibexecdir),g' \
-e 's,@PA_DEFAULT_CONFIG_FILE\@,$(DEFAULT_CONFIG_DIR),g' < $< > $@
+if OS_IS_WIN32
+SYMLINK_PROGRAM=cd $(DESTDIR)$(bindir) && cp
+else
+SYMLINK_PROGRAM=ln -sf
+endif
install-exec-hook:
+if HAVE_BLUEZ
-chown root $(DESTDIR)$(pulselibexecdir)/proximity-helper
-chmod u+s $(DESTDIR)$(pulselibexecdir)/proximity-helper
- ln -sf pacat $(DESTDIR)$(bindir)/parec
- ln -sf pacat $(DESTDIR)$(bindir)/pamon
- ln -sf pacat $(DESTDIR)$(bindir)/paplay
- ln -sf pacat $(DESTDIR)$(bindir)/parecord
+endif
+ $(SYMLINK_PROGRAM) pacat$(EXEEXT) $(DESTDIR)$(bindir)/parec$(EXEEXT)
+ $(SYMLINK_PROGRAM) pacat$(EXEEXT) $(DESTDIR)$(bindir)/pamon$(EXEEXT)
+ $(SYMLINK_PROGRAM) pacat$(EXEEXT) $(DESTDIR)$(bindir)/paplay$(EXEEXT)
+ $(SYMLINK_PROGRAM) pacat$(EXEEXT) $(DESTDIR)$(bindir)/parecord$(EXEEXT)
rm -f $(DESTDIR)$(libdir)/libpulsedsp.la
rm -f $(DESTDIR)$(modlibexecdir)/*.la
uninstall-hook:
- rm -f $(DESTDIR)$(bindir)/parec
- rm -f $(DESTDIR)$(bindir)/pamon
- rm -f $(DESTDIR)$(bindir)/paplay
- rm -f $(DESTDIR)$(bindir)/parecord
+ rm -f $(DESTDIR)$(bindir)/parec$(EXEEXT)
+ rm -f $(DESTDIR)$(bindir)/pamon$(EXEEXT)
+ rm -f $(DESTDIR)$(bindir)/paplay$(EXEEXT)
+ rm -f $(DESTDIR)$(bindir)/parecord$(EXEEXT)
rm -f $(DESTDIR)$(libdir)/libpulsedsp.*
rm -f $(DESTDIR)$(modlibexecdir)/*.so
update-sbc:
for i in $(BLUETOOTH_SBC_FILES) ; do \
wget -O /dev/null http://git.kernel.org/\?p=bluetooth/bluez.git\;a=blob_plain\;f=$$i ; \
- wget -O modules/bluetooth/$$i http://git.kernel.org/\?p=bluetooth/bluez.git\;a=blob_plain\;f=$$i ; \
+ wget -O $(top_srcdir)/src/modules/bluetooth/$$i http://git.kernel.org/\?p=bluetooth/bluez.git\;a=blob_plain\;f=$$i ; \
done
for i in $(BLUETOOTH_IPC_FILES); do \
wget -O /dev/null http://git.kernel.org/\?p=bluetooth/bluez.git\;a=blob_plain\;f=audio/$$i ; \
- wget -O modules/bluetooth/$$i http://git.kernel.org/\?p=bluetooth/bluez.git\;a=blob_plain\;f=audio/$$i ; \
+ wget -O $(top_srcdir)/src/modules/bluetooth/$$i http://git.kernel.org/\?p=bluetooth/bluez.git\;a=blob_plain\;f=audio/$$i ; \
done
update-reserve:
for i in reserve.c reserve.h reserve-monitor.c reserve-monitor.h ; do \
- wget -O modules/$$i http://git.0pointer.de/\?p=reserve.git\;a=blob_plain\;f=$$i\;hb=master ; \
+ wget -O $(top_srcdir)/src/modules/$$i http://git.0pointer.de/\?p=reserve.git\;a=blob_plain\;f=$$i\;hb=master ; \
done
update-rtkit:
for i in rtkit.c rtkit.h ; do \
- wget -O pulsecore/$$i http://git.0pointer.de/\?p=rtkit.git\;a=blob_plain\;f=$$i\;hb=master ; \
+ wget -O $(top_srcdir)/src/pulsecore/$$i http://git.0pointer.de/\?p=rtkit.git\;a=blob_plain\;f=$$i\;hb=master ; \
done
# Automatically generate linker version script. We use the same one for all public .sos
#ifdef __APPLE__
#include <xlocale.h>
+ #include <mach/mach_init.h>
+ #include <mach/thread_act.h>
+ #include <mach/thread_policy.h>
+ #include <sys/sysctl.h>
#endif
#ifdef HAVE_DBUS
#ifdef OS_IS_WIN32
-#define PULSE_ROOTENV "PULSE_ROOT"
+/* Returns the directory of the current DLL, with '/bin/' removed if it is the last component */
+char *pa_win32_get_toplevel(HANDLE handle) {
+ static char *toplevel = NULL;
-int pa_set_root(HANDLE handle) {
- char library_path[MAX_PATH], *sep;
+ if (!toplevel) {
+ char library_path[MAX_PATH];
+ char *p;
- /* FIXME: Needs to set errno */
+ if (!GetModuleFileName(handle, library_path, MAX_PATH))
+ return NULL;
- if (!GetModuleFileName(handle, library_path, MAX_PATH))
- return 0;
+ toplevel = pa_xstrdup(library_path);
- sep = strrchr(library_path, PA_PATH_SEP_CHAR);
- if (sep)
- *sep = '\0';
+ p = strrchr(toplevel, PA_PATH_SEP_CHAR);
+ if (p)
+ *p = '\0';
- if (!SetEnvironmentVariable(PULSE_ROOTENV, library_path))
- return 0;
+ p = strrchr(toplevel, PA_PATH_SEP_CHAR);
+ if (p && (strcmp(p + 1, "bin") == 0))
+ *p = '\0';
+ }
- return 1;
+ return toplevel;
}
#endif
}
#ifdef HAVE_FCHOWN
- if (uid == (uid_t)-1)
+ if (uid == (uid_t) -1)
uid = getuid();
- if (gid == (gid_t)-1)
+ if (gid == (gid_t) -1)
gid = getgid();
- (void) fchown(fd, uid, gid);
+ if (fchown(fd, uid, gid) < 0)
+ goto fail;
#endif
#ifdef HAVE_FCHMOD
* the thread is already realtime, don't do anything. */
int pa_make_realtime(int rtprio) {
- #ifdef _POSIX_PRIORITY_SCHEDULING
+ #if defined(OS_IS_DARWIN)
+ struct thread_time_constraint_policy ttcpolicy;
+ uint64_t freq = 0;
+ size_t size = sizeof(freq);
+ int ret;
+
+ ret = sysctlbyname("hw.cpufrequency", &freq, &size, NULL, 0);
+ if (ret < 0) {
+ pa_log_info("Unable to read CPU frequency, acquisition of real-time scheduling failed.");
+ return -1;
+ }
+
+ pa_log_debug("sysctl for hw.cpufrequency: %llu", freq);
+
+ /* See http://developer.apple.com/library/mac/#documentation/Darwin/Conceptual/KernelProgramming/scheduler/scheduler.html */
+ ttcpolicy.period = freq / 160;
+ ttcpolicy.computation = freq / 3300;
+ ttcpolicy.constraint = freq / 2200;
+ ttcpolicy.preemptible = 1;
+
+ ret = thread_policy_set(mach_thread_self(),
+ THREAD_TIME_CONSTRAINT_POLICY,
+ (thread_policy_t) &ttcpolicy,
+ THREAD_TIME_CONSTRAINT_POLICY_COUNT);
+ if (ret) {
+ pa_log_info("Unable to set real-time thread priority (%08x).", ret);
+ return -1;
+ }
+
+ pa_log_info("Successfully acquired real-time thread priority.");
+ return 0;
+
+ #elif _POSIX_PRIORITY_SCHEDULING
int p;
if (set_scheduler(rtprio) >= 0) {
#elif defined(OS_IS_WIN32)
/* Windows only allows realtime scheduling to be set on a per process basis.
* Therefore, instead of making the thread realtime, just give it the highest non-realtime priority. */
- if(SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_TIME_CRITICAL)) {
+ if (SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_TIME_CRITICAL)) {
pa_log_info("Successfully enabled THREAD_PRIORITY_TIME_CRITICAL scheduling for thread.");
return 0;
}
}
#else
- switch(sig) {
+ switch (sig) {
#ifdef SIGHUP
case SIGHUP: return "SIGHUP";
#endif
return 0;
}
- pa_log("%slock: %s", !b? "un" : "", pa_cstrerror(errno));
+ pa_log("%slock: %s", !b ? "un" : "", pa_cstrerror(errno));
#endif
#ifdef OS_IS_WIN32
- HANDLE h = (HANDLE)_get_osfhandle(fd);
+ HANDLE h = (HANDLE) _get_osfhandle(fd);
if (b && LockFile(h, 0, 0, 0xFFFFFFFF, 0xFFFFFFFF))
return 0;
* stored there.*/
FILE *pa_open_config_file(const char *global, const char *local, const char *env, char **result) {
const char *fn;
-#ifdef OS_IS_WIN32
- char buf[PATH_MAX];
-
- if (!getenv(PULSE_ROOTENV))
- pa_set_root(NULL);
-#endif
+ FILE *f;
if (env && (fn = getenv(env))) {
- FILE *f;
-
-#ifdef OS_IS_WIN32
- if (!ExpandEnvironmentStrings(fn, buf, PATH_MAX))
- /* FIXME: Needs to set errno! */
- return NULL;
- fn = buf;
-#endif
-
if ((f = pa_fopen_cloexec(fn, "r"))) {
if (result)
*result = pa_xstrdup(fn);
const char *e;
char *lfn;
char *h;
- FILE *f;
if ((e = getenv("PULSE_CONFIG_PATH")))
fn = lfn = pa_sprintf_malloc("%s" PA_PATH_SEP "%s", e, local);
} else
return NULL;
-#ifdef OS_IS_WIN32
- if (!ExpandEnvironmentStrings(lfn, buf, PATH_MAX)) {
- /* FIXME: Needs to set errno! */
- pa_xfree(lfn);
- return NULL;
- }
- fn = buf;
-#endif
-
if ((f = pa_fopen_cloexec(fn, "r"))) {
if (result)
*result = pa_xstrdup(fn);
}
if (global) {
- FILE *f;
+ char *gfn;
#ifdef OS_IS_WIN32
- if (!ExpandEnvironmentStrings(global, buf, PATH_MAX))
- /* FIXME: Needs to set errno! */
- return NULL;
- global = buf;
+ if (strncmp(global, PA_DEFAULT_CONFIG_DIR, strlen(PA_DEFAULT_CONFIG_DIR)) == 0)
+ gfn = pa_sprintf_malloc("%s" PA_PATH_SEP "etc" PA_PATH_SEP "pulse%s",
+ pa_win32_get_toplevel(NULL),
+ global + strlen(PA_DEFAULT_CONFIG_DIR));
+ else
#endif
+ gfn = pa_xstrdup(global);
- if ((f = pa_fopen_cloexec(global, "r"))) {
-
+ if ((f = pa_fopen_cloexec(gfn, "r"))) {
if (result)
- *result = pa_xstrdup(global);
+ *result = gfn;
+ else
+ pa_xfree(gfn);
return f;
}
+ pa_xfree(gfn);
}
errno = ENOENT;
char *pa_find_config_file(const char *global, const char *local, const char *env) {
const char *fn;
-#ifdef OS_IS_WIN32
- char buf[PATH_MAX];
-
- if (!getenv(PULSE_ROOTENV))
- pa_set_root(NULL);
-#endif
if (env && (fn = getenv(env))) {
-
-#ifdef OS_IS_WIN32
- if (!ExpandEnvironmentStrings(fn, buf, PATH_MAX))
- /* FIXME: Needs to set errno! */
- return NULL;
- fn = buf;
-#endif
-
if (access(fn, R_OK) == 0)
return pa_xstrdup(fn);
} else
return NULL;
-#ifdef OS_IS_WIN32
- if (!ExpandEnvironmentStrings(lfn, buf, PATH_MAX)) {
- /* FIXME: Needs to set errno! */
- pa_xfree(lfn);
- return NULL;
- }
- fn = buf;
-#endif
-
if (access(fn, R_OK) == 0) {
char *r = pa_xstrdup(fn);
pa_xfree(lfn);
}
if (global) {
+ char *gfn;
+
#ifdef OS_IS_WIN32
- if (!ExpandEnvironmentStrings(global, buf, PATH_MAX))
- /* FIXME: Needs to set errno! */
- return NULL;
- global = buf;
+ if (strncmp(global, PA_DEFAULT_CONFIG_DIR, strlen(PA_DEFAULT_CONFIG_DIR)) == 0)
+ gfn = pa_sprintf_malloc("%s" PA_PATH_SEP "etc" PA_PATH_SEP "pulse%s",
+ pa_win32_get_toplevel(NULL),
+ global + strlen(PA_DEFAULT_CONFIG_DIR));
+ else
#endif
+ gfn = pa_xstrdup(global);
- if (access(global, R_OK) == 0)
- return pa_xstrdup(global);
+ if (access(gfn, R_OK) == 0)
+ return gfn;
+ pa_xfree(gfn);
}
errno = ENOENT;
pa_assert(s);
pa_assert(slength > 0);
- while (i < dlength && j+3 <= slength) {
+ while (j+2 < slength && i < dlength) {
s[j++] = hex[*d >> 4];
s[j++] = hex[*d & 0xF];