From 96b5bd3489801aa6f5c5c3e90999bc79dcf3e05f Mon Sep 17 00:00:00 2001 From: adam Date: Wed, 25 Jul 2018 12:15:59 +0000 Subject: pulseaudio: updated to 12.2 PulseAudio 12.2 The previous release tarball contained a broken configure script, this release fixes the tarball. There are no changes in the source, except for this NEWS file update. PulseAudio 12.1 A bug fix release. * Fixed crash when switching to A2DP bluetooth profile * Fixed plugin search path in module-ladspa-sink * Fixed file permissions for the pipes created by module-pipe-sink and module-pipe-source --- audio/pulseaudio/Makefile | 69 +++++------ audio/pulseaudio/PLIST | 16 +-- audio/pulseaudio/distinfo | 14 +-- audio/pulseaudio/options.mk | 15 +-- audio/pulseaudio/patches/patch-aa | 142 ----------------------- audio/pulseaudio/patches/patch-configure.ac | 12 +- audio/pulseaudio/patches/patch-src_utils_padsp.c | 142 +++++++++++++++++++++++ 7 files changed, 201 insertions(+), 209 deletions(-) delete mode 100644 audio/pulseaudio/patches/patch-aa create mode 100644 audio/pulseaudio/patches/patch-src_utils_padsp.c (limited to 'audio/pulseaudio') diff --git a/audio/pulseaudio/Makefile b/audio/pulseaudio/Makefile index efe66730e74..4ba17489137 100644 --- a/audio/pulseaudio/Makefile +++ b/audio/pulseaudio/Makefile @@ -1,6 +1,6 @@ -# $NetBSD: Makefile,v 1.129 2018/07/06 14:10:15 ryoon Exp $ +# $NetBSD: Makefile,v 1.130 2018/07/25 12:15:59 adam Exp $ -DISTNAME= pulseaudio-12.0 +DISTNAME= pulseaudio-12.2 CATEGORIES= audio MASTER_SITES= https://freedesktop.org/software/pulseaudio/releases/ EXTRACT_SUFX= .tar.xz @@ -15,10 +15,18 @@ NOT_FOR_PLATFORM= DragonFly-*-* LIBTOOL_REQD= 2.4 GCC_REQD+= 4.8 -GNU_CONFIGURE= yes -USE_LIBTOOL= yes -USE_TOOLS+= aclocal autoheader autoconf automake gmake gm4 intltool msgfmt pkg-config -USE_LANGUAGES= c c++ +USE_LANGUAGES= c c++ +USE_LIBTOOL= yes +USE_PKGLOCALEDIR= yes +USE_TOOLS+= aclocal autoheader autoconf automake gmake gm4 intltool msgfmt pkg-config +GNU_CONFIGURE= yes +CONFIGURE_ARGS+= --disable-tcpwrap +CONFIGURE_ARGS+= --localstatedir=${VARBASE} +CONFIGURE_ARGS+= --sysconfdir=${PKG_SYSCONFBASEDIR} +CONFIGURE_ENV+= DATADIRNAME=${PKGLOCALEDIR} +PKGCONFIG_OVERRIDE+= libpulse-mainloop-glib.pc.in +PKGCONFIG_OVERRIDE+= libpulse-simple.pc.in +PKGCONFIG_OVERRIDE+= libpulse.pc.in REPLACE_BASH= shell-completion/bash/pulseaudio git-version-gen @@ -33,9 +41,6 @@ CONFIGURE_ARGS.NetBSD+= --disable-default-build-tests CONFIGURE_ENV+= ac_cv_tls=none .endif -CONFIGURE_ENV+= DATADIRNAME=${PKGLOCALEDIR} -USE_PKGLOCALEDIR= yes - # Wrong sys/capability.h assumptions, incompatible implementation: CONFIGURE_ARGS.FreeBSD+= --without-caps @@ -44,10 +49,6 @@ MAKE_ENV+= EGDIR=${EGDIR} MAKE_FLAGS+= bashcompletiondir=${PREFIX}/share/bash-completion/completions -CONFIGURE_ARGS+= --disable-tcpwrap -CONFIGURE_ARGS+= --localstatedir=${VARBASE:Q} -CONFIGURE_ARGS+= --sysconfdir=${PKG_SYSCONFBASEDIR:Q} - # Disable NEON on NetBSD/aarch64 (does not build with pulseaudio 11.1) # use of q0 register in aarch64 is considered not valid .if !empty(PKGSRC_COMPILER:Mclang) && ${OPSYS} == "NetBSD" && ${MACHINE_CPU} == "aarch64" @@ -60,22 +61,31 @@ CONFIGURE_ARGS+= --disable-neon-opt .include "../../devel/libatomic_ops/buildlink3.mk" .endif -# Build module-mmkbd-evdev.so under Linux -.if ${OPSYS} == "Linux" && exists(/usr/include/linux/input.h) -PLIST.evdev= yes -.endif +PLIST_SUBST+= PULSELIBVER=12.0 +PLIST_VARS+= alsa bonjour coreaudio evdev oss sun +# Build module-mmkbd-evdev.so under Linux .if ${OPSYS} == "Linux" +. if exists(/usr/include/linux/input.h) +PLIST.evdev= yes +. endif PLIST.alsa= yes .include "../../audio/alsa-lib/buildlink3.mk" +.elif ${OPSYS} == "SunOS" +USE_LANGUAGES+= c99 +PLIST.sun= yes +. if ${OS_VERSION} == "5.11" +PLIST.oss= yes +. endif +.elif ${OPSYS} == "Darwin" +PLIST.bonjour= yes +PLIST.coreaudio= yes +.else +PLIST.oss= yes .endif .include "options.mk" -PKGCONFIG_OVERRIDE+= libpulse-mainloop-glib.pc.in -PKGCONFIG_OVERRIDE+= libpulse-simple.pc.in -PKGCONFIG_OVERRIDE+= libpulse.pc.in - LIBS.NetBSD+= ${LIBOSSAUDIO} INSTALLATION_DIRS= share/examples/pulse @@ -96,23 +106,6 @@ CONF_FILES+= ${EGDIR}/system.pa ${PKG_SYSCONFDIR}/system.pa CONF_FILES+= ${EGDIR}/pulseaudio-system.conf \ ${PKG_SYSCONFBASE}/dbus-1/system.d/pulseaudio-system.conf -PLIST_SUBST+= PULSELIBVER=12.0 - -PLIST_VARS+= alsa bonjour coreaudio evdev oss sun - -.if ${OPSYS} == "SunOS" -USE_LANGUAGES+= c99 -PLIST.sun= yes -. if ${OS_VERSION} == "5.11" -PLIST.oss= yes -. endif -.elif ${OPSYS} == "Darwin" -PLIST.bonjour= yes -PLIST.coreaudio= yes -.else -PLIST.oss= yes -.endif - PKG_GROUPS= ${PULSE_GROUP} PKG_GROUPS+= ${PULSE_GROUP_REALTIME} PKG_GROUPS+= ${PULSE_GROUP_ACCESS} diff --git a/audio/pulseaudio/PLIST b/audio/pulseaudio/PLIST index 8d3a2043a95..d172c511fe9 100644 --- a/audio/pulseaudio/PLIST +++ b/audio/pulseaudio/PLIST @@ -1,4 +1,4 @@ -@comment $NetBSD: PLIST,v 1.28 2018/07/18 23:35:17 maya Exp $ +@comment $NetBSD: PLIST,v 1.29 2018/07/25 12:15:59 adam Exp $ bin/esdcompat bin/pacat bin/pacmd @@ -75,14 +75,14 @@ lib/pulse-${PULSELIBVER}/modules/libraop.a lib/pulse-${PULSELIBVER}/modules/libraop.so lib/pulse-${PULSELIBVER}/modules/librtp.a lib/pulse-${PULSELIBVER}/modules/librtp.so +lib/pulse-${PULSELIBVER}/modules/module-allow-passthrough.a +lib/pulse-${PULSELIBVER}/modules/module-allow-passthrough.so ${PLIST.alsa}lib/pulse-${PULSELIBVER}/modules/module-alsa-card.a ${PLIST.alsa}lib/pulse-${PULSELIBVER}/modules/module-alsa-card.so ${PLIST.alsa}lib/pulse-${PULSELIBVER}/modules/module-alsa-sink.a ${PLIST.alsa}lib/pulse-${PULSELIBVER}/modules/module-alsa-sink.so ${PLIST.alsa}lib/pulse-${PULSELIBVER}/modules/module-alsa-source.a ${PLIST.alsa}lib/pulse-${PULSELIBVER}/modules/module-alsa-source.so -lib/pulse-${PULSELIBVER}/modules/module-allow-passthrough.a -lib/pulse-${PULSELIBVER}/modules/module-allow-passthrough.so lib/pulse-${PULSELIBVER}/modules/module-always-sink.a lib/pulse-${PULSELIBVER}/modules/module-always-sink.so lib/pulse-${PULSELIBVER}/modules/module-always-source.a @@ -352,8 +352,13 @@ ${PLIST.alsa}share/pulseaudio/alsa-mixer/paths/hdmi-output-4.conf ${PLIST.alsa}share/pulseaudio/alsa-mixer/paths/hdmi-output-5.conf ${PLIST.alsa}share/pulseaudio/alsa-mixer/paths/hdmi-output-6.conf ${PLIST.alsa}share/pulseaudio/alsa-mixer/paths/hdmi-output-7.conf +${PLIST.alsa}share/pulseaudio/alsa-mixer/paths/iec958-stereo-input.conf ${PLIST.alsa}share/pulseaudio/alsa-mixer/paths/iec958-stereo-output.conf +${PLIST.alsa}share/pulseaudio/alsa-mixer/paths/steelseries-arctis-input.conf +${PLIST.alsa}share/pulseaudio/alsa-mixer/paths/steelseries-arctis-output-mono.conf +${PLIST.alsa}share/pulseaudio/alsa-mixer/paths/steelseries-arctis-output-stereo.conf ${PLIST.alsa}share/pulseaudio/alsa-mixer/profile-sets/default.conf +${PLIST.alsa}share/pulseaudio/alsa-mixer/profile-sets/dell-dock-tb16-usb-audio.conf ${PLIST.alsa}share/pulseaudio/alsa-mixer/profile-sets/force-speaker-and-int-mic.conf ${PLIST.alsa}share/pulseaudio/alsa-mixer/profile-sets/force-speaker.conf ${PLIST.alsa}share/pulseaudio/alsa-mixer/profile-sets/kinect-audio.conf @@ -366,11 +371,6 @@ ${PLIST.alsa}share/pulseaudio/alsa-mixer/profile-sets/native-instruments-traktor ${PLIST.alsa}share/pulseaudio/alsa-mixer/profile-sets/native-instruments-traktor-audio6.conf ${PLIST.alsa}share/pulseaudio/alsa-mixer/profile-sets/native-instruments-traktorkontrol-s4.conf ${PLIST.alsa}share/pulseaudio/alsa-mixer/profile-sets/sb-omni-surround-5.1.conf -${PLIST.alsa}share/pulseaudio/alsa-mixer/paths/iec958-stereo-input.conf -${PLIST.alsa}share/pulseaudio/alsa-mixer/paths/steelseries-arctis-input.conf -${PLIST.alsa}share/pulseaudio/alsa-mixer/paths/steelseries-arctis-output-mono.conf -${PLIST.alsa}share/pulseaudio/alsa-mixer/paths/steelseries-arctis-output-stereo.conf -${PLIST.alsa}share/pulseaudio/alsa-mixer/profile-sets/dell-dock-tb16-usb-audio.conf ${PLIST.alsa}share/pulseaudio/alsa-mixer/profile-sets/steelseries-arctis-usb-audio.conf share/vala/vapi/libpulse-mainloop-glib.deps share/vala/vapi/libpulse-mainloop-glib.vapi diff --git a/audio/pulseaudio/distinfo b/audio/pulseaudio/distinfo index 25ab68cdfcb..e3fcad332ba 100644 --- a/audio/pulseaudio/distinfo +++ b/audio/pulseaudio/distinfo @@ -1,14 +1,14 @@ -$NetBSD: distinfo,v 1.66 2018/07/06 14:10:15 ryoon Exp $ +$NetBSD: distinfo,v 1.67 2018/07/25 12:15:59 adam Exp $ -SHA1 (pulseaudio-12.0.tar.xz) = 9b0dcd62ae4c24542e13644e5fac3de5b13d6db7 -RMD160 (pulseaudio-12.0.tar.xz) = 213986308164c1993bb2b471aba8d8b60037b4b6 -SHA512 (pulseaudio-12.0.tar.xz) = e9b02522f1e9cc2cf2e9db3364153fff5bc70561df34bc8e254e373a24c45585c1c722de8b6ebd7cd1814f523cf29b67c6940390a6fcc1ccbdde5aeff48f8d8c -Size (pulseaudio-12.0.tar.xz) = 1657212 bytes -SHA1 (patch-aa) = 212768eaacf1a2a29449665bc6b48ace6f1af9c8 -SHA1 (patch-configure.ac) = a9d2e6e7a6b4d9bbaf2cefdd6e6ea0432d544e4a +SHA1 (pulseaudio-12.2.tar.xz) = 310a6245036a51df6585a7ebfac75b32e073aa88 +RMD160 (pulseaudio-12.2.tar.xz) = 04d389135b61c0b2155ac855dbfe532a5c979323 +SHA512 (pulseaudio-12.2.tar.xz) = 877754c1838b3cb042dbc18a5f1cc3cf313ffcaee7a64703330406d1f86279c34f1107634ac3083b158365e6757fbacf5ec406bc3c5788d291de67b77a561a4e +Size (pulseaudio-12.2.tar.xz) = 1665092 bytes +SHA1 (patch-configure.ac) = a696c9a50e790c6daf200e410600fc65fc4d6389 SHA1 (patch-src_Makefile.am) = 5dc602576f0d01498596cf8d1c3f3c12bfb5830b SHA1 (patch-src_modules_module-detect.c) = 09cce0611e8a8d793c7636e8d2a76e505ac7f0ef SHA1 (patch-src_modules_oss_module-oss.c) = 399ac178ae832619253ce8dd985edbed23db86e7 SHA1 (patch-src_modules_raop_raop-client.h) = 9fb7ae86a6852022f53aee3765777bd136250ffb SHA1 (patch-src_pulsecore_mix__neon.c) = 6f6d33d38024d65045d637d48276e1ba92b81342 SHA1 (patch-src_tests_rtpoll-test.c) = 3584aeda2b6f7eb14af9cb5c665a31d972a306ae +SHA1 (patch-src_utils_padsp.c) = 212768eaacf1a2a29449665bc6b48ace6f1af9c8 diff --git a/audio/pulseaudio/options.mk b/audio/pulseaudio/options.mk index 9d95fd57b27..9f08f5f225e 100644 --- a/audio/pulseaudio/options.mk +++ b/audio/pulseaudio/options.mk @@ -1,14 +1,12 @@ -# $NetBSD: options.mk,v 1.8 2018/07/06 14:10:15 ryoon Exp $ +# $NetBSD: options.mk,v 1.9 2018/07/25 12:15:59 adam Exp $ PKG_OPTIONS_VAR= PKG_OPTIONS.pulseaudio PKG_SUPPORTED_OPTIONS= avahi fftw gsettings x11 PKG_SUGGESTED_OPTIONS= avahi x11 PLIST_VARS+= ${PKG_SUPPORTED_OPTIONS} + .include "../../mk/bsd.options.mk" -### -### avahi -### .if !empty(PKG_OPTIONS:Mavahi) .include "../../net/avahi/buildlink3.mk" PLIST.avahi= yes @@ -16,9 +14,6 @@ PLIST.avahi= yes CONFIGURE_ARGS+= --disable-avahi .endif -### -### gsettings -### .if !empty(PKG_OPTIONS:Mgsettings) PLIST.gsettings= yes CONFIGURE_ARGS+= --enable-gsettings @@ -26,9 +21,6 @@ CONFIGURE_ARGS+= --enable-gsettings CONFIGURE_ARGS+= --disable-gsettings .endif -### -### fftw -### .if !empty(PKG_OPTIONS:Mfftw) CONFIGURE_ARGS+= --with-fftw PLIST.fftw= yes @@ -48,9 +40,6 @@ REPLACE_FILES.pulse_py= src/utils/qpaeq CONFIGURE_ARGS+= --without-fftw .endif -### -### X11 -### .if !empty(PKG_OPTIONS:Mx11) .include "../../x11/libICE/buildlink3.mk" .include "../../x11/libSM/buildlink3.mk" diff --git a/audio/pulseaudio/patches/patch-aa b/audio/pulseaudio/patches/patch-aa deleted file mode 100644 index d0bf3bcca6f..00000000000 --- a/audio/pulseaudio/patches/patch-aa +++ /dev/null @@ -1,142 +0,0 @@ -$NetBSD: patch-aa,v 1.20 2018/07/06 14:10:15 ryoon Exp $ - -ioctl() takes u_long argument on NetBSD. -On NetBSD<6 and 6.99.0-6.99.7, use third parameter in ioctl instead of varargs. -stat() system call has been versioned, use latest version when dlopen()ing. -Try more typical device names. -SOUND_PCM_* is not available on SunOS. - ---- src/utils/padsp.c.orig 2018-05-11 11:43:31.000000000 +0000 -+++ src/utils/padsp.c -@@ -48,6 +48,10 @@ - #include - #endif - -+#ifdef __NetBSD__ -+#include -+#endif -+ - #include - #include - #include -@@ -115,7 +119,11 @@ static pthread_mutex_t func_mutex = PTHR - - static PA_LLIST_HEAD(fd_info, fd_infos) = NULL; - -+#ifdef __NetBSD__ -+static int (*_ioctl)(int, u_long, void *) = NULL; -+#else - static int (*_ioctl)(int, int, void*) = NULL; -+#endif - static int (*_close)(int) = NULL; - static int (*_open)(const char *, int, mode_t) = NULL; - static int (*___open_2)(const char *, int) = NULL; -@@ -143,6 +151,15 @@ static inline fnptr dlsym_fn(void *handl - return (fnptr) (long) dlsym(handle, symbol); - } - -+#ifdef __NetBSD__ -+#define LOAD_IOCTL_FUNC() \ -+do { \ -+ pthread_mutex_lock(&func_mutex); \ -+ if (!_ioctl) \ -+ _ioctl = (int (*)(int, u_long, void*)) dlsym_fn(RTLD_NEXT, "ioctl"); \ -+ pthread_mutex_unlock(&func_mutex); \ -+} while(0) -+#else - #define LOAD_IOCTL_FUNC() \ - do { \ - pthread_mutex_lock(&func_mutex); \ -@@ -150,6 +167,7 @@ do { \ - _ioctl = (int (*)(int, int, void*)) dlsym_fn(RTLD_NEXT, "ioctl"); \ - pthread_mutex_unlock(&func_mutex); \ - } while(0) -+#endif - - #define LOAD_OPEN_FUNC() \ - do { \ -@@ -199,11 +217,21 @@ do { \ - pthread_mutex_unlock(&func_mutex); \ - } while(0) - -+ -+#ifdef __NetBSD__ -+#if (__NetBSD_Version__ < 600000000) -+#define STAT_FUNC "__stat30" -+#else -+#define STAT_FUNC "__stat50" -+#endif -+#else -+#define STAT_FUNC "stat" -+#endif - #define LOAD_STAT_FUNC() \ - do { \ - pthread_mutex_lock(&func_mutex); \ - if (!_stat) \ -- _stat = (int (*)(const char *, struct stat *)) dlsym_fn(RTLD_NEXT, "stat"); \ -+ _stat = (int (*)(const char *, struct stat *)) dlsym_fn(RTLD_NEXT, STAT_FUNC); \ - pthread_mutex_unlock(&func_mutex); \ - } while(0) - -@@ -2295,7 +2323,7 @@ static int dsp_ioctl(fd_info *i, unsigne - break; - } - --#ifdef HAVE_DECL_SOUND_PCM_READ_RATE -+#if HAVE_DECL_SOUND_PCM_READ_RATE - case SOUND_PCM_READ_RATE: - debug(DEBUG_LEVEL_NORMAL, __FILE__": SOUND_PCM_READ_RATE\n"); - -@@ -2305,7 +2333,7 @@ static int dsp_ioctl(fd_info *i, unsigne - break; - #endif - --#ifdef HAVE_DECL_SOUND_PCM_READ_CHANNELS -+#if HAVE_DECL_SOUND_PCM_READ_CHANNELS - case SOUND_PCM_READ_CHANNELS: - debug(DEBUG_LEVEL_NORMAL, __FILE__": SOUND_PCM_READ_CHANNELS\n"); - -@@ -2315,7 +2343,7 @@ static int dsp_ioctl(fd_info *i, unsigne - break; - #endif - --#ifdef HAVE_DECL_SOUND_PCM_READ_BITS -+#if HAVE_DECL_SOUND_PCM_READ_BITS - case SOUND_PCM_READ_BITS: - debug(DEBUG_LEVEL_NORMAL, __FILE__": SOUND_PCM_READ_BITS\n"); - -@@ -2394,21 +2422,33 @@ fail: - return ret; - } - --#ifndef __GLIBC__ -+/* NetBSD < 6 and 6.99.0 - 6.99.6 used a different ioctl() definition */ -+#if defined(__NetBSD__) && (__NetBSD_Version__ < 600000000 || \ -+ (__NetBSD_Version__ > 699000000 && __NetBSD_Version__ < 699000700) ) -+# define OLD_NETBSD_IOCTL_CALL -+#endif -+ -+#if !defined(__GLIBC__) && !defined(__NetBSD__) - int ioctl(int fd, int request, ...) { -+#elif defined(OLD_NETBSD_IOCTL_CALL) -+int ioctl(int fd, u_long request, void *_argp) { - #else - int ioctl(int fd, unsigned long request, ...) { - #endif - fd_info *i; -+#if !defined(OLD_NETBSD_IOCTL_CALL) - va_list args; -+#endif - void *argp; - int r, _errno = 0; - - debug(DEBUG_LEVEL_VERBOSE, __FILE__": ioctl()\n"); - -+#if defined(OLD_NETBSD_IOCTL_CALL) - va_start(args, request); - argp = va_arg(args, void *); - va_end(args); -+#endif - - if (!function_enter()) { - LOAD_IOCTL_FUNC(); diff --git a/audio/pulseaudio/patches/patch-configure.ac b/audio/pulseaudio/patches/patch-configure.ac index 4349362016c..ef70c8b930f 100644 --- a/audio/pulseaudio/patches/patch-configure.ac +++ b/audio/pulseaudio/patches/patch-configure.ac @@ -1,4 +1,4 @@ -$NetBSD: patch-configure.ac,v 1.11 2018/07/06 14:10:15 ryoon Exp $ +$NetBSD: patch-configure.ac,v 1.12 2018/07/25 12:15:59 adam Exp $ * Don't assume sys/capability.h is guaranteed present on Linux. * Fix NetBSD detection for libatomics_ops check. @@ -9,6 +9,7 @@ $NetBSD: patch-configure.ac,v 1.11 2018/07/06 14:10:15 ryoon Exp $ * Avoid hardcoded SDK paths on Darwin. * Check for memfd_create instead of assuming libc does not define it. (Will be included in next release after 11.1) +* On Darwin, do not use macosx-version-min. --- configure.ac.orig 2018-06-18 13:33:47.000000000 +0000 +++ configure.ac @@ -72,3 +73,12 @@ $NetBSD: patch-configure.ac,v 1.11 2018/07/06 14:10:15 ryoon Exp $ #### Mac OSX specific stuff ##### +@@ -1396,8 +1399,6 @@ AC_ARG_WITH(mac-sysroot, + mac_sysroot=$withval) + + if test "x$os_is_darwin" = "x1" ; then +- LDFLAGS="$LDFLAGS -mmacosx-version-min=$mac_version_min" +- CFLAGS="$CFLAGS -mmacosx-version-min=$mac_version_min" + + if test "x$mac_sysroot" != "x" ; then + LDFLAGS="$LDFLAGS -isysroot $mac_sysroot" diff --git a/audio/pulseaudio/patches/patch-src_utils_padsp.c b/audio/pulseaudio/patches/patch-src_utils_padsp.c new file mode 100644 index 00000000000..3d3d1251c1d --- /dev/null +++ b/audio/pulseaudio/patches/patch-src_utils_padsp.c @@ -0,0 +1,142 @@ +$NetBSD: patch-src_utils_padsp.c,v 1.1 2018/07/25 12:15:59 adam Exp $ + +ioctl() takes u_long argument on NetBSD. +On NetBSD<6 and 6.99.0-6.99.7, use third parameter in ioctl instead of varargs. +stat() system call has been versioned, use latest version when dlopen()ing. +Try more typical device names. +SOUND_PCM_* is not available on SunOS. + +--- src/utils/padsp.c.orig 2018-05-11 11:43:31.000000000 +0000 ++++ src/utils/padsp.c +@@ -48,6 +48,10 @@ + #include + #endif + ++#ifdef __NetBSD__ ++#include ++#endif ++ + #include + #include + #include +@@ -115,7 +119,11 @@ static pthread_mutex_t func_mutex = PTHR + + static PA_LLIST_HEAD(fd_info, fd_infos) = NULL; + ++#ifdef __NetBSD__ ++static int (*_ioctl)(int, u_long, void *) = NULL; ++#else + static int (*_ioctl)(int, int, void*) = NULL; ++#endif + static int (*_close)(int) = NULL; + static int (*_open)(const char *, int, mode_t) = NULL; + static int (*___open_2)(const char *, int) = NULL; +@@ -143,6 +151,15 @@ static inline fnptr dlsym_fn(void *handl + return (fnptr) (long) dlsym(handle, symbol); + } + ++#ifdef __NetBSD__ ++#define LOAD_IOCTL_FUNC() \ ++do { \ ++ pthread_mutex_lock(&func_mutex); \ ++ if (!_ioctl) \ ++ _ioctl = (int (*)(int, u_long, void*)) dlsym_fn(RTLD_NEXT, "ioctl"); \ ++ pthread_mutex_unlock(&func_mutex); \ ++} while(0) ++#else + #define LOAD_IOCTL_FUNC() \ + do { \ + pthread_mutex_lock(&func_mutex); \ +@@ -150,6 +167,7 @@ do { \ + _ioctl = (int (*)(int, int, void*)) dlsym_fn(RTLD_NEXT, "ioctl"); \ + pthread_mutex_unlock(&func_mutex); \ + } while(0) ++#endif + + #define LOAD_OPEN_FUNC() \ + do { \ +@@ -199,11 +217,21 @@ do { \ + pthread_mutex_unlock(&func_mutex); \ + } while(0) + ++ ++#ifdef __NetBSD__ ++#if (__NetBSD_Version__ < 600000000) ++#define STAT_FUNC "__stat30" ++#else ++#define STAT_FUNC "__stat50" ++#endif ++#else ++#define STAT_FUNC "stat" ++#endif + #define LOAD_STAT_FUNC() \ + do { \ + pthread_mutex_lock(&func_mutex); \ + if (!_stat) \ +- _stat = (int (*)(const char *, struct stat *)) dlsym_fn(RTLD_NEXT, "stat"); \ ++ _stat = (int (*)(const char *, struct stat *)) dlsym_fn(RTLD_NEXT, STAT_FUNC); \ + pthread_mutex_unlock(&func_mutex); \ + } while(0) + +@@ -2295,7 +2323,7 @@ static int dsp_ioctl(fd_info *i, unsigne + break; + } + +-#ifdef HAVE_DECL_SOUND_PCM_READ_RATE ++#if HAVE_DECL_SOUND_PCM_READ_RATE + case SOUND_PCM_READ_RATE: + debug(DEBUG_LEVEL_NORMAL, __FILE__": SOUND_PCM_READ_RATE\n"); + +@@ -2305,7 +2333,7 @@ static int dsp_ioctl(fd_info *i, unsigne + break; + #endif + +-#ifdef HAVE_DECL_SOUND_PCM_READ_CHANNELS ++#if HAVE_DECL_SOUND_PCM_READ_CHANNELS + case SOUND_PCM_READ_CHANNELS: + debug(DEBUG_LEVEL_NORMAL, __FILE__": SOUND_PCM_READ_CHANNELS\n"); + +@@ -2315,7 +2343,7 @@ static int dsp_ioctl(fd_info *i, unsigne + break; + #endif + +-#ifdef HAVE_DECL_SOUND_PCM_READ_BITS ++#if HAVE_DECL_SOUND_PCM_READ_BITS + case SOUND_PCM_READ_BITS: + debug(DEBUG_LEVEL_NORMAL, __FILE__": SOUND_PCM_READ_BITS\n"); + +@@ -2394,21 +2422,33 @@ fail: + return ret; + } + +-#ifndef __GLIBC__ ++/* NetBSD < 6 and 6.99.0 - 6.99.6 used a different ioctl() definition */ ++#if defined(__NetBSD__) && (__NetBSD_Version__ < 600000000 || \ ++ (__NetBSD_Version__ > 699000000 && __NetBSD_Version__ < 699000700) ) ++# define OLD_NETBSD_IOCTL_CALL ++#endif ++ ++#if !defined(__GLIBC__) && !defined(__NetBSD__) + int ioctl(int fd, int request, ...) { ++#elif defined(OLD_NETBSD_IOCTL_CALL) ++int ioctl(int fd, u_long request, void *_argp) { + #else + int ioctl(int fd, unsigned long request, ...) { + #endif + fd_info *i; ++#if !defined(OLD_NETBSD_IOCTL_CALL) + va_list args; ++#endif + void *argp; + int r, _errno = 0; + + debug(DEBUG_LEVEL_VERBOSE, __FILE__": ioctl()\n"); + ++#if defined(OLD_NETBSD_IOCTL_CALL) + va_start(args, request); + argp = va_arg(args, void *); + va_end(args); ++#endif + + if (!function_enter()) { + LOAD_IOCTL_FUNC(); -- cgit v1.2.3