pkgsrc-Changes archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

CVS commit: pkgsrc/audio/jack



Module Name:    pkgsrc
Committed By:   nia
Date:           Wed Sep  8 19:19:20 UTC 2021

Modified Files:
        pkgsrc/audio/jack: DESCR MESSAGE.NetBSD Makefile PLIST buildlink3.mk
            distinfo
Added Files:
        pkgsrc/audio/jack/patches: patch-common_JackAudioAdapterFactory.cpp
            patch-common_memops.c patch-common_wscript
            patch-example-clients_wscript patch-netbsd_JackAtomic__os.h
            patch-netbsd_JackNetBSDTime.c patch-netbsd_JackPlatformPlug__os.h
            patch-netbsd_sun_JackSunAdapter.cpp
            patch-netbsd_sun_JackSunAdapter.h
            patch-netbsd_sun_JackSunDriver.cpp patch-netbsd_sun_JackSunDriver.h
            patch-posix_JackNetUnixSocket.cpp patch-posix_JackNetUnixSocket.h
            patch-posix_JackPosixSemaphore.cpp patch-posix_JackSocket.cpp
            patch-tests_wscript patch-tools_wscript patch-wscript
Removed Files:
        pkgsrc/audio/jack/files: atomicity.h
        pkgsrc/audio/jack/patches: patch-config_sysdeps_atomicity.h
            patch-config_sysdeps_cycles.h patch-configure
            patch-drivers_coreaudio_Makefile.in
            patch-drivers_netjack_netjack__packet.c
            patch-drivers_oss_oss__driver.c patch-drivers_oss_oss__driver.h
            patch-drivers_sun_sun__driver.c patch-include_engine.h
            patch-jack_control.h patch-jack_types.h patch-jackd_engine.c
            patch-libjack_unlock.c patch-tools_netsource.c
            patch-tools_session__notify.c patch-tools_transport.c

Log Message:
jack: Update to 1.9.19

This switches us to jack2, the latest rewrite of the JACK audio
server, with support for Solaris, Linux, macOS, and NetBSD (support
for NetBSD added by me in a series of patches...)

My primary motivation for this update is to avoid jack1's unpleasant
abuse of unix domain sockets such that it no longer works in NetBSD
9.99.x (see PR kern/56113)


To generate a diff of this commit:
cvs rdiff -u -r1.1.1.1 -r1.2 pkgsrc/audio/jack/DESCR
cvs rdiff -u -r1.2 -r1.3 pkgsrc/audio/jack/MESSAGE.NetBSD
cvs rdiff -u -r1.41 -r1.42 pkgsrc/audio/jack/Makefile
cvs rdiff -u -r1.10 -r1.11 pkgsrc/audio/jack/PLIST
cvs rdiff -u -r1.13 -r1.14 pkgsrc/audio/jack/buildlink3.mk
cvs rdiff -u -r1.22 -r1.23 pkgsrc/audio/jack/distinfo
cvs rdiff -u -r1.1 -r0 pkgsrc/audio/jack/files/atomicity.h
cvs rdiff -u -r0 -r1.1 \
    pkgsrc/audio/jack/patches/patch-common_JackAudioAdapterFactory.cpp \
    pkgsrc/audio/jack/patches/patch-common_memops.c \
    pkgsrc/audio/jack/patches/patch-common_wscript \
    pkgsrc/audio/jack/patches/patch-example-clients_wscript \
    pkgsrc/audio/jack/patches/patch-netbsd_JackAtomic__os.h \
    pkgsrc/audio/jack/patches/patch-netbsd_JackNetBSDTime.c \
    pkgsrc/audio/jack/patches/patch-netbsd_JackPlatformPlug__os.h \
    pkgsrc/audio/jack/patches/patch-netbsd_sun_JackSunAdapter.cpp \
    pkgsrc/audio/jack/patches/patch-netbsd_sun_JackSunAdapter.h \
    pkgsrc/audio/jack/patches/patch-netbsd_sun_JackSunDriver.cpp \
    pkgsrc/audio/jack/patches/patch-netbsd_sun_JackSunDriver.h \
    pkgsrc/audio/jack/patches/patch-posix_JackNetUnixSocket.cpp \
    pkgsrc/audio/jack/patches/patch-posix_JackNetUnixSocket.h \
    pkgsrc/audio/jack/patches/patch-posix_JackPosixSemaphore.cpp \
    pkgsrc/audio/jack/patches/patch-posix_JackSocket.cpp \
    pkgsrc/audio/jack/patches/patch-tests_wscript \
    pkgsrc/audio/jack/patches/patch-tools_wscript \
    pkgsrc/audio/jack/patches/patch-wscript
cvs rdiff -u -r1.1 -r0 \
    pkgsrc/audio/jack/patches/patch-config_sysdeps_atomicity.h \
    pkgsrc/audio/jack/patches/patch-config_sysdeps_cycles.h \
    pkgsrc/audio/jack/patches/patch-configure \
    pkgsrc/audio/jack/patches/patch-drivers_coreaudio_Makefile.in \
    pkgsrc/audio/jack/patches/patch-drivers_oss_oss__driver.c \
    pkgsrc/audio/jack/patches/patch-drivers_oss_oss__driver.h \
    pkgsrc/audio/jack/patches/patch-drivers_sun_sun__driver.c \
    pkgsrc/audio/jack/patches/patch-include_engine.h \
    pkgsrc/audio/jack/patches/patch-jack_control.h \
    pkgsrc/audio/jack/patches/patch-jack_types.h \
    pkgsrc/audio/jack/patches/patch-jackd_engine.c \
    pkgsrc/audio/jack/patches/patch-libjack_unlock.c \
    pkgsrc/audio/jack/patches/patch-tools_session__notify.c \
    pkgsrc/audio/jack/patches/patch-tools_transport.c
cvs rdiff -u -r1.2 -r0 \
    pkgsrc/audio/jack/patches/patch-drivers_netjack_netjack__packet.c \
    pkgsrc/audio/jack/patches/patch-tools_netsource.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: pkgsrc/audio/jack/DESCR
diff -u pkgsrc/audio/jack/DESCR:1.1.1.1 pkgsrc/audio/jack/DESCR:1.2
--- pkgsrc/audio/jack/DESCR:1.1.1.1     Wed Apr 12 20:43:27 2006
+++ pkgsrc/audio/jack/DESCR     Wed Sep  8 19:19:19 2021
@@ -1,6 +1,7 @@
-JACK is a low-latency audio server, written for POSIX conformant
-operating systems such as GNU/Linux and Apple's OS X. It can connect a
-number of different applications to an audio device, as well as allowing
-them to share audio between themselves. Its clients can run in their own
-processes (ie. as normal applications), or can they can run within the
-JACK server (ie. as a "plugin").
+JACK (JACK Audio Connection Kit) provides a basic infrastructure for audio
+applications to communicate with each other and with audio hardware. Through
+JACK, users are enabled to build powerful systems for signal processing and
+music production.
+
+JACK2 aka jackdmp is a C++ version of the JACK low-latency audio server for
+multi-processor machines.

Index: pkgsrc/audio/jack/MESSAGE.NetBSD
diff -u pkgsrc/audio/jack/MESSAGE.NetBSD:1.2 pkgsrc/audio/jack/MESSAGE.NetBSD:1.3
--- pkgsrc/audio/jack/MESSAGE.NetBSD:1.2        Mon Dec  2 11:48:38 2019
+++ pkgsrc/audio/jack/MESSAGE.NetBSD    Wed Sep  8 19:19:19 2021
@@ -1,16 +1,12 @@
 ===========================================================================
-$NetBSD: MESSAGE.NetBSD,v 1.2 2019/12/02 11:48:38 nia Exp $
+$NetBSD: MESSAGE.NetBSD,v 1.3 2021/09/08 19:19:19 nia Exp $
 
-Realtime support is currently problematic.
-You need to pass -r to disable it, e.g:
+To start JACK on NetBSD:
 
-$ jackd -r -d sun
+$ jackd -Sr -d sun
 
 If you have an external USB mic:
 
-$ jackd -r -d sun -P /dev/audio -C /dev/audio1
-
-Note that to use JACK on NetBSD you need procfs mounted.
-This should be done by default.
+$ jackd -Sr -d sun -P /dev/audio -C /dev/audio1 -i 1
 
 ===========================================================================

Index: pkgsrc/audio/jack/Makefile
diff -u pkgsrc/audio/jack/Makefile:1.41 pkgsrc/audio/jack/Makefile:1.42
--- pkgsrc/audio/jack/Makefile:1.41     Mon May 24 19:49:05 2021
+++ pkgsrc/audio/jack/Makefile  Wed Sep  8 19:19:19 2021
@@ -1,127 +1,54 @@
-# $NetBSD: Makefile,v 1.41 2021/05/24 19:49:05 wiz Exp $
+# $NetBSD: Makefile,v 1.42 2021/09/08 19:19:19 nia Exp $
 
-DISTNAME=      jack-audio-connection-kit-0.125.0
-PKGREVISION=   4
-PKGNAME=       ${DISTNAME:S/audio-connection-kit-//}
+DISTNAME=      jack2-1.9.19
+PKGNAME=       ${DISTNAME:S/jack2/jack/1}
 CATEGORIES=    audio
-MASTER_SITES=  http://jackaudio.org/downloads/
+MASTER_SITES=  ${MASTER_SITE_GITHUB:=jackaudio/}
+GITHUB_PROJECT=        jack2
+GITHUB_TAG=    v${PKGVERSION_NOREV}
+
+MAINTAINER=    nia%NetBSD.org@localhost
+HOMEPAGE=      https://jackaudio.org/
+COMMENT=       Low-latency audio server
+LICENSE=       gnu-gpl-v2
 
-MAINTAINER=    pkgsrc-users%NetBSD.org@localhost
-HOMEPAGE=      http://www.jackaudio.org/
-COMMENT=       JACK audio connection kit
-LICENSE=       gnu-gpl-v2 AND gnu-lgpl-v2.1
-
-BUILD_DEFS+=           JACKD_DEFAULT_TMPDIR
-BUILD_DEFS+=           JACKD_PROCFS_PATH
-
-SET_LIBDIR=            yes
-USE_TOOLS+=            pkg-config
-USE_LIBTOOL=           yes
-GNU_CONFIGURE=         yes
-CONFIGURE_ARGS+=       --disable-alsa
-CONFIGURE_ARGS+=       --disable-firewire
-CONFIGURE_ARGS+=       --disable-freebob
-CONFIGURE_ARGS+=       --disable-optimize
-CONFIGURE_ARGS+=       --enable-timestamps
-CONFIGURE_ARGS+=       --enable-resize
-CONFIGURE_ENV+=                HAVE_DOXYGEN=no
-CONFIGURE_ENV+=                ac_cv_header_readline_chardefs_h=yes
-PKGCONFIG_OVERRIDE+=   jack.pc.in
-
-PTHREAD_OPTS+=         require native
-
-CFLAGS.NetBSD+=                -D_NETBSD_SOURCE -lossaudio
-CFLAGS.Linux+=         -D_GNU_SOURCE
-CFLAGS.SunOS+=         -std=c99 -D_XOPEN_SOURCE=600 -D__EXTENSIONS__
+USE_LANGUAGES= c c++
+USE_TOOLS+=    pkg-config bash
 
-JACKD_DEFAULT_TMPDIR?= /tmp
+WAF_ARGS+=     --systemd=no
 
 .include "../../mk/bsd.prefs.mk"
 
-.if !empty(OPSYS:M*BSD) || ${OPSYS} == "DragonFly" || ${OPSYS} == "Darwin"
-CFLAGS+=               -DJACK_HOST_HAS_BSD_POLL
-.endif
-###
-### XXX Is there a way to properly use the emulation framework
-###    for this?
-###
-.if exists(${PREFIX}/emul/linux/proc) && ${OPSYS} != "Linux"
-JACKD_PROCFS_PATH?=    ${PREFIX}/emul/linux/proc
-.else
-JACKD_PROCFS_PATH?=    /proc
+PLIST_VARS+=   alsa
+.if ${OPSYS} == "Linux"
+PLIST.alsa=    yes
 .endif
 
-.if exists(/dev/shm) && ${OPSYS} == "Linux"
-CONFIGURE_ARGS+=       --with-default-tmpdir=/dev/shm
-.else
-CONFIGURE_ARGS+=       --with-default-tmpdir=${JACKD_DEFAULT_TMPDIR:Q}
+PLIST_VARS+=   boomer oss
+.if ${OPSYS} == "SunOS"
+PLIST.boomer=  yes
+PLIST.oss=     yes
 .endif
 
-PLIST_VARS=            coreaudio oss sunaudio
-###
-### XXX        This is untested.  Please file a PR and/or commit a fix should
-###    any problems arise.
-###
-.if ${OPSYS} == "Darwin"
-CONFIGURE_ARGS+=       --enable-coreaudio
-PLIST.coreaudio=       yes
-.else
-CONFIGURE_ARGS+=       --disable-coreaudio
+PLIST_VARS+=   sun
+.if ${OPSYS} == "NetBSD"
+PLIST.sun=     yes
 .endif
 
-.if ${OPSYS} == "NetBSD" || ${OPSYS} == "OpenBSD" || ${OPSYS} == "SunOS" || \
-    exists(/usr/include/sys/audioio.h)
-CONFIGURE_ARGS+=       --enable-sun
-PLIST.sunaudio=                yes
-.else
-CONFIGURE_ARGS+=       --disable-sun
-.endif
+REPLACE_PYTHON+=       waf
+REPLACE_PYTHON+=       tools/jack_control
+REPLACE_BASH+=         svnversion_regenerate.sh
 
-.include "../../mk/oss.buildlink3.mk"
+PYTHON_VERSIONS_INCOMPATIBLE=  27
 
-.if ${OSS_TYPE} != "none" && ${OPSYS} != "NetBSD" && ${OPSYS} != "SunOS"
-CONFIGURE_ARGS+=       --enable-oss
-PLIST.oss=             yes
-MAKE_ENV+=             LIBOSSAUDIO=${LIBOSSAUDIO}
-CFLAGS+=               -DDEVOSSAUDIO=\"${DEVOSSAUDIO:U/dev/dsp}\"
-.else
-CONFIGURE_ARGS+=       --disable-oss
-.endif
+PKGCONFIG_OVERRIDE+=           jack.pc.in
 
-SUBST_CLASSES+=                jacksrc
-SUBST_FILES.jacksrc=   libjack/unlock.c
-SUBST_MESSAGE.jacksrc= Peforming substitutions in JACK sources.
-SUBST_STAGE.jacksrc=   pre-build
-SUBST_VARS.jacksrc=    PREFIX JACKD_PROCFS_PATH X11BASE
-
-.if ${MACHINE_ARCH} == "i386" || ${MACHINE_ARCH} == "x86_64"
-PKG_OPTIONS_VAR=       PKG_OPTIONS.jack
-PKG_SUPPORTED_OPTIONS= simd
-# on 7.99.26/amd64:
-# ./simd.c: In function 'x86_3dnow_add2f':
-# ./simd.c:211:3: error: impossible constraint in 'asm'
-#   asm volatile (
-#PKG_SUGGESTED_OPTIONS=        simd
-
-.  include "../../mk/bsd.options.mk"
-
-.  if !empty(PKG_OPTIONS:Msimd)
-CONFIGURE_ARGS+=       --enable-dynsimd
-.  else
-CONFIGURE_ARGS+=       --disable-dynsimd
-.  endif
+.include "../../lang/python/application.mk"
+.include "../../devel/waf/waf.mk"
+.if ${OPSYS} == "Linux"
+.  include "../../audio/alsa-lib/buildlink3.mk"
 .endif
-
-BDB_ACCEPTED=          db4 db5
-BUILDLINK_TRANSFORM+=  l:db:${BDB_TYPE}
-
-post-extract:
-       ${MKDIR} ${WRKSRC}/config/os/netbsd
-       ${CP} ${FILESDIR}/atomicity.h ${WRKSRC}/config/os/netbsd
-
+.include "../../audio/libopus/buildlink3.mk"
 .include "../../audio/libsamplerate/buildlink3.mk"
-.include "../../mk/bdb.buildlink3.mk"
-.include "../../mk/dlopen.buildlink3.mk"
-.include "../../mk/pthread.buildlink3.mk"
-.include "../../mk/readline.buildlink3.mk"
+.include "../../audio/libsndfile/buildlink3.mk"
 .include "../../mk/bsd.pkg.mk"

Index: pkgsrc/audio/jack/PLIST
diff -u pkgsrc/audio/jack/PLIST:1.10 pkgsrc/audio/jack/PLIST:1.11
--- pkgsrc/audio/jack/PLIST:1.10        Mon Jan  1 22:29:17 2018
+++ pkgsrc/audio/jack/PLIST     Wed Sep  8 19:19:19 2021
@@ -1,34 +1,40 @@
-@comment $NetBSD: PLIST,v 1.10 2018/01/01 22:29:17 rillig Exp $
+@comment $NetBSD: PLIST,v 1.11 2021/09/08 19:19:19 nia Exp $
 bin/jack_alias
 bin/jack_bufsize
 bin/jack_connect
+bin/jack_control
+bin/jack_cpu
+bin/jack_cpu_load
 bin/jack_disconnect
 bin/jack_evmon
 bin/jack_freewheel
-bin/jack_impulse_grabber
 bin/jack_iodelay
 bin/jack_latent_client
 bin/jack_load
-bin/jack_load_test
 bin/jack_lsp
 bin/jack_metro
 bin/jack_midi_dump
+bin/jack_midi_latency_test
 bin/jack_midiseq
 bin/jack_midisine
 bin/jack_monitor_client
-bin/jack_netsource
+bin/jack_multiple_metro
+bin/jack_net_master
+bin/jack_net_slave
 bin/jack_property
 bin/jack_rec
 bin/jack_samplerate
 bin/jack_server_control
 bin/jack_session_notify
 bin/jack_showtime
+bin/jack_simdtests
 bin/jack_simple_client
 bin/jack_simple_session_client
-bin/jack_transport
-bin/jack_transport_client
+bin/jack_test
+bin/jack_thru
 bin/jack_unload
 bin/jack_wait
+bin/jack_zombie
 bin/jackd
 include/jack/control.h
 include/jack/intclient.h
@@ -36,24 +42,39 @@ include/jack/jack.h
 include/jack/jslist.h
 include/jack/metadata.h
 include/jack/midiport.h
+include/jack/net.h
 include/jack/ringbuffer.h
 include/jack/session.h
 include/jack/statistics.h
+include/jack/systemdeps.h
 include/jack/thread.h
 include/jack/transport.h
 include/jack/types.h
 include/jack/uuid.h
 include/jack/weakjack.h
 include/jack/weakmacros.h
-lib/jack/inprocess.la
-lib/jack/intime.la
-${PLIST.coreaudio}lib/jack/jack_coreaudio.la
-lib/jack/jack_dummy.la
-lib/jack/jack_net.la
-${PLIST.oss}lib/jack/jack_oss.la
-${PLIST.sunaudio}lib/jack/jack_sun.la
-lib/libjack.la
-lib/libjackserver.la
+lib/jack/audioadapter.so
+lib/jack/inprocess.so
+${PLIST.alsa}lib/jack/jack_alsa.so
+${PLIST.alsa}lib/jack/jack_alsarawmidi.so
+${PLIST.boomer}lib/jack/jack_boomer.so
+lib/jack/jack_dummy.so
+lib/jack/jack_loopback.so
+lib/jack/jack_net.so
+lib/jack/jack_netone.so
+${PLIST.oss}lib/jack/jack_oss.so
+lib/jack/jack_proxy.so
+${PLIST.sun}lib/jack/jack_sun.so
+lib/jack/netadapter.so
+lib/jack/netmanager.so
+lib/jack/profiler.so
+lib/libjack.so
+lib/libjack.so.0
+lib/libjack.so.0.1.0
+lib/libjacknet.so
+lib/libjacknet.so.0
+lib/libjacknet.so.0.1.0
+lib/libjackserver.so
+lib/libjackserver.so.0
+lib/libjackserver.so.0.1.0
 lib/pkgconfig/jack.pc
-man/man1/jackd.1
-man/man1/jackstart.1

Index: pkgsrc/audio/jack/buildlink3.mk
diff -u pkgsrc/audio/jack/buildlink3.mk:1.13 pkgsrc/audio/jack/buildlink3.mk:1.14
--- pkgsrc/audio/jack/buildlink3.mk:1.13        Tue Aug 18 17:57:24 2020
+++ pkgsrc/audio/jack/buildlink3.mk     Wed Sep  8 19:19:19 2021
@@ -1,21 +1,21 @@
-# $NetBSD: buildlink3.mk,v 1.13 2020/08/18 17:57:24 leot Exp $
+# $NetBSD: buildlink3.mk,v 1.14 2021/09/08 19:19:19 nia Exp $
 
 BUILDLINK_TREE+=       jack
 
 .if !defined(JACK_BUILDLINK3_MK)
 JACK_BUILDLINK3_MK:=
 
-BUILDLINK_API_DEPENDS.jack+=   jack>=0.121.3
-BUILDLINK_ABI_DEPENDS.jack?=   jack>=0.125.0nb3
+BUILDLINK_API_DEPENDS.jack+=   jack>=1.9.19
+BUILDLINK_ABI_DEPENDS.jack?=   jack>=1.9.19
 BUILDLINK_PKGSRCDIR.jack?=     ../../audio/jack
 
-BDB_ACCEPTED=  db4 db5
-
+.include "../../mk/bsd.fast.prefs.mk"
+.if ${OPSYS} == "Linux"
+.  include "../../audio/alsa-lib/buildlink3.mk"
+.endif
+.include "../../audio/libopus/buildlink3.mk"
 .include "../../audio/libsamplerate/buildlink3.mk"
-.include "../../mk/bdb.buildlink3.mk"
-# for DLOPEN_REQUIRE_PTHREADS
-.include "../../mk/dlopen.buildlink3.mk"
-.include "../../mk/pthread.buildlink3.mk"
+.include "../../audio/libsndfile/buildlink3.mk"
 .endif # JACK_BUILDLINK3_MK
 
 BUILDLINK_TREE+=       -jack

Index: pkgsrc/audio/jack/distinfo
diff -u pkgsrc/audio/jack/distinfo:1.22 pkgsrc/audio/jack/distinfo:1.23
--- pkgsrc/audio/jack/distinfo:1.22     Mon Dec  2 11:46:08 2019
+++ pkgsrc/audio/jack/distinfo  Wed Sep  8 19:19:19 2021
@@ -1,22 +1,24 @@
-$NetBSD: distinfo,v 1.22 2019/12/02 11:46:08 nia Exp $
+$NetBSD: distinfo,v 1.23 2021/09/08 19:19:19 nia Exp $
 
-SHA1 (jack-audio-connection-kit-0.125.0.tar.gz) = 6b7516b442878ffd1ca875310084b33d0edee400
-RMD160 (jack-audio-connection-kit-0.125.0.tar.gz) = 25f1baa1d8f03f0bbfc0b48c300b63d89d4e881b
-SHA512 (jack-audio-connection-kit-0.125.0.tar.gz) = acdac0588c8a6b79763177677885b6e7bfa8ee3cd9556b33bfe09512bc1191414bb4f97eed62c3c71567b13b4eb69d95ec6b438e5a9d2e22a956c073d500c46f
-Size (jack-audio-connection-kit-0.125.0.tar.gz) = 1217977 bytes
-SHA1 (patch-config_sysdeps_atomicity.h) = f2346262d7590491f005af1c450f4436ec60c58e
-SHA1 (patch-config_sysdeps_cycles.h) = cbaefbefd0758625210c94bcba008b22c2c3a9d4
-SHA1 (patch-configure) = 79abcf4d7514cb4e66e3246fcd897f82c6d75e78
-SHA1 (patch-drivers_coreaudio_Makefile.in) = 13f5e5914ae0304c93dca54518fecb19f5ecdec5
-SHA1 (patch-drivers_netjack_netjack__packet.c) = eb70ec5644e960e0cf0258a15d763be31c11bb02
-SHA1 (patch-drivers_oss_oss__driver.c) = 302f20e82abde4a5b1678d2c3e9cbc8a63fad5ad
-SHA1 (patch-drivers_oss_oss__driver.h) = f23595db3fe80cae36ce222d89cdfbc37916e325
-SHA1 (patch-drivers_sun_sun__driver.c) = 0842e34e6190b8877ab7ac3d4d764a0de4cbfca8
-SHA1 (patch-include_engine.h) = c58651bccc910131ffc9b263a75fa732a7a2b168
-SHA1 (patch-jack_control.h) = 8d6f07fd226b68cacf170501f557503cd674249a
-SHA1 (patch-jack_types.h) = a58fcdafab7e014760287d763c944c8a77281f7f
-SHA1 (patch-jackd_engine.c) = 703242e74bb6d0cae1274b5e4f2c477a689432d9
-SHA1 (patch-libjack_unlock.c) = 4e346eb5dc2bce74968b894158cb3871d5076149
-SHA1 (patch-tools_netsource.c) = 9eb526fbcb020ce8262883e685f57b627a7621cb
-SHA1 (patch-tools_session__notify.c) = 6ab077be462993a054289803ffc3e8a6654c533e
-SHA1 (patch-tools_transport.c) = 2a40f3a51a088e62352d7cdcc27eb41f3064ae7e
+SHA1 (jack2-1.9.19.tar.gz) = 3182304c0a3ecd911775fb46088f0df79ee9015f
+RMD160 (jack2-1.9.19.tar.gz) = da6ed4db02dfc856c477d76a73fe22157b6f7df8
+SHA512 (jack2-1.9.19.tar.gz) = d8d5fe17e2984959546af3c53f044aa4648860e19ff8ffd54452e87fa6cdfd111f825c57e3df17cb8ed95de8392b6f354b12ded41e3e021a37f07b99a89ba18d
+Size (jack2-1.9.19.tar.gz) = 988780 bytes
+SHA1 (patch-common_JackAudioAdapterFactory.cpp) = 8292a8c88c673136f52a007133278f9b4403839c
+SHA1 (patch-common_memops.c) = 468476c6067595524f492d37f3b761af48e78585
+SHA1 (patch-common_wscript) = a86ba367fcb4892b3a34f395840ecbd1c5358005
+SHA1 (patch-example-clients_wscript) = 9db0899e797acbc416bfd9e6aba50c70bd5ff0ab
+SHA1 (patch-netbsd_JackAtomic__os.h) = cd9cc4bf9913b3dedfbb8a2ea34077277e17f85d
+SHA1 (patch-netbsd_JackNetBSDTime.c) = 7cc2504bbd452b703dd062ac5d35f68ffe7e3b0a
+SHA1 (patch-netbsd_JackPlatformPlug__os.h) = f17b0daf4d8a4ef1001b35e6ea1411cfb1b981c2
+SHA1 (patch-netbsd_sun_JackSunAdapter.cpp) = e6c02653840ad02fdee9168796d129504ca29f92
+SHA1 (patch-netbsd_sun_JackSunAdapter.h) = 740b36c69d02742eceeb724ba18796664fb1bc2d
+SHA1 (patch-netbsd_sun_JackSunDriver.cpp) = 43a7126b68076f45292df67f59239c9febf014ff
+SHA1 (patch-netbsd_sun_JackSunDriver.h) = 9da5fbec2216081876174057f831da4c54e3029e
+SHA1 (patch-posix_JackNetUnixSocket.cpp) = 562242daf7c0f296bfcd03f468518aaf18d995d9
+SHA1 (patch-posix_JackNetUnixSocket.h) = ce9a9255dc0dd423562b94b0fcc1012c8ba3a37e
+SHA1 (patch-posix_JackPosixSemaphore.cpp) = 59425ada11a5cab83159691ae10a23c0d36750ef
+SHA1 (patch-posix_JackSocket.cpp) = 88ae18c3d2cc31a43355ff9b0c78ab13b83bd314
+SHA1 (patch-tests_wscript) = e0bf616175a116df489808cda8cb8c70890d4da0
+SHA1 (patch-tools_wscript) = c990639f5c1a998dd02d12eb345e78b0a91a1c6f
+SHA1 (patch-wscript) = 6514e2e7d10f096deb99effa35974e9253599f74

Added files:

Index: pkgsrc/audio/jack/patches/patch-common_JackAudioAdapterFactory.cpp
diff -u /dev/null pkgsrc/audio/jack/patches/patch-common_JackAudioAdapterFactory.cpp:1.1
--- /dev/null   Wed Sep  8 19:19:20 2021
+++ pkgsrc/audio/jack/patches/patch-common_JackAudioAdapterFactory.cpp  Wed Sep  8 19:19:20 2021
@@ -0,0 +1,18 @@
+$NetBSD: patch-common_JackAudioAdapterFactory.cpp,v 1.1 2021/09/08 19:19:20 nia Exp $
+
+Add NetBSD support.
+
+--- common/JackAudioAdapterFactory.cpp.orig    2021-07-15 06:18:26.000000000 +0000
++++ common/JackAudioAdapterFactory.cpp
+@@ -35,6 +35,11 @@ Foundation, Inc., 675 Mass Ave, Cambridg
+ #define JackPlatformAdapter JackAlsaAdapter
+ #endif
+ 
++#ifdef __NetBSD__
++#include "JackSunAdapter.h"
++#define JackPlatformAdapter JackSunAdapter
++#endif
++
+ #if defined(__sun__) || defined(sun)
+ #include "JackOSSAdapter.h"
+ #define JackPlatformAdapter JackOSSAdapter
Index: pkgsrc/audio/jack/patches/patch-common_memops.c
diff -u /dev/null pkgsrc/audio/jack/patches/patch-common_memops.c:1.1
--- /dev/null   Wed Sep  8 19:19:20 2021
+++ pkgsrc/audio/jack/patches/patch-common_memops.c     Wed Sep  8 19:19:20 2021
@@ -0,0 +1,20 @@
+$NetBSD: patch-common_memops.c,v 1.1 2021/09/08 19:19:20 nia Exp $
+
+Add NetBSD support.
+
+--- common/memops.c.orig       2021-07-15 06:18:26.000000000 +0000
++++ common/memops.c
+@@ -35,6 +35,13 @@
+ #endif
+ #include "memops.h"
+ 
++#ifdef __NetBSD__
++#include <sys/endian.h>
++#define __BYTE_ORDER BYTE_ORDER
++#define __LITTLE_ENDIAN LITTLE_ENDIAN
++#define __BIG_ENDIAN BIG_ENDIAN
++#endif
++
+ #if defined (__SSE2__) && !defined (__sun__)
+ #include <emmintrin.h>
+ #ifdef __SSE4_1__
Index: pkgsrc/audio/jack/patches/patch-common_wscript
diff -u /dev/null pkgsrc/audio/jack/patches/patch-common_wscript:1.1
--- /dev/null   Wed Sep  8 19:19:20 2021
+++ pkgsrc/audio/jack/patches/patch-common_wscript      Wed Sep  8 19:19:20 2021
@@ -0,0 +1,117 @@
+$NetBSD: patch-common_wscript,v 1.1 2021/09/08 19:19:20 nia Exp $
+
+Add NetBSD support.
+
+--- common/wscript.orig        2021-07-15 06:18:26.000000000 +0000
++++ common/wscript
+@@ -28,6 +28,8 @@ def create_jack_process_obj(bld, target,
+         env_includes = ['../macosx', '../posix', '../macosx/coreaudio']
+     if bld.env['IS_LINUX']:
+         env_includes = ['../linux', '../posix', '../linux/alsa']
++    if bld.env['IS_NETBSD']:
++        env_includes = ['../netbsd', '../posix', '../netbsd/sun']
+     if bld.env['IS_SUN']:
+         env_includes = ['../solaris', '../posix', '../solaris/oss']
+     if bld.env['IS_WINDOWS']:
+@@ -36,7 +38,7 @@ def create_jack_process_obj(bld, target,
+     process.name     = target
+     process.target   = target
+     process.source   = sources
+-    if bld.env['IS_LINUX'] or bld.env['IS_MACOSX']:
++    if bld.env['IS_LINUX'] or bld.env['IS_NETBSD'] or bld.env['IS_MACOSX']:
+         process.env.append_value('CPPFLAGS', '-fvisibility=hidden')
+     process.install_path = '${ADDON_DIR}/'
+     process.use = [uselib.name]
+@@ -92,6 +94,21 @@ def build(bld):
+         uselib.append('RT')
+         uselib.append('DL')
+ 
++    if bld.env['IS_NETBSD']:
++        common_libsources += [
++            'JackDebugClient.cpp',
++            'timestamps.c',
++            'promiscuous.c',
++           '../posix/JackPosixThread.cpp',
++           '../posix/JackPosixSemaphore.cpp',
++           '../posix/JackPosixProcessSync.cpp',
++           '../posix/JackPosixMutex.cpp',
++           '../posix/JackSocket.cpp',
++           '../netbsd/JackNetBSDTime.c',
++           ]
++        includes = ['../netbsd', '../posix'] + includes
++        uselib.append('RT')
++
+     if bld.env['IS_SUN']:
+         common_libsources += [
+             'JackDebugClient.cpp',
+@@ -176,6 +193,12 @@ def build(bld):
+             '../posix/JackPosixServerLaunch.cpp',
+             ]
+ 
++    if bld.env['IS_NETBSD']:
++        clientlib.source += [
++            '../posix/JackSocketClientChannel.cpp',
++            '../posix/JackPosixServerLaunch.cpp',
++            ]
++
+     if bld.env['IS_SUN']:
+         clientlib.source += [
+             '../posix/JackSocketClientChannel.cpp',
+@@ -205,6 +228,9 @@ def build(bld):
+     if bld.env['IS_LINUX']:
+         clientlib.env.append_value('CPPFLAGS', '-fvisibility=hidden')
+ 
++    if bld.env['IS_NETBSD']:
++        clientlib.env.append_value('CPPFLAGS', '-fvisibility=hidden')
++
+     if bld.env['IS_MACOSX']:
+         clientlib.env.append_value('CPPFLAGS', '-fvisibility=hidden')
+         clientlib.env.append_value('LINKFLAGS', '-single_module')
+@@ -281,6 +307,14 @@ def build(bld):
+             '../posix/JackNetUnixSocket.cpp',
+             ]
+ 
++    if bld.env['IS_NETBSD']:
++        serverlib.source += [
++            '../posix/JackSocketServerChannel.cpp',
++            '../posix/JackSocketNotifyChannel.cpp',
++            '../posix/JackSocketServerNotifyChannel.cpp',
++            '../posix/JackNetUnixSocket.cpp',
++            ]
++
+     if bld.env['IS_SUN']:
+         serverlib.source += [
+             '../posix/JackSocketServerChannel.cpp',
+@@ -316,6 +350,9 @@ def build(bld):
+     if bld.env['IS_LINUX']:
+         serverlib.env.append_value('CPPFLAGS', '-fvisibility=hidden')
+ 
++    if bld.env['IS_NETBSD']:
++        serverlib.env.append_value('CPPFLAGS', '-fvisibility=hidden')
++
+     if bld.env['IS_MACOSX']:
+         serverlib.env.append_value('CPPFLAGS', '-fvisibility=hidden')
+         serverlib.env.append_value('LINKFLAGS', '-single_module')
+@@ -360,6 +397,10 @@ def build(bld):
+             netlib.source += ['../posix/JackNetUnixSocket.cpp','../posix/JackPosixThread.cpp', '../posix/JackPosixMutex.cpp', '../linux/JackLinuxTime.c']
+             netlib.env.append_value('CPPFLAGS', '-fvisibility=hidden')
+ 
++        if bld.env['IS_NETBSD']:
++            netlib.source += ['../posix/JackNetUnixSocket.cpp','../posix/JackPosixThread.cpp', '../posix/JackPosixMutex.cpp', '../netbsd/JackNetBSDTime.c']
++            netlib.env.append_value('CPPFLAGS', '-fvisibility=hidden')
++
+         if bld.env['IS_SUN']:
+             netlib.source += ['../posix/JackNetUnixSocket.cpp','../posix/JackPosixThread.cpp', '../posix/JackPosixMutex.cpp', '../solaris/JackSolarisTime.c']
+             netlib.env.append_value('CPPFLAGS', '-fvisibility=hidden')
+@@ -422,6 +463,11 @@ def build(bld):
+          process = create_jack_process_obj(bld, 'audioadapter', audio_adapter_sources, serverlib)
+          process.use += ['ALSA', 'SAMPLERATE']
+ 
++    if bld.env['BUILD_ADAPTER'] and bld.env['IS_NETBSD']:
++         audio_adapter_sources += ['../netbsd/sun/JackSunAdapter.cpp']
++         process = create_jack_process_obj(bld, 'audioadapter', audio_adapter_sources, serverlib)
++         process.use += 'SAMPLERATE'
++
+     if bld.env['BUILD_ADAPTER'] and bld.env['IS_SUN']:
+          audio_adapter_sources += ['../solaris/oss/JackOSSAdapter.cpp', 'memops.c']
+          process = create_jack_process_obj(bld, 'audioadapter', audio_adapter_sources, serverlib)
Index: pkgsrc/audio/jack/patches/patch-example-clients_wscript
diff -u /dev/null pkgsrc/audio/jack/patches/patch-example-clients_wscript:1.1
--- /dev/null   Wed Sep  8 19:19:20 2021
+++ pkgsrc/audio/jack/patches/patch-example-clients_wscript     Wed Sep  8 19:19:20 2021
@@ -0,0 +1,33 @@
+$NetBSD: patch-example-clients_wscript,v 1.1 2021/09/08 19:19:20 nia Exp $
+
+Add NetBSD support.
+
+--- example-clients/wscript.orig       2021-07-15 06:18:26.000000000 +0000
++++ example-clients/wscript
+@@ -33,6 +33,8 @@ def build(bld):
+         os_incdir = ['../macosx', '../posix']
+     if bld.env['IS_SUN']:
+         os_incdir = ['../solaris', '../posix']
++    if bld.env['IS_NETBSD']:
++        os_incdir = ['../netbsd', '../posix']
+     if bld.env['IS_WINDOWS']:
+         os_incdir = ['../windows']
+     for example_program, example_program_source in list(example_programs.items()):
+@@ -58,6 +60,8 @@ def build(bld):
+         prog.use = use
+         if bld.env['IS_LINUX']:
+             prog.use += ['RT', 'M']
++        if bld.env['IS_NETBSD']:
++            prog.use += ['RT', 'M']
+         if bld.env['IS_SUN']:
+             prog.use += ['M']
+         if bld.env['IS_WINDOWS'] and bld.env['BUILD_STATIC']:
+@@ -76,6 +80,8 @@ def build(bld):
+             prog.use += ['SNDFILE']
+         if bld.env['IS_LINUX']:
+             prog.use += ['RT', 'SNDFILE']
++        if bld.env['IS_NETBSD']:
++            prog.use += ['RT', 'SNDFILE']
+         if bld.env['IS_SUN']:
+             prog.use += ['RT', 'SNDFILE']
+         if bld.env['IS_WINDOWS']:
Index: pkgsrc/audio/jack/patches/patch-netbsd_JackAtomic__os.h
diff -u /dev/null pkgsrc/audio/jack/patches/patch-netbsd_JackAtomic__os.h:1.1
--- /dev/null   Wed Sep  8 19:19:20 2021
+++ pkgsrc/audio/jack/patches/patch-netbsd_JackAtomic__os.h     Wed Sep  8 19:19:20 2021
@@ -0,0 +1,39 @@
+$NetBSD: patch-netbsd_JackAtomic__os.h,v 1.1 2021/09/08 19:19:20 nia Exp $
+
+Add NetBSD support.
+
+--- netbsd/JackAtomic_os.h.orig        2021-09-08 13:51:19.683563214 +0000
++++ netbsd/JackAtomic_os.h
+@@ -0,0 +1,32 @@
++/*
++Copyright (C) 2004-2008 Grame
++
++This program is free software; you can redistribute it and/or modify
++it under the terms of the GNU Lesser General Public License as published by
++the Free Software Foundation; either version 2.1 of the License, or
++(at your option) any later version.
++
++This program is distributed in the hope that it will be useful,
++but WITHOUT ANY WARRANTY; without even the implied warranty of
++MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++GNU Lesser General Public License for more details.
++
++You should have received a copy of the GNU Lesser General Public License
++along with this program; if not, write to the Free Software
++Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++
++*/
++
++#ifndef __JackAtomic_netbsd__
++#define __JackAtomic_netbsd__
++
++#include "JackTypes.h"
++#include <atomic.h>
++
++static inline char CAS(volatile UInt32 value, UInt32 newvalue, volatile void* addr)
++{
++     return (atomic_cas_32((uint32_t*)addr, value, newvalue) == value);
++}
++
++#endif
++
Index: pkgsrc/audio/jack/patches/patch-netbsd_JackNetBSDTime.c
diff -u /dev/null pkgsrc/audio/jack/patches/patch-netbsd_JackNetBSDTime.c:1.1
--- /dev/null   Wed Sep  8 19:19:20 2021
+++ pkgsrc/audio/jack/patches/patch-netbsd_JackNetBSDTime.c     Wed Sep  8 19:19:20 2021
@@ -0,0 +1,97 @@
+$NetBSD: patch-netbsd_JackNetBSDTime.c,v 1.1 2021/09/08 19:19:20 nia Exp $
+
+Add NetBSD support.
+
+--- netbsd/JackNetBSDTime.c.orig       2021-09-08 13:51:19.683998596 +0000
++++ netbsd/JackNetBSDTime.c
+@@ -0,0 +1,90 @@
++/*
++Copyright (C) 2001-2003 Paul Davis
++Copyright (C) 2005 Jussi Laako
++Copyright (C) 2004-2008 Grame
++Copyright (C) 2018 Greg V
++
++This program is free software; you can redistribute it and/or modify
++it under the terms of the GNU Lesser General Public License as published by
++the Free Software Foundation; either version 2.1 of the License, or
++(at your option) any later version.
++
++This program is distributed in the hope that it will be useful,
++but WITHOUT ANY WARRANTY; without even the implied warranty of
++MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++GNU Lesser General Public License for more details.
++
++You should have received a copy of the GNU Lesser General Public License
++along with this program; if not, write to the Free Software
++Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++
++*/
++
++#include "JackConstants.h"
++#include "JackTime.h"
++#include "JackTypes.h"
++#include "JackError.h"
++
++#include <time.h>
++#include <unistd.h>
++
++jack_time_t (*_jack_get_microseconds)(void) = 0;
++
++static jack_time_t jack_get_microseconds_from_system (void)
++{
++      jack_time_t jackTime;
++      struct timespec time;
++
++      clock_gettime(CLOCK_MONOTONIC, &time);
++      jackTime = (jack_time_t) time.tv_sec * 1e6 +
++              (jack_time_t) time.tv_nsec / 1e3;
++      return jackTime;
++}
++
++
++SERVER_EXPORT void JackSleep(long usec)
++{
++      usleep(usec);
++}
++
++SERVER_EXPORT void InitTime()
++{
++      /* nothing to do on a generic system - we use the system clock */
++}
++
++SERVER_EXPORT void EndTime()
++{}
++
++void SetClockSource(jack_timer_type_t source)
++{
++    jack_log("Clock source : %s", ClockSourceName(source));
++
++      switch (source)
++      {
++      case JACK_TIMER_SYSTEM_CLOCK:
++          default:
++          _jack_get_microseconds = jack_get_microseconds_from_system;
++          break;
++      }
++}
++
++const char* ClockSourceName(jack_timer_type_t source)
++{
++      switch (source) {
++      case JACK_TIMER_SYSTEM_CLOCK:
++          return "system clock via clock_gettime";
++      }
++
++      return "unknown";
++}
++
++SERVER_EXPORT jack_time_t GetMicroSeconds()
++{
++      return _jack_get_microseconds();
++}
++
++SERVER_EXPORT jack_time_t jack_get_microseconds()
++{
++      return _jack_get_microseconds();
++}
++
Index: pkgsrc/audio/jack/patches/patch-netbsd_JackPlatformPlug__os.h
diff -u /dev/null pkgsrc/audio/jack/patches/patch-netbsd_JackPlatformPlug__os.h:1.1
--- /dev/null   Wed Sep  8 19:19:20 2021
+++ pkgsrc/audio/jack/patches/patch-netbsd_JackPlatformPlug__os.h       Wed Sep  8 19:19:20 2021
@@ -0,0 +1,91 @@
+$NetBSD: patch-netbsd_JackPlatformPlug__os.h,v 1.1 2021/09/08 19:19:20 nia Exp $
+
+Add NetBSD support.
+
+--- netbsd/JackPlatformPlug_os.h.orig  2021-09-08 13:51:19.684677877 +0000
++++ netbsd/JackPlatformPlug_os.h
+@@ -0,0 +1,84 @@
++/*
++Copyright (C) 2004-2008 Grame
++
++This program is free software; you can redistribute it and/or modify
++it under the terms of the GNU Lesser General Public License as published by
++the Free Software Foundation; either version 2.1 of the License, or
++(at your option) any later version.
++
++This program is distributed in the hope that it will be useful,
++but WITHOUT ANY WARRANTY; without even the implied warranty of
++MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++GNU Lesser General Public License for more details.
++
++You should have received a copy of the GNU Lesser General Public License
++along with this program; if not, write to the Free Software 
++Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
++
++*/
++
++#ifndef __JackPlatformPlug_netbsd__
++#define __JackPlatformPlug_netbsd__
++
++#define jack_server_dir "/tmp"
++#define jack_client_dir "/tmp"
++#define JACK_DEFAULT_DRIVER "sun"
++
++namespace Jack
++{
++    struct JackRequest;
++      struct JackResult;
++    
++    class JackPosixMutex;
++      class JackPosixThread;
++      class JackPosixSemaphore;
++
++      class JackSocketServerChannel;
++      class JackSocketClientChannel;
++      class JackSocketServerNotifyChannel;
++      class JackSocketNotifyChannel;
++      class JackClientSocket;
++      class JackNetUnixSocket;
++}
++
++/* __JackPlatformMutex__ */
++#include "JackPosixMutex.h"
++namespace Jack {typedef JackPosixMutex JackMutex; }
++
++/* __JackPlatformThread__ */
++#include "JackPosixThread.h"
++namespace Jack { typedef JackPosixThread JackThread; }
++
++/* __JackPlatformSynchro__  client activation */
++#include "JackPosixSemaphore.h"
++namespace Jack { typedef JackPosixSemaphore JackSynchro; }
++
++/* __JackPlatformChannelTransaction__ */
++#include "JackSocket.h"
++namespace Jack { typedef JackClientSocket JackChannelTransaction; }
++
++/* __JackPlatformProcessSync__ */
++#include "JackPosixProcessSync.h"
++namespace Jack { typedef JackPosixProcessSync JackProcessSync; }
++
++/* __JackPlatformServerChannel__ */ 
++#include "JackSocketServerChannel.h"
++namespace Jack { typedef JackSocketServerChannel JackServerChannel; }
++
++/* __JackPlatformClientChannel__ */
++#include "JackSocketClientChannel.h"
++namespace Jack { typedef JackSocketClientChannel JackClientChannel; }
++
++/* __JackPlatformServerNotifyChannel__ */
++#include "JackSocketServerNotifyChannel.h"
++namespace Jack { typedef JackSocketServerNotifyChannel JackServerNotifyChannel; }
++
++/* __JackPlatformNotifyChannel__ */
++#include "JackSocketNotifyChannel.h"
++namespace Jack { typedef JackSocketNotifyChannel JackNotifyChannel; }
++
++/* __JackPlatformNetSocket__ */
++#include "JackNetUnixSocket.h"
++namespace Jack { typedef JackNetUnixSocket JackNetSocket; }
++
++#endif
Index: pkgsrc/audio/jack/patches/patch-netbsd_sun_JackSunAdapter.cpp
diff -u /dev/null pkgsrc/audio/jack/patches/patch-netbsd_sun_JackSunAdapter.cpp:1.1
--- /dev/null   Wed Sep  8 19:19:20 2021
+++ pkgsrc/audio/jack/patches/patch-netbsd_sun_JackSunAdapter.cpp       Wed Sep  8 19:19:20 2021
@@ -0,0 +1,485 @@
+$NetBSD: patch-netbsd_sun_JackSunAdapter.cpp,v 1.1 2021/09/08 19:19:20 nia Exp $
+
+Add NetBSD support.
+
+--- netbsd/sun/JackSunAdapter.cpp.orig 2021-09-08 13:51:19.685213690 +0000
++++ netbsd/sun/JackSunAdapter.cpp
+@@ -0,0 +1,478 @@
++/*
++Copyright (C) 2008 Grame & RTL 2008
++
++This program is free software; you can redistribute it and/or modify
++it under the terms of the GNU General Public License as published by
++the Free Software Foundation; either version 2 of the License, or
++(at your option) any later version.
++
++This program is distributed in the hope that it will be useful,
++but WITHOUT ANY WARRANTY; without even the implied warranty of
++MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++GNU General Public License for more details.
++
++You should have received a copy of the GNU General Public License
++along with this program; if not, write to the Free Software
++Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
++
++*/
++
++#include "JackSunAdapter.h"
++#include "JackServerGlobals.h"
++#include "JackEngineControl.h"
++#include "memops.h"
++
++#include <sys/ioctl.h>
++#include <sys/audioio.h>
++#include <fcntl.h>
++#include <iostream>
++#include <assert.h>
++
++namespace Jack
++{
++
++inline int int2pow2(int x)    { int r = 0; while ((1 << r) < x) r++; return r; }
++
++static inline void CopyAndConvertIn(jack_sample_t *dst, void *src, size_t nframes, int channel, int chcount, int bits)
++{
++#if 0
++    switch (bits) {
++
++              case 16: {
++                  signed short *s16src = (signed short*)src;
++            s16src += channel;
++            sample_move_dS_s16(dst, (char*)s16src, nframes, chcount<<1);
++                      break;
++        }
++              case 24: {
++                      signed int *s32src = (signed int*)src;
++            s32src += channel;
++            sample_move_dS_s24(dst, (char*)s32src, nframes, chcount<<2);
++                      break;
++        }
++              case 32: {
++                      signed int *s32src = (signed int*)src;
++            s32src += channel;
++            sample_move_dS_s32u24(dst, (char*)s32src, nframes, chcount<<2);
++                      break;
++        }
++      }
++#endif
++}
++
++static inline void CopyAndConvertOut(void *dst, jack_sample_t *src, size_t nframes, int channel, int chcount, int bits)
++{
++#if 0
++      switch (bits) {
++
++              case 16: {
++                      signed short *s16dst = (signed short*)dst;
++            s16dst += channel;
++            sample_move_d16_sS((char*)s16dst, src, nframes, chcount<<1, NULL); // No dithering for now...
++                      break;
++        }
++              case 24: {
++                      signed int *s32dst = (signed int*)dst;
++            s32dst += channel;
++            sample_move_d24_sS((char*)s32dst, src, nframes, chcount<<2, NULL); // No dithering for now...
++                      break;
++        }
++              case 32: {
++            signed int *s32dst = (signed int*)dst;
++            s32dst += channel;
++            sample_move_d32u24_sS((char*)s32dst, src, nframes, chcount<<2, NULL);
++                      break;
++        }
++      }
++#endif
++}
++
++JackSunAdapter::JackSunAdapter(jack_nframes_t buffer_size, jack_nframes_t sample_rate, const JSList* params)
++                :JackAudioAdapterInterface(buffer_size, sample_rate)
++                ,fThread(this),
++                fInFD(-1), fOutFD(-1), fPrecision(SUN_DRIVER_DEF_BITS),
++                fRWMode(0),
++                fInputBufferSize(0), fOutputBufferSize(0),
++                fInputBuffer(NULL), fOutputBuffer(NULL)
++{
++    const JSList* node;
++    const jack_driver_param_t* param;
++
++    fCaptureChannels = 2;
++    fPlaybackChannels = 2;
++
++    strcpy(fCaptureDriverName, SUN_DRIVER_DEF_DEV);
++    strcpy(fPlaybackDriverName, SUN_DRIVER_DEF_DEV);
++
++    for (node = params; node; node = jack_slist_next(node)) {
++        param = (const jack_driver_param_t*) node->data;
++
++        switch (param->character) {
++
++            case 'r':
++                SetAdaptedSampleRate(param->value.ui);
++                break;
++
++            case 'p':
++                SetAdaptedBufferSize(param->value.ui);
++                break;
++
++            case 'w':
++                fPrecision = param->value.i;
++                break;
++
++            case 'i':
++                fCaptureChannels = param->value.ui;
++                break;
++
++            case 'o':
++                fPlaybackChannels = param->value.ui;
++                break;
++
++            case 'C':
++                fRWMode |= kRead;
++                if (strcmp(param->value.str, "none") != 0) {
++                   strcpy(fCaptureDriverName, param->value.str);
++                }
++                break;
++
++            case 'P':
++                fRWMode |= kWrite;
++                if (strcmp(param->value.str, "none") != 0) {
++                   strcpy(fPlaybackDriverName, param->value.str);
++                }
++                break;
++
++            case 'd':
++               fRWMode |= kRead;
++               fRWMode |= kWrite;
++               strcpy(fCaptureDriverName, param->value.str);
++               strcpy(fPlaybackDriverName, param->value.str);
++               break;
++
++            case 'q':
++                fQuality = param->value.ui;
++                break;
++
++            case 'g':
++                fRingbufferCurSize = param->value.ui;
++                fAdaptative = false;
++                break;
++
++           }
++    }
++
++    fRWMode |= kRead;
++    fRWMode |= kWrite;
++}
++
++void JackSunAdapter::DisplayDeviceInfo()
++{
++}
++
++int JackSunAdapter::OpenInput()
++{
++    struct audio_info info;
++
++    if ((fInFD = open(fCaptureDriverName, O_RDONLY)) < 0) {
++        jack_error("JackSunAdapter::OpenInput failed to open device : %s@%i, errno = %d", __FILE__, __LINE__, errno);
++        return -1;
++    }
++
++    if (fCaptureChannels == 0) {
++        if (ioctl(fInFD, AUDIO_GETFORMAT, &info) != -1) {
++            fCaptureChannels = info.record.channels;
++        }
++    }
++
++    jack_log("JackSunAdapter::OpenInput input fInFD = %d", fInFD);
++
++    AUDIO_INITINFO(&info);
++    info.record.encoding = AUDIO_ENCODING_SLINEAR;
++    info.record.precision = fPrecision;
++    info.record.channels = fCaptureChannels;
++    info.record.sample_rate = fAdaptedSampleRate;
++
++    if (ioctl(fInFD, AUDIO_SETINFO, &info) == -1) {
++        jack_error("JackSunAdapter::OpenInput failed to set device parameters : %s@%i, errno = %d", __FILE__, __LINE__, errno);
++        goto error;
++    }
++
++    if (ioctl(fInFD, AUDIO_GETINFO, &info) == -1) {
++        jack_error("JackSunAdapter::OpenInput failed to get device paramters : %s@%i, errno = %d", __FILE__, __LINE__, errno);
++        goto error;
++    }
++
++    if (info.record.channels != fCaptureChannels) {
++        jack_info("JackSunAdapter::OpenInput driver forced the number of capture channels %u", info.record.channels);
++        goto error;
++    }
++
++    if (info.record.sample_rate != fAdaptedSampleRate) {
++        jack_info("JackSunAdapter::OpenInput driver forced the sample rate %u", info.record.sample_rate);
++    }
++
++    fInputBufferSize = info.blocksize;
++    fInputBuffer = (void*)calloc(fInputBufferSize, 1);
++    assert(fInputBuffer);
++
++    fInputSampleBuffer = (float**)malloc(fCaptureChannels * sizeof(float*));
++    assert(fInputSampleBuffer);
++
++    for (int i = 0; i < fCaptureChannels; i++) {
++        fInputSampleBuffer[i] = (float*)malloc(fAdaptedBufferSize * sizeof(float));
++        assert(fInputSampleBuffer[i]);
++    }
++    return 0;
++
++error:
++    ::close(fInFD);
++    return -1;
++}
++
++int JackSunAdapter::OpenOutput()
++{
++    struct audio_info info;
++
++    if ((fOutFD = open(fPlaybackDriverName, O_WRONLY)) < 0) {
++        jack_error("JackSunAdapter::OpenOutput failed to open device : %s@%i, errno = %d", __FILE__, __LINE__, errno);
++        return -1;
++    }
++
++    if (fPlaybackChannels == 0) {
++        if (ioctl(fOutFD, AUDIO_GETFORMAT, &info) == 0) {
++            fPlaybackChannels = info.play.channels;
++        }
++    }
++
++    jack_log("JackSunAdapter::OpenOutput input fOutFD = %d", fOutFD);
++
++    AUDIO_INITINFO(&info);
++    info.hiwat = 2;
++    info.play.encoding = AUDIO_ENCODING_SLINEAR;
++    info.play.precision = fPrecision;
++    info.play.channels = fPlaybackChannels;
++    info.play.sample_rate = fAdaptedSampleRate;
++
++    if (ioctl(fOutFD, AUDIO_SETINFO, &info) == -1) {
++        jack_error("JackSunAdapter::OpenOutput failed to set device parameters : %s@%i, errno = %d", __FILE__, __LINE__, errno);
++        goto error;
++    }
++
++    if (ioctl(fOutFD, AUDIO_GETINFO, &info) == -1) {
++        jack_error("JackSunAdapter::OpenOutput failed to get device paramters : %s@%i, errno = %d", __FILE__, __LINE__, errno);
++        goto error;
++    }
++
++    if (info.play.precision != fPrecision) {
++        jack_info("JackSunAdapter::OpenOutput driver forced the precision %u", info.play.precision);
++        goto error;
++    }
++
++    if (info.play.channels != fPlaybackChannels) {
++        jack_info("JackSunAdapter::OpenOutput driver forced the number of capture channels %u", info.play.channels);
++        goto error;
++    }
++
++    if (info.play.sample_rate != fAdaptedSampleRate) {
++        jack_info("JackSunAdapter::OpenOutput driver forced the sample rate %u", info.play.sample_rate);
++    }
++
++    fOutputBufferSize = info.blocksize;
++    fOutputBuffer = (void*)calloc(fOutputBufferSize, 1);
++    assert(fOutputBuffer);
++
++    fOutputSampleBuffer = (float**)malloc(fPlaybackChannels * sizeof(float*));
++    assert(fOutputSampleBuffer);
++
++    for (int i = 0; i < fPlaybackChannels; i++) {
++        fOutputSampleBuffer[i] = (float*)malloc(fAdaptedBufferSize * sizeof(float));
++        assert(fOutputSampleBuffer[i]);
++    }
++
++    return 0;
++
++error:
++    ::close(fOutFD);
++    return -1;
++}
++
++int JackSunAdapter::Open()
++{
++    if ((fRWMode & kRead) && (OpenInput() < 0)) {
++        return -1;
++    }
++
++    if ((fRWMode & kWrite) && (OpenOutput() < 0)) {
++       return -1;
++    }
++
++    // In duplex mode, check that input and output use the same buffer size
++    if ((fRWMode & kRead) && (fRWMode & kWrite) && (fInputBufferSize != fOutputBufferSize)) {
++       jack_error("JackSunAdapter::OpenAux input and output buffer size are not the same!!");
++       goto error;
++    }
++
++    DisplayDeviceInfo();
++
++    //start adapter thread
++    if (fThread.StartSync() < 0) {
++        jack_error ( "Cannot start audioadapter thread" );
++        return -1;
++    }
++
++    //turn the thread realtime
++    fThread.AcquireRealTime(JackServerGlobals::fInstance->GetEngineControl()->fClientPriority);
++    return 0;
++
++error:
++    CloseAux();
++    return -1;
++}
++
++
++int JackSunAdapter::Close()
++{
++#ifdef JACK_MONITOR
++    fTable.Save(fHostBufferSize, fHostSampleRate, fAdaptedSampleRate, fAdaptedBufferSize);
++#endif
++    fThread.Stop();
++    CloseAux();
++    return 0;
++}
++
++void JackSunAdapter::CloseAux()
++{
++    if (fRWMode & kRead) {
++        close(fInFD);
++        fInFD = -1;
++    }
++
++    if (fRWMode & kWrite) {
++        close(fOutFD);
++        fOutFD = -1;
++    }
++
++    free(fInputBuffer);
++    fInputBuffer = NULL;
++
++    free(fOutputBuffer);
++    fOutputBuffer = NULL;
++
++    for (int i = 0; i < fCaptureChannels; i++) {
++        free(fInputSampleBuffer[i]);
++    }
++    free(fInputSampleBuffer);
++
++    for (int i = 0; i < fPlaybackChannels; i++) {
++        free(fOutputSampleBuffer[i]);
++    }
++    free(fOutputSampleBuffer);
++ }
++
++int JackSunAdapter::Read()
++{
++    ssize_t count = ::read(fInFD, fInputBuffer, fInputBufferSize);
++
++    if (count < fInputBufferSize) {
++        jack_error("JackSunAdapter::Read error bytes read = %ld", count);
++        return -1;
++    } else {
++        for (int i = 0; i < fCaptureChannels; i++) {
++             CopyAndConvertIn(fInputSampleBuffer[i], fInputBuffer, fAdaptedBufferSize, i, fCaptureChannels, fPrecision);
++        }
++        return 0;
++    }
++}
++
++int JackSunAdapter::Write()
++{
++    ssize_t count;
++
++    for (int i = 0; i < fPlaybackChannels; i++) {
++        CopyAndConvertOut(fOutputBuffer, fOutputSampleBuffer[i], fAdaptedBufferSize, i, fCaptureChannels, fPrecision);
++    }
++
++    count = ::write(fOutFD, fOutputBuffer, fOutputBufferSize);
++
++    if (count < fOutputBufferSize) {
++        jack_error("JackSunAdapter::Write error bytes written = %ld", count);
++        return -1;
++    } else {
++        return 0;
++    }
++}
++
++bool JackSunAdapter::Execute()
++{
++    //read data from audio interface
++    if (Read() < 0)
++        return false;
++
++    PushAndPull(fInputSampleBuffer, fOutputSampleBuffer, fAdaptedBufferSize);
++
++    //write data to audio interface
++    if (Write() < 0)
++        return false;
++
++    return true;
++}
++
++int JackSunAdapter::SetBufferSize(jack_nframes_t buffer_size)
++{
++    JackAudioAdapterInterface::SetBufferSize(buffer_size);
++    Close();
++    return Open();
++}
++
++} // namespace
++
++#ifdef __cplusplus
++extern "C"
++{
++#endif
++
++    SERVER_EXPORT jack_driver_desc_t* jack_get_descriptor()
++    {
++        jack_driver_desc_t * desc;
++        jack_driver_desc_filler_t filler;
++        jack_driver_param_value_t value;
++
++        desc = jack_driver_descriptor_construct("audioadapter", JackDriverNone, "netjack audio <==> net backend adapter", &filler);
++
++        value.ui = SUN_DRIVER_DEF_FS;
++        jack_driver_descriptor_add_parameter(desc, &filler, "rate", 'r', JackDriverParamUInt, &value, NULL, "Sample rate", NULL);
++
++        value.ui = SUN_DRIVER_DEF_BLKSIZE;
++        jack_driver_descriptor_add_parameter(desc, &filler, "period", 'p', JackDriverParamUInt, &value, NULL, "Frames per period", NULL);
++
++        value.i = SUN_DRIVER_DEF_BITS;
++        jack_driver_descriptor_add_parameter(desc, &filler, "wordlength", 'w', JackDriverParamInt, &value, NULL, "Word length", NULL);
++
++        value.ui = SUN_DRIVER_DEF_INS;
++        jack_driver_descriptor_add_parameter(desc, &filler, "in-channels", 'i', JackDriverParamUInt, &value, NULL, "Capture channels", NULL);
++
++        value.ui = SUN_DRIVER_DEF_OUTS;
++        jack_driver_descriptor_add_parameter(desc, &filler, "out-channels", 'o', JackDriverParamUInt, &value, NULL, "Playback channels", NULL);
++
++        strcpy(value.str, SUN_DRIVER_DEF_DEV);
++        jack_driver_descriptor_add_parameter(desc, &filler, "capture", 'C', JackDriverParamString, &value, NULL, "Input device", NULL);
++        jack_driver_descriptor_add_parameter(desc, &filler, "playback", 'P', JackDriverParamString, &value, NULL, "Output device", NULL);
++        jack_driver_descriptor_add_parameter(desc, &filler, "device", 'd', JackDriverParamString, &value, NULL, "Audio device name", NULL);
++
++        value.i  = true;
++        jack_driver_descriptor_add_parameter(desc, &filler, "ignorehwbuf", 'b', JackDriverParamBool, &value, NULL, "Ignore hardware period size", NULL);
++
++        value.ui  = 0;
++        jack_driver_descriptor_add_parameter(desc, &filler, "quality", 'q', JackDriverParamInt, &value, NULL, "Resample algorithm quality (0 - 4)", NULL);
++
++        value.i = 32768;
++        jack_driver_descriptor_add_parameter(desc, &filler, "ring-buffer", 'g', JackDriverParamInt, &value, NULL, "Fixed ringbuffer size", "Fixed ringbuffer size (if not set => automatic 
adaptative)");
++
++        return desc;
++    }
++
++#ifdef __cplusplus
++}
++#endif
++
Index: pkgsrc/audio/jack/patches/patch-netbsd_sun_JackSunAdapter.h
diff -u /dev/null pkgsrc/audio/jack/patches/patch-netbsd_sun_JackSunAdapter.h:1.1
--- /dev/null   Wed Sep  8 19:19:20 2021
+++ pkgsrc/audio/jack/patches/patch-netbsd_sun_JackSunAdapter.h Wed Sep  8 19:19:20 2021
@@ -0,0 +1,120 @@
+$NetBSD: patch-netbsd_sun_JackSunAdapter.h,v 1.1 2021/09/08 19:19:20 nia Exp $
+
+Add NetBSD support.
+
+--- netbsd/sun/JackSunAdapter.h.orig   2021-09-08 13:51:19.686313010 +0000
++++ netbsd/sun/JackSunAdapter.h
+@@ -0,0 +1,113 @@
++/*
++Copyright (C) 2008 Grame & RTL 2008
++
++This program is free software; you can redistribute it and/or modify
++it under the terms of the GNU General Public License as published by
++the Free Software Foundation; either version 2 of the License, or
++(at your option) any later version.
++
++This program is distributed in the hope that it will be useful,
++but WITHOUT ANY WARRANTY; without even the implied warranty of
++MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++GNU General Public License for more details.
++
++You should have received a copy of the GNU General Public License
++along with this program; if not, write to the Free Software
++Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
++
++*/
++
++#ifndef __JackSunAdapter__
++#define __JackSunAdapter__
++
++#include <math.h>
++#include <limits.h>
++#include <assert.h>
++#include "JackAudioAdapterInterface.h"
++#include "JackPlatformPlug.h"
++#include "JackError.h"
++#include "jack.h"
++#include "jslist.h"
++
++namespace Jack
++{
++
++typedef jack_default_audio_sample_t jack_sample_t;
++
++#define SUN_DRIVER_DEF_DEV    "/dev/audio"
++#define SUN_DRIVER_DEF_FS     48000
++#define SUN_DRIVER_DEF_BLKSIZE        1024
++#define SUN_DRIVER_DEF_BITS   16
++#define SUN_DRIVER_DEF_INS    2
++#define SUN_DRIVER_DEF_OUTS   2
++
++/*!
++\brief The Sun adapter.
++*/
++
++class JackSunAdapter : public JackAudioAdapterInterface, public JackRunnableInterface
++{
++
++    enum { kRead = 1, kWrite = 2, kReadWrite = 3 };
++
++    private:
++
++        JackThread fThread;
++
++        char fCaptureDriverName[JACK_CLIENT_NAME_SIZE+1];
++        char fPlaybackDriverName[JACK_CLIENT_NAME_SIZE+1];
++
++        int fInFD;
++        int fOutFD;
++
++        int fPrecision;
++        int   fRWMode;
++
++        unsigned int fInputBufferSize;
++        unsigned int fOutputBufferSize;
++
++        void* fInputBuffer;
++        void* fOutputBuffer;
++
++        float** fInputSampleBuffer;
++        float** fOutputSampleBuffer;
++
++        int OpenInput();
++        int OpenOutput();
++        void CloseAux();
++        void DisplayDeviceInfo();
++
++    public:
++
++        JackSunAdapter(jack_nframes_t buffer_size, jack_nframes_t sample_rate, const JSList* params);
++        ~JackSunAdapter()
++        {}
++
++        int Open();
++        int Close();
++
++        int Read();
++        int Write();
++
++        int SetBufferSize(jack_nframes_t buffer_size);
++
++        bool Execute();
++};
++
++}
++
++#ifdef __cplusplus
++extern "C"
++{
++#endif
++
++#include "JackCompilerDeps.h"
++#include "driver_interface.h"
++
++SERVER_EXPORT jack_driver_desc_t* jack_get_descriptor();
++
++#ifdef __cplusplus
++}
++#endif
++
++#endif
Index: pkgsrc/audio/jack/patches/patch-netbsd_sun_JackSunDriver.cpp
diff -u /dev/null pkgsrc/audio/jack/patches/patch-netbsd_sun_JackSunDriver.cpp:1.1
--- /dev/null   Wed Sep  8 19:19:20 2021
+++ pkgsrc/audio/jack/patches/patch-netbsd_sun_JackSunDriver.cpp        Wed Sep  8 19:19:20 2021
@@ -0,0 +1,564 @@
+$NetBSD: patch-netbsd_sun_JackSunDriver.cpp,v 1.1 2021/09/08 19:19:20 nia Exp $
+
+Add NetBSD support.
+
+--- netbsd/sun/JackSunDriver.cpp.orig  2021-09-08 13:51:19.686819398 +0000
++++ netbsd/sun/JackSunDriver.cpp
+@@ -0,0 +1,557 @@
++/*
++Copyright (C) 2003-2007 Jussi Laako <jussi%sonarnerd.net@localhost>
++Copyright (C) 2008 Grame & RTL 2008
++
++This program is free software; you can redistribute it and/or modify
++it under the terms of the GNU General Public License as published by
++the Free Software Foundation; either version 2 of the License, or
++(at your option) any later version.
++
++This program is distributed in the hope that it will be useful,
++but WITHOUT ANY WARRANTY; without even the implied warranty of
++MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++GNU General Public License for more details.
++
++You should have received a copy of the GNU General Public License
++along with this program; if not, write to the Free Software
++Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
++
++*/
++
++#include "driver_interface.h"
++#include "JackThreadedDriver.h"
++#include "JackDriverLoader.h"
++#include "JackSunDriver.h"
++#include "JackEngineControl.h"
++#include "JackGraphManager.h"
++#include "JackError.h"
++#include "JackTime.h"
++#include "JackShmMem.h"
++#include "memops.h"
++
++#include <sys/ioctl.h>
++#include <sys/audioio.h>
++#include <errno.h>
++#include <fcntl.h>
++#include <unistd.h>
++
++#include <iostream>
++#include <assert.h>
++#include <stdio.h>
++#include <stdlib.h>
++
++using namespace std;
++
++namespace Jack
++{
++
++inline int int2pow2(int x)    { int r = 0; while ((1 << r) < x) r++; return r; }
++
++static inline void CopyAndConvertIn(jack_sample_t *dst, void *src, size_t nframes, int channel, int chcount, int bits)
++{
++    switch (bits) {
++
++              case 16: {
++                  signed short *s16src = (signed short*)src;
++            s16src += channel;
++            sample_move_dS_s16(dst, (char*)s16src, nframes, chcount<<1);
++                      break;
++        }
++              case 24: {
++                      signed int *s32src = (signed int*)src;
++            s32src += channel;
++            sample_move_dS_s24(dst, (char*)s32src, nframes, chcount<<2);
++                      break;
++        }
++              case 32: {
++                      signed int *s32src = (signed int*)src;
++            s32src += channel;
++            sample_move_dS_s32u24(dst, (char*)s32src, nframes, chcount<<2);
++                      break;
++        }
++      }
++}
++
++static inline void CopyAndConvertOut(void *dst, jack_sample_t *src, size_t nframes, int channel, int chcount, int bits)
++{
++      switch (bits) {
++
++              case 16: {
++                      signed short *s16dst = (signed short*)dst;
++            s16dst += channel;
++            sample_move_d16_sS((char*)s16dst, src, nframes, chcount<<1, NULL); // No dithering for now...
++                      break;
++        }
++              case 24: {
++                      signed int *s32dst = (signed int*)dst;
++            s32dst += channel;
++            sample_move_d24_sS((char*)s32dst, src, nframes, chcount<<2, NULL); // No dithering for now...
++                      break;
++        }
++              case 32: {
++            signed int *s32dst = (signed int*)dst;
++            s32dst += channel;
++            sample_move_d32u24_sS((char*)s32dst, src, nframes, chcount<<2, NULL);
++                      break;
++        }
++      }
++}
++
++int JackSunDriver::OpenInput()
++{
++    struct audio_info info;
++    int new_buffer_size;
++
++    if ((fInFD = open(fCaptureDriverName, O_RDONLY)) < 0) {
++        jack_error("JackSunDriver::OpenInput failed to open device : %s@%i, errno = %d", __FILE__, __LINE__, errno);
++        return -1;
++    }
++
++    if (fCaptureChannels == 0) {
++        if (ioctl(fInFD, AUDIO_GETFORMAT, &info) == 0) {
++            fCaptureChannels = info.record.channels;
++        }
++    }
++
++    jack_log("JackSunDriver::OpenInput input fInFD = %d", fInFD);
++
++    AUDIO_INITINFO(&info);
++    info.record.encoding = AUDIO_ENCODING_SLINEAR;
++    info.record.precision = fPrecision;
++    info.record.channels = fCaptureChannels;
++    info.record.sample_rate = fEngineControl->fSampleRate;
++
++    if (ioctl(fInFD, AUDIO_SETINFO, &info) == -1) {
++        jack_error("JackSunDriver::OpenInput failed to set device parameters : %s@%i, errno = %d", __FILE__, __LINE__, errno);
++        goto error;
++    }
++
++    if (ioctl(fInFD, AUDIO_GETINFO, &info) == -1) {
++        jack_error("JackSunDriver::OpenInput failed to get device paramters : %s@%i, errno = %d", __FILE__, __LINE__, errno);
++        goto error;
++    }
++
++    if (info.record.channels != fCaptureChannels) {
++        jack_info("JackSunDriver::OpenInput driver forced the number of capture channels %u", info.record.channels);
++        goto error;
++    }
++
++    if (info.record.sample_rate != fEngineControl->fSampleRate) {
++        jack_info("JackSunDriver::OpenInput driver forced the sample rate %u", info.record.sample_rate);
++    }
++
++    fInputBufferSize = info.blocksize;
++
++    new_buffer_size = fInputBufferSize / ((info.record.precision / NBBY) * fCaptureChannels);
++
++    JackAudioDriver::SetBufferSize(new_buffer_size); // never fails
++
++    fInputBuffer = (void*)calloc(fInputBufferSize, 1);
++    assert(fInputBuffer);
++    return 0;
++
++error:
++    ::close(fInFD);
++    return -1;
++}
++
++int JackSunDriver::OpenOutput()
++{
++    struct audio_info info;
++    int new_buffer_size;
++
++    if ((fOutFD = open(fPlaybackDriverName, O_WRONLY)) < 0) {
++        jack_error("JackSunDriver::OpenOutput failed to open device : %s@%i, errno = %d", __FILE__, __LINE__, errno);
++        return -1;
++    }
++
++    if (fPlaybackChannels == 0) {
++        if (ioctl(fOutFD, AUDIO_GETFORMAT, &info) == 0) {
++            fPlaybackChannels = info.play.channels;
++        }
++    }
++
++    jack_log("JackSunDriver::OpenOutput input fOutFD = %d", fOutFD);
++
++    AUDIO_INITINFO(&info);
++    info.hiwat = 2;
++    info.play.encoding = AUDIO_ENCODING_SLINEAR;
++    info.play.precision = fPrecision;
++    info.play.channels = fPlaybackChannels;
++    info.play.sample_rate = fEngineControl->fSampleRate;
++
++    if (ioctl(fOutFD, AUDIO_SETINFO, &info) == -1) {
++        jack_error("JackSunDriver::OpenOutput failed to set device parameters : %s@%i, errno = %d", __FILE__, __LINE__, errno);
++        goto error;
++    }
++
++    if (ioctl(fOutFD, AUDIO_GETINFO, &info) == -1) {
++        jack_error("JackSunDriver::OpenOutput failed to get device paramters : %s@%i, errno = %d", __FILE__, __LINE__, errno);
++        goto error;
++    }
++
++    if (info.play.precision != fPrecision) {
++        jack_info("JackSunDriver::OpenOutput driver forced the precision %u", info.play.precision);
++        goto error;
++    }
++
++    if (info.play.channels != fPlaybackChannels) {
++        jack_info("JackSunDriver::OpenOutput driver forced the number of capture channels %u", info.play.channels);
++        goto error;
++    }
++
++    if (info.play.sample_rate != fEngineControl->fSampleRate) {
++        jack_info("JackSunDriver::OpenOutput driver forced the sample rate %u", info.play.sample_rate);
++    }
++
++    fOutputBufferSize = info.blocksize;
++
++    new_buffer_size = fOutputBufferSize / ((info.play.precision / NBBY) * fPlaybackChannels);
++
++    JackAudioDriver::SetBufferSize(new_buffer_size); // never fails
++
++    fOutputBuffer = (void*)calloc(fOutputBufferSize, 1);
++    assert(fOutputBuffer);
++    return 0;
++
++error:
++    ::close(fOutFD);
++    return -1;
++}
++
++int JackSunDriver::Open(jack_nframes_t nframes,
++                      jack_nframes_t samplerate,
++                      bool capturing,
++                      bool playing,
++                      int inchannels,
++                      int outchannels,
++                      bool excl,
++                      bool monitor,
++                      const char* capture_driver_uid,
++                      const char* playback_driver_uid,
++                      jack_nframes_t capture_latency,
++                      jack_nframes_t playback_latency,
++                      int bits)
++{
++    // Generic JackAudioDriver Open
++    if (JackAudioDriver::Open(nframes, samplerate, capturing, playing, inchannels, outchannels, monitor,
++        capture_driver_uid, playback_driver_uid, capture_latency, playback_latency) != 0) {
++        return -1;
++    } else {
++
++        if (!fEngineControl->fSyncMode) {
++            jack_error("Cannot run in asynchronous mode, use the -S parameter for jackd");
++            return -1;
++        }
++
++        fRWMode |= ((capturing) ? kRead : 0);
++        fRWMode |= ((playing) ? kWrite : 0);
++        fPrecision = bits;
++
++        if (OpenAux() < 0) {
++            Close();
++            return -1;
++        } else {
++            return 0;
++        }
++    }
++}
++
++int JackSunDriver::Close()
++{
++    int res = JackAudioDriver::Close();
++    CloseAux();
++    return res;
++}
++
++
++int JackSunDriver::OpenAux()
++{
++    if ((fRWMode & kRead) && (OpenInput() < 0)) {
++        return -1;
++    }
++
++    if ((fRWMode & kWrite) && (OpenOutput() < 0)) {
++        return -1;
++    }
++
++    return 0;
++}
++
++void JackSunDriver::CloseAux()
++{
++    if (fRWMode & kRead && fInFD > 0) {
++        close(fInFD);
++        fInFD = -1;
++    }
++
++    if (fRWMode & kWrite && fOutFD > 0) {
++        close(fOutFD);
++        fOutFD = -1;
++    }
++
++    if (fInputBuffer)
++        free(fInputBuffer);
++    fInputBuffer = NULL;
++
++    if (fOutputBuffer)
++        free(fOutputBuffer);
++    fOutputBuffer = NULL;
++}
++
++int JackSunDriver::Read()
++{
++    if (fInFD < 0) {
++        // Keep begin cycle time
++        JackDriver::CycleTakeBeginTime();
++        return 0;
++    }
++
++    ssize_t count;
++
++    count = ::read(fInFD, fInputBuffer, fInputBufferSize);
++
++    struct audio_info info;
++
++#if 0
++    // XRun detection
++    if (ioctl(fInFD, AUDIO_GETBUFINFO, &info) != -1) {
++        if (info.record.error > 0) {
++            jack_error("JackSunDriver::Read overruns");
++            jack_time_t cur_time = GetMicroSeconds();
++            NotifyXRun(cur_time, float(cur_time - fBeginDateUst));   // Better this value than nothing...
++        }
++    }
++#endif
++
++    if (count < 0) {
++        jack_log("JackSunDriver::Read error = %s", strerror(errno));
++        return -1;
++    } else if (count < (int)fInputBufferSize) {
++        jack_error("JackSunDriver::Read error bytes read = %ld", count);
++        return -1;
++    } else {
++
++        // Keep begin cycle time
++        JackDriver::CycleTakeBeginTime();
++        for (int i = 0; i < fCaptureChannels; i++) {
++            if (fGraphManager->GetConnectionsNum(fCapturePortList[i]) > 0) {
++                CopyAndConvertIn(GetInputBuffer(i), fInputBuffer, fEngineControl->fBufferSize, i, fCaptureChannels, fPrecision);
++            }
++        }
++
++        return 0;
++    }
++}
++
++int JackSunDriver::Write()
++{
++    if (fOutFD < 0) {
++        // Keep end cycle time
++        JackDriver::CycleTakeEndTime();
++        return 0;
++    }
++
++    ssize_t count;
++
++    memset(fOutputBuffer, 0, fOutputBufferSize);
++    for (int i = 0; i < fPlaybackChannels; i++) {
++        if (fGraphManager->GetConnectionsNum(fPlaybackPortList[i]) > 0) {
++            CopyAndConvertOut(fOutputBuffer, GetOutputBuffer(i), fEngineControl->fBufferSize, i, fPlaybackChannels, fPrecision);
++        }
++    }
++
++    // Keep end cycle time
++    JackDriver::CycleTakeEndTime();
++    count = ::write(fOutFD, fOutputBuffer, fOutputBufferSize);
++
++    struct audio_info info;
++
++    // XRun detection
++    if (ioctl(fOutFD, AUDIO_GETBUFINFO, &info) != -1) {
++
++        if (info.play.error > 0) {
++            jack_error("JackSunDriver::Write underruns");
++            jack_time_t cur_time = GetMicroSeconds();
++            NotifyXRun(cur_time, float(cur_time - fBeginDateUst));   // Better this value than nothing...
++        }
++    }
++
++    if (count < 0) {
++        jack_log("JackSunDriver::Write error = %s", strerror(errno));
++        return -1;
++    } else if (count < (int)fOutputBufferSize) {
++        jack_error("JackSunDriver::Write error bytes written = %ld", count);
++        return -1;
++    } else {
++        return 0;
++    }
++}
++
++int JackSunDriver::SetBufferSize(jack_nframes_t buffer_size)
++{
++    CloseAux();
++    JackAudioDriver::SetBufferSize(buffer_size); // Generic change, never fails
++    return OpenAux();
++}
++
++int JackSunDriver::ProcessSync()
++{
++    // Read input buffers for the current cycle
++    if (Read() < 0) {
++        jack_error("ProcessSync: read error, skip cycle");
++        return 0;   // Non fatal error here, skip cycle, but continue processing...
++    }
++
++    if (fIsMaster) {
++        ProcessGraphSync();
++    } else {
++        ResumeRefNum();
++    }
++
++    // Write output buffers for the current cycle
++    if (Write() < 0) {
++        jack_error("JackAudioDriver::ProcessSync: write error, skip cycle");
++        return 0;   // Non fatal error here, skip cycle, but continue processing...
++    }
++
++    return 0;
++}
++
++} // end of namespace
++
++#ifdef __cplusplus
++extern "C"
++{
++#endif
++
++SERVER_EXPORT jack_driver_desc_t* driver_get_descriptor()
++{
++    jack_driver_desc_t * desc;
++    jack_driver_desc_filler_t filler;
++    jack_driver_param_value_t value;
++
++    desc = jack_driver_descriptor_construct("sun", JackDriverMaster, "Sun API based audio backend", &filler);
++
++    value.ui = SUN_DRIVER_DEF_FS;
++    jack_driver_descriptor_add_parameter(desc, &filler, "rate", 'r', JackDriverParamUInt, &value, NULL, "Sample rate", NULL);
++
++    value.ui = SUN_DRIVER_DEF_BLKSIZE;
++    jack_driver_descriptor_add_parameter(desc, &filler, "period", 'p', JackDriverParamUInt, &value, NULL, "Frames per period", NULL);
++
++    value.i = SUN_DRIVER_DEF_BITS;
++    jack_driver_descriptor_add_parameter(desc, &filler, "wordlength", 'w', JackDriverParamInt, &value, NULL, "Word length", NULL);
++
++    value.ui = SUN_DRIVER_DEF_INS;
++    jack_driver_descriptor_add_parameter(desc, &filler, "inchannels", 'i', JackDriverParamUInt, &value, NULL, "Capture channels", NULL);
++
++    value.ui = SUN_DRIVER_DEF_OUTS;
++    jack_driver_descriptor_add_parameter(desc, &filler, "outchannels", 'o', JackDriverParamUInt, &value, NULL, "Playback channels", NULL);
++
++    strcpy(value.str, SUN_DRIVER_DEF_DEV);
++    jack_driver_descriptor_add_parameter(desc, &filler, "capture", 'C', JackDriverParamString, &value, NULL, "Input device", NULL);
++    jack_driver_descriptor_add_parameter(desc, &filler, "playback", 'P', JackDriverParamString, &value, NULL, "Output device", NULL);
++    jack_driver_descriptor_add_parameter(desc, &filler, "device", 'd', JackDriverParamString, &value, NULL, "Audio device name", NULL);
++
++    value.ui = 0;
++    jack_driver_descriptor_add_parameter(desc, &filler, "input-latency", 'I', JackDriverParamUInt, &value, NULL, "Extra input latency", NULL);
++    jack_driver_descriptor_add_parameter(desc, &filler, "output-latency", 'O', JackDriverParamUInt, &value, NULL, "Extra output latency", NULL);
++
++    return desc;
++}
++
++SERVER_EXPORT Jack::JackDriverClientInterface* driver_initialize(Jack::JackLockedEngine* engine, Jack::JackSynchro* table, const JSList* params)
++{
++    int bits = SUN_DRIVER_DEF_BITS;
++    jack_nframes_t srate = SUN_DRIVER_DEF_FS;
++    jack_nframes_t frames_per_interrupt = SUN_DRIVER_DEF_BLKSIZE;
++    const char* capture_pcm_name = SUN_DRIVER_DEF_DEV;
++    const char* playback_pcm_name = SUN_DRIVER_DEF_DEV;
++    bool capture = false;
++    bool playback = false;
++    int chan_in = 0;
++    int chan_out = 0;
++    bool monitor = false;
++    bool excl = false;
++    const JSList *node;
++    const jack_driver_param_t *param;
++    jack_nframes_t systemic_input_latency = 0;
++    jack_nframes_t systemic_output_latency = 0;
++
++    for (node = params; node; node = jack_slist_next(node)) {
++
++        param = (const jack_driver_param_t *)node->data;
++
++        switch (param->character) {
++
++        case 'r':
++            srate = param->value.ui;
++            break;
++
++        case 'p':
++            frames_per_interrupt = (unsigned int)param->value.ui;
++            break;
++
++        case 'w':
++            bits = param->value.i;
++            break;
++
++        case 'i':
++            chan_in = (int)param->value.ui;
++            break;
++
++        case 'o':
++            chan_out = (int)param->value.ui;
++            break;
++
++        case 'C':
++            capture = true;
++            if (strcmp(param->value.str, "none") != 0) {
++                capture_pcm_name = param->value.str;
++            }
++            break;
++
++        case 'P':
++            playback = true;
++            if (strcmp(param->value.str, "none") != 0) {
++                playback_pcm_name = param->value.str;
++            }
++            break;
++
++        case 'd':
++            playback_pcm_name = param->value.str;
++            capture_pcm_name = param->value.str;
++            break;
++
++        case 'I':
++            systemic_input_latency = param->value.ui;
++            break;
++
++        case 'O':
++            systemic_output_latency = param->value.ui;
++            break;
++        }
++    }
++
++    // duplex is the default
++    if (!capture && !playback) {
++        capture = true;
++        playback = true;
++    }
++
++    Jack::JackSunDriver* sun_driver = new Jack::JackSunDriver("system", "sun", engine, table);
++    Jack::JackDriverClientInterface* threaded_driver = new Jack::JackThreadedDriver(sun_driver);
++
++    // Special open for Sun driver...
++    if (sun_driver->Open(frames_per_interrupt, srate, capture, playback, chan_in, chan_out,
++        excl, monitor, capture_pcm_name, playback_pcm_name, systemic_input_latency, systemic_output_latency, bits) == 0) {
++        return threaded_driver;
++    } else {
++        delete threaded_driver; // Delete the decorated driver
++        return NULL;
++    }
++}
++
++#ifdef __cplusplus
++}
++#endif
Index: pkgsrc/audio/jack/patches/patch-netbsd_sun_JackSunDriver.h
diff -u /dev/null pkgsrc/audio/jack/patches/patch-netbsd_sun_JackSunDriver.h:1.1
--- /dev/null   Wed Sep  8 19:19:20 2021
+++ pkgsrc/audio/jack/patches/patch-netbsd_sun_JackSunDriver.h  Wed Sep  8 19:19:20 2021
@@ -0,0 +1,120 @@
+$NetBSD: patch-netbsd_sun_JackSunDriver.h,v 1.1 2021/09/08 19:19:20 nia Exp $
+
+Add NetBSD support.
+
+--- netbsd/sun/JackSunDriver.h.orig    2021-09-08 13:51:19.687983014 +0000
++++ netbsd/sun/JackSunDriver.h
+@@ -0,0 +1,113 @@
++/*
++Copyright (C) 2003-2007 Jussi Laako <jussi%sonarnerd.net@localhost>
++Copyright (C) 2008 Grame & RTL 2008
++
++This program is free software; you can redistribute it and/or modify
++it under the terms of the GNU General Public License as published by
++the Free Software Foundation; either version 2 of the License, or
++(at your option) any later version.
++
++This program is distributed in the hope that it will be useful,
++but WITHOUT ANY WARRANTY; without even the implied warranty of
++MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++GNU General Public License for more details.
++
++You should have received a copy of the GNU General Public License
++along with this program; if not, write to the Free Software
++Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
++
++*/
++
++#ifndef __JackSunDriver__
++#define __JackSunDriver__
++
++#include "JackAudioDriver.h"
++
++namespace Jack
++{
++
++typedef jack_default_audio_sample_t jack_sample_t;
++
++#define SUN_DRIVER_DEF_DEV    "/dev/audio"
++#define SUN_DRIVER_DEF_FS     48000
++#define SUN_DRIVER_DEF_BLKSIZE        1024
++#define SUN_DRIVER_DEF_BITS   16
++#define SUN_DRIVER_DEF_INS    2
++#define SUN_DRIVER_DEF_OUTS   2
++
++/*!
++\brief The Sun driver.
++*/
++
++class JackSunDriver : public JackAudioDriver
++{
++
++    enum { kRead = 1, kWrite = 2, kReadWrite = 3 };
++
++    private:
++
++        int fInFD;
++        int fOutFD;
++
++        int fPrecision;
++        int fRWMode;
++
++        unsigned int fInputBufferSize;
++        unsigned int fOutputBufferSize;
++
++        void* fInputBuffer;
++        void* fOutputBuffer;
++
++        int OpenInput();
++        int OpenOutput();
++        int OpenAux();
++        void CloseAux();
++        void DisplayDeviceInfo();
++
++        // Redefining since timing for CPU load is specific
++        int ProcessSync();
++
++    public:
++
++        JackSunDriver(const char* name, const char* alias, JackLockedEngine* engine, JackSynchro* table)
++                : JackAudioDriver(name, alias, engine, table),
++                fInFD(-1), fOutFD(-1), fPrecision(0),
++                fRWMode(0),
++                fInputBufferSize(0), fOutputBufferSize(0),
++                fInputBuffer(NULL), fOutputBuffer(NULL)
++        {}
++
++        virtual ~JackSunDriver()
++        {}
++
++        int Open(jack_nframes_t frames_per_cycle,
++                 jack_nframes_t rate,
++                 bool capturing,
++                 bool playing,
++                 int chan_in,
++                 int chan_out,
++                 bool vmix,
++                 bool monitor,
++                 const char* capture_driver_name,
++                 const char* playback_driver_name,
++                 jack_nframes_t capture_latency,
++                 jack_nframes_t playback_latency,
++                 int bits);
++
++        int Close();
++
++        int Read();
++        int Write();
++
++        bool IsFixedBufferSize()
++        {
++            return true;
++        }
++
++        int SetBufferSize(jack_nframes_t buffer_size);
++
++};
++
++} // end of namespace
++
++#endif
Index: pkgsrc/audio/jack/patches/patch-posix_JackNetUnixSocket.cpp
diff -u /dev/null pkgsrc/audio/jack/patches/patch-posix_JackNetUnixSocket.cpp:1.1
--- /dev/null   Wed Sep  8 19:19:20 2021
+++ pkgsrc/audio/jack/patches/patch-posix_JackNetUnixSocket.cpp Wed Sep  8 19:19:20 2021
@@ -0,0 +1,69 @@
+$NetBSD: patch-posix_JackNetUnixSocket.cpp,v 1.1 2021/09/08 19:19:20 nia Exp $
+
+Add NetBSD support.
+
+--- posix/JackNetUnixSocket.cpp.orig   2021-07-15 06:18:26.000000000 +0000
++++ posix/JackNetUnixSocket.cpp
+@@ -280,7 +280,7 @@ namespace Jack
+ 
+     //timeout************************************************************************************************************
+ 
+-#if defined(__sun__) || defined(sun)
++#if defined(__sun__) || defined(sun) || defined(__NetBSD__)
+     int JackNetUnixSocket::SetTimeOut(int us)
+     {
+         int   flags;
+@@ -389,7 +389,7 @@ namespace Jack
+     //network operations**************************************************************************************************
+     int JackNetUnixSocket::SendTo(const void* buffer, size_t nbytes, int flags)
+     {
+-    #if defined(__sun__) || defined(sun)
++    #if defined(__sun__) || defined(sun) || defined(__NetBSD__)
+         if (WaitWrite() < 0) {
+             return -1;
+         }
+@@ -408,7 +408,7 @@ namespace Jack
+             return addr_conv;
+         }
+         fSendAddr.sin_port = htons(fPort);
+-    #if defined(__sun__) || defined(sun)
++    #if defined(__sun__) || defined(sun) || defined(__NetBSD__)
+         if (WaitWrite() < 0) {
+             return -1;
+         }
+@@ -418,7 +418,7 @@ namespace Jack
+ 
+     int JackNetUnixSocket::Send(const void* buffer, size_t nbytes, int flags)
+     {
+-    #if defined(__sun__) || defined(sun)
++    #if defined(__sun__) || defined(sun) || defined(__NetBSD__)
+         if (WaitWrite() < 0) {
+             return -1;
+         }
+@@ -433,7 +433,7 @@ namespace Jack
+     int JackNetUnixSocket::RecvFrom(void* buffer, size_t nbytes, int flags)
+     {
+         socklen_t addr_len = sizeof(socket_address_t);
+-    #if defined(__sun__) || defined(sun)
++    #if defined(__sun__) || defined(sun) || defined(__NetBSD__)
+         if (WaitRead() < 0) {
+             return -1;
+         }
+@@ -447,7 +447,7 @@ namespace Jack
+ 
+     int JackNetUnixSocket::Recv(void* buffer, size_t nbytes, int flags)
+     {
+-    #if defined(__sun__) || defined(sun)
++    #if defined(__sun__) || defined(sun) || defined(__NetBSD__)
+         if (WaitRead() < 0) {
+             return -1;
+         }
+@@ -462,7 +462,7 @@ namespace Jack
+     int JackNetUnixSocket::CatchHost(void* buffer, size_t nbytes, int flags)
+     {
+         socklen_t addr_len = sizeof(socket_address_t);
+-    #if defined(__sun__) || defined(sun)
++    #if defined(__sun__) || defined(sun) || defined(__NetBSD__)
+         if (WaitRead() < 0) {
+             return -1;
+         }
Index: pkgsrc/audio/jack/patches/patch-posix_JackNetUnixSocket.h
diff -u /dev/null pkgsrc/audio/jack/patches/patch-posix_JackNetUnixSocket.h:1.1
--- /dev/null   Wed Sep  8 19:19:20 2021
+++ pkgsrc/audio/jack/patches/patch-posix_JackNetUnixSocket.h   Wed Sep  8 19:19:20 2021
@@ -0,0 +1,15 @@
+$NetBSD: patch-posix_JackNetUnixSocket.h,v 1.1 2021/09/08 19:19:20 nia Exp $
+
+Add NetBSD support.
+
+--- posix/JackNetUnixSocket.h.orig     2021-07-15 06:18:26.000000000 +0000
++++ posix/JackNetUnixSocket.h
+@@ -47,7 +47,7 @@ namespace Jack
+ 
+             struct sockaddr_in fSendAddr;
+             struct sockaddr_in fRecvAddr;
+-        #if defined(__sun__) || defined(sun)
++        #if defined(__sun__) || defined(sun) || defined(__NetBSD__)
+             int WaitRead();
+             int WaitWrite();
+         #endif
Index: pkgsrc/audio/jack/patches/patch-posix_JackPosixSemaphore.cpp
diff -u /dev/null pkgsrc/audio/jack/patches/patch-posix_JackPosixSemaphore.cpp:1.1
--- /dev/null   Wed Sep  8 19:19:20 2021
+++ pkgsrc/audio/jack/patches/patch-posix_JackPosixSemaphore.cpp        Wed Sep  8 19:19:20 2021
@@ -0,0 +1,24 @@
+$NetBSD: patch-posix_JackPosixSemaphore.cpp,v 1.1 2021/09/08 19:19:20 nia Exp $
+
+NetBSD requires POSIX semaphores to be prefixed with
+a slash, see sem_open(3).
+
+--- posix/JackPosixSemaphore.cpp.orig  2021-07-15 06:18:26.000000000 +0000
++++ posix/JackPosixSemaphore.cpp
+@@ -46,13 +46,13 @@ void JackPosixSemaphore::BuildName(const
+ {
+     char ext_client_name[SYNC_MAX_NAME_SIZE + 1];
+     JackTools::RewriteName(client_name, ext_client_name);
+-#if __APPLE__  // POSIX semaphore names are limited to 32 characters... 
++#if __APPLE__  // POSIX semaphore names are limited to 32 characters...
+     snprintf(res, 32, "js_%s", ext_client_name); 
+ #else
+     if (fPromiscuous) {
+-        snprintf(res, size, "jack_sem.%s_%s", server_name, ext_client_name);
++        snprintf(res, size, "/jack_sem.%s_%s", server_name, ext_client_name);
+     } else {
+-        snprintf(res, size, "jack_sem.%d_%s_%s", JackTools::GetUID(), server_name, ext_client_name);
++        snprintf(res, size, "/jack_sem.%d_%s_%s", JackTools::GetUID(), server_name, ext_client_name);
+     }
+ #endif
+ }
Index: pkgsrc/audio/jack/patches/patch-posix_JackSocket.cpp
diff -u /dev/null pkgsrc/audio/jack/patches/patch-posix_JackSocket.cpp:1.1
--- /dev/null   Wed Sep  8 19:19:20 2021
+++ pkgsrc/audio/jack/patches/patch-posix_JackSocket.cpp        Wed Sep  8 19:19:20 2021
@@ -0,0 +1,33 @@
+$NetBSD: patch-posix_JackSocket.cpp,v 1.1 2021/09/08 19:19:20 nia Exp $
+
+Add NetBSD support.
+
+--- posix/JackSocket.cpp.orig  2021-07-15 06:18:26.000000000 +0000
++++ posix/JackSocket.cpp
+@@ -51,7 +51,7 @@ JackClientSocket::JackClientSocket(): Ja
+ JackClientSocket::JackClientSocket(int socket): JackClientRequestInterface(), fSocket(socket),fTimeOut(0), fPromiscuous(false), fPromiscuousGid(-1)
+ {}
+ 
+-#if defined(__sun__) || defined(sun)
++#if defined(__sun__) || defined(sun) || defined(__NetBSD__)
+ 
+ void JackClientSocket::SetReadTimeOut(long sec)
+ {
+@@ -168,7 +168,7 @@ int JackClientSocket::Read(void* data, i
+ {
+     int res;
+ 
+-#if defined(__sun__) || defined(sun)
++#if defined(__sun__) || defined(sun) || defined(__NetBSD__)
+     if (fTimeOut > 0) {
+ 
+         struct timeval tv;
+@@ -214,7 +214,7 @@ int JackClientSocket::Write(void* data, 
+ {
+     int res;
+ 
+-#if defined(__sun__) || defined(sun)
++#if defined(__sun__) || defined(sun) || defined(__NetBSD__)
+     if (fTimeOut > 0) {
+ 
+         struct timeval tv;
Index: pkgsrc/audio/jack/patches/patch-tests_wscript
diff -u /dev/null pkgsrc/audio/jack/patches/patch-tests_wscript:1.1
--- /dev/null   Wed Sep  8 19:19:20 2021
+++ pkgsrc/audio/jack/patches/patch-tests_wscript       Wed Sep  8 19:19:20 2021
@@ -0,0 +1,15 @@
+$NetBSD: patch-tests_wscript,v 1.1 2021/09/08 19:19:20 nia Exp $
+
+Add NetBSD support.
+
+--- tests/wscript.orig 2021-07-15 06:18:26.000000000 +0000
++++ tests/wscript
+@@ -20,6 +20,8 @@ def build(bld):
+             prog.includes = ['..','../macosx', '../posix', '../common/jack', '../common']
+         if bld.env['IS_LINUX']:
+             prog.includes = ['..','../linux', '../posix', '../common/jack', '../common']
++        if bld.env['IS_NETBSD']:
++            prog.includes = ['..','../netbsd', '../posix', '../common/jack', '../common']
+         if bld.env['IS_SUN']:
+             prog.includes = ['..','../solaris', '../posix', '../common/jack', '../common']
+         prog.source = test_program_sources
Index: pkgsrc/audio/jack/patches/patch-tools_wscript
diff -u /dev/null pkgsrc/audio/jack/patches/patch-tools_wscript:1.1
--- /dev/null   Wed Sep  8 19:19:20 2021
+++ pkgsrc/audio/jack/patches/patch-tools_wscript       Wed Sep  8 19:19:20 2021
@@ -0,0 +1,15 @@
+$NetBSD: patch-tools_wscript,v 1.1 2021/09/08 19:19:20 nia Exp $
+
+Add NetBSD support.
+
+--- tools/wscript.orig 2021-07-15 06:18:26.000000000 +0000
++++ tools/wscript
+@@ -30,6 +30,8 @@ def build(bld):
+         os_incdir = ['../macosx', '../posix']
+     if bld.env['IS_SUN']:
+         os_incdir = ['../solaris', '../posix']
++    if bld.env['IS_NETBSD']:
++        os_incdir = ['../netbsd', '../posix']
+     if bld.env['IS_WINDOWS']:
+         os_incdir = ['../windows']
+     for example_tool, example_tool_source in list(example_tools.items()):
Index: pkgsrc/audio/jack/patches/patch-wscript
diff -u /dev/null pkgsrc/audio/jack/patches/patch-wscript:1.1
--- /dev/null   Wed Sep  8 19:19:20 2021
+++ pkgsrc/audio/jack/patches/patch-wscript     Wed Sep  8 19:19:20 2021
@@ -0,0 +1,49 @@
+$NetBSD: patch-wscript,v 1.1 2021/09/08 19:19:20 nia Exp $
+
+Add NetBSD support.
+
+--- wscript.orig       2021-07-15 06:18:26.000000000 +0000
++++ wscript
+@@ -192,6 +192,7 @@ def detect_platform(conf):
+         # ('KEY, 'Human readable name', ['strings', 'to', 'check', 'for'])
+         ('IS_LINUX',   'Linux',   ['gnu0', 'gnukfreebsd', 'linux', 'posix']),
+         ('IS_MACOSX',  'MacOS X', ['darwin']),
++        ('IS_NETBSD',  'NetBSD',  ['netbsd']),
+         ('IS_SUN',     'SunOS',   ['sunos']),
+         ('IS_WINDOWS', 'Windows', ['cygwin', 'msys', 'win32'])
+     ]
+@@ -531,6 +532,9 @@ def obj_add_includes(bld, obj):
+     if bld.env['IS_SUN']:
+         obj.includes += ['posix', 'solaris']
+ 
++    if bld.env['IS_NETBSD']:
++        obj.includes += ['posix', 'netbsd']
++
+     if bld.env['IS_WINDOWS']:
+         obj.includes += ['windows']
+ 
+@@ -678,6 +682,11 @@ def build_drivers(bld):
+         'windows/portaudio/JackPortAudioDriver.cpp',
+     ]
+ 
++    sun_src = [
++        'common/memops.c',
++        'netbsd/sun/JackSunDriver.cpp'
++    ]
++
+     winmme_src = [
+         'windows/winmme/JackWinMMEDriver.cpp',
+         'windows/winmme/JackWinMMEInputPort.cpp',
+@@ -779,6 +788,12 @@ def build_drivers(bld):
+             target = 'oss',
+             source = oss_src)
+ 
++    if bld.env['IS_NETBSD']:
++        create_driver_obj(
++            bld,
++            target = 'sun',
++            source = sun_src)
++
+ def build(bld):
+     if not bld.variant and bld.env['BUILD_WITH_32_64']:
+         Options.commands.append(bld.cmd + '_' + lib32)



Home | Main Index | Thread Index | Old Index