wip/alsa-lib: import alsa-lib-1.2.3.2

Corresponding alsa-utils is not buildable on NetBSD.
This commit is contained in:
Ryo ONODERA 2020-10-08 20:55:55 +09:00
parent 14dc6a572e
commit f59a897bd3
27 changed files with 762 additions and 0 deletions

12
alsa-lib/DESCR Normal file
View File

@ -0,0 +1,12 @@
The Advanced Linux Sound Architecture (ALSA) provides audio and MIDI
functionality to the Linux operating system. ALSA has the following
significant features:
* Efficient support for all types of audio interfaces, from consumer sound
cards to professional multichannel audio interfaces.
* Fully modularized sound drivers.
* SMP and thread-safe design.
* User space library (alsa-lib) to simplify application programming and
provide higher level functionality.
* Support for the older Open Sound System (OSS) API, providing binary
compatibility for most OSS programs.

40
alsa-lib/Makefile Normal file
View File

@ -0,0 +1,40 @@
# $NetBSD: Makefile,v 1.22 2017/06/19 20:46:31 wiz Exp $
DISTNAME= alsa-lib-1.2.3.2
CATEGORIES= audio
MASTER_SITES= ftp://ftp.alsa-project.org/pub/lib/
EXTRACT_SUFX= .tar.bz2
MAINTAINER= pkgsrc-users@NetBSD.org
HOMEPAGE= http://www.alsa-project.org/
COMMENT= Advanced Linux Sound Architecture (ALSA)
LICENSE= gnu-lgpl-v2.1
GNU_CONFIGURE= yes
USE_LANGUAGES= c99
USE_LIBTOOL= yes
USE_TOOLS+= pkg-config gmake
PKGCONFIG_OVERRIDE+= utils/alsa.pc.in
CONFIGURE_ARGS+= --disable-python
CPPFLAGS.SunOS+= -D__EXTENSIONS__ -DBSD_COMP -DMAP_FILE=0
CPPFLAGS.SunOS+= -D_XOPEN_SOURCE=600
#CPPFLAGS.SunOS+= -Du_int8_t=uint8_t -Du_int16_t=uint16_t
#CPPFLAGS.SunOS+= -Du_int32_t=uint32_t -Du_int64_t=uint64_t
#CPPFLAGS.SunOS+= -D__u32=uint32_t -D__u64=uint64_t
#CPPFLAGS.NetBSD+= -D__u32=uint32_t -D__u64=uint64_t
#CPPFLAGS.FreeBSD+= -D__u32=uint32_t -D__u64=uint64_t
LIBS.SunOS+= -lsocket -lnsl
CONFIGURE_ARGS.SunOS+= --without-versioned
BUILDLINK_TRANSFORM.SunOS+= rm:-Wl,--version-script=Versions
.include "../../mk/dlopen.buildlink3.mk"
BUILDLINK_TRANSFORM+= opt:-ldl:${BUILDLINK_LDADD.dl:M*}
.include "../../mk/pthread.buildlink3.mk"
.include "../../mk/bsd.pkg.mk"

131
alsa-lib/PLIST Normal file
View File

@ -0,0 +1,131 @@
@comment $NetBSD$
bin/aserver
include/alsa/asoundef.h
include/alsa/asoundlib.h
include/alsa/conf.h
include/alsa/control.h
include/alsa/control_external.h
include/alsa/error.h
include/alsa/global.h
include/alsa/hwdep.h
include/alsa/input.h
include/alsa/mixer.h
include/alsa/mixer_abst.h
include/alsa/output.h
include/alsa/pcm.h
include/alsa/pcm_external.h
include/alsa/pcm_extplug.h
include/alsa/pcm_ioplug.h
include/alsa/pcm_old.h
include/alsa/pcm_plugin.h
include/alsa/pcm_rate.h
include/alsa/rawmidi.h
include/alsa/seq.h
include/alsa/seq_event.h
include/alsa/seq_midi_event.h
include/alsa/seqmid.h
include/alsa/sound/asoc.h
include/alsa/sound/asound_fm.h
include/alsa/sound/emu10k1.h
include/alsa/sound/hdsp.h
include/alsa/sound/hdspm.h
include/alsa/sound/sb16_csp.h
include/alsa/sound/sscape_ioctl.h
include/alsa/sound/tlv.h
include/alsa/sound/type_compat.h
include/alsa/sound/uapi/asoc.h
include/alsa/sound/uapi/asound_fm.h
include/alsa/sound/uapi/emu10k1.h
include/alsa/sound/uapi/hdsp.h
include/alsa/sound/uapi/hdspm.h
include/alsa/sound/uapi/sb16_csp.h
include/alsa/sound/uapi/sscape_ioctl.h
include/alsa/sound/uapi/tlv.h
include/alsa/timer.h
include/alsa/topology.h
include/alsa/use-case.h
include/alsa/version.h
include/asoundlib.h
include/sys/asoundlib.h
lib/libasound.la
lib/libatopology.la
lib/pkgconfig/alsa-topology.pc
lib/pkgconfig/alsa.pc
share/aclocal/alsa.m4
share/alsa/alsa.conf
share/alsa/cards/AACI.conf
share/alsa/cards/ATIIXP-MODEM.conf
share/alsa/cards/ATIIXP-SPDMA.conf
share/alsa/cards/ATIIXP.conf
share/alsa/cards/AU8810.conf
share/alsa/cards/AU8820.conf
share/alsa/cards/AU8830.conf
share/alsa/cards/Audigy.conf
share/alsa/cards/Audigy2.conf
share/alsa/cards/Aureon51.conf
share/alsa/cards/Aureon71.conf
share/alsa/cards/CA0106.conf
share/alsa/cards/CMI8338-SWIEC.conf
share/alsa/cards/CMI8338.conf
share/alsa/cards/CMI8738-MC6.conf
share/alsa/cards/CMI8738-MC8.conf
share/alsa/cards/CMI8788.conf
share/alsa/cards/CS46xx.conf
share/alsa/cards/EMU10K1.conf
share/alsa/cards/EMU10K1X.conf
share/alsa/cards/ENS1370.conf
share/alsa/cards/ENS1371.conf
share/alsa/cards/ES1968.conf
share/alsa/cards/Echo_Echo3G.conf
share/alsa/cards/FM801.conf
share/alsa/cards/FWSpeakers.conf
share/alsa/cards/FireWave.conf
share/alsa/cards/GUS.conf
share/alsa/cards/HDA-Intel.conf
share/alsa/cards/HdmiLpeAudio.conf
share/alsa/cards/ICE1712.conf
share/alsa/cards/ICE1724.conf
share/alsa/cards/ICH-MODEM.conf
share/alsa/cards/ICH.conf
share/alsa/cards/ICH4.conf
share/alsa/cards/Loopback.conf
share/alsa/cards/Maestro3.conf
share/alsa/cards/NFORCE.conf
share/alsa/cards/PC-Speaker.conf
share/alsa/cards/PMac.conf
share/alsa/cards/PMacToonie.conf
share/alsa/cards/PS3.conf
share/alsa/cards/RME9636.conf
share/alsa/cards/RME9652.conf
share/alsa/cards/SB-XFi.conf
share/alsa/cards/SI7018.conf
share/alsa/cards/TRID4DWAVENX.conf
share/alsa/cards/USB-Audio.conf
share/alsa/cards/VIA686A.conf
share/alsa/cards/VIA8233.conf
share/alsa/cards/VIA8233A.conf
share/alsa/cards/VIA8237.conf
share/alsa/cards/VX222.conf
share/alsa/cards/VXPocket.conf
share/alsa/cards/VXPocket440.conf
share/alsa/cards/YMF744.conf
share/alsa/cards/aliases.conf
share/alsa/cards/pistachio-card.conf
share/alsa/cards/vc4-hdmi.conf
share/alsa/pcm/center_lfe.conf
share/alsa/pcm/default.conf
share/alsa/pcm/dmix.conf
share/alsa/pcm/dpl.conf
share/alsa/pcm/dsnoop.conf
share/alsa/pcm/front.conf
share/alsa/pcm/hdmi.conf
share/alsa/pcm/iec958.conf
share/alsa/pcm/modem.conf
share/alsa/pcm/rear.conf
share/alsa/pcm/side.conf
share/alsa/pcm/surround21.conf
share/alsa/pcm/surround40.conf
share/alsa/pcm/surround41.conf
share/alsa/pcm/surround50.conf
share/alsa/pcm/surround51.conf
share/alsa/pcm/surround71.conf

17
alsa-lib/buildlink3.mk Normal file
View File

@ -0,0 +1,17 @@
# $NetBSD: buildlink3.mk,v 1.5 2018/01/07 13:03:53 rillig Exp $
BUILDLINK_TREE+= alsa-lib
.if !defined(ALSA_LIB_BUILDLINK3_MK)
ALSA_LIB_BUILDLINK3_MK:=
BUILDLINK_API_DEPENDS.alsa-lib+= alsa-lib>=1.0.18
BUILDLINK_PKGSRCDIR.alsa-lib?= ../../audio/alsa-lib
CPPFLAGS.SunOS+= -Du_int8_t=uint8_t -Du_int16_t=uint16_t -Du_int32_t=uint32_t -Du_int64_t=uint64_t
.include "../../mk/dlopen.buildlink3.mk"
.include "../../mk/pthread.buildlink3.mk"
.endif # ALSA_LIB_BUILDLINK3_MK
BUILDLINK_TREE+= -alsa-lib

23
alsa-lib/builtin.mk Normal file
View File

@ -0,0 +1,23 @@
# $NetBSD: builtin.mk,v 1.2 2019/11/02 21:09:12 rillig Exp $
BUILTIN_PKG:= alsa-lib
PKGCONFIG_FILE.alsa-lib= /usr/lib/pkgconfig/alsa.pc
PKGCONFIG_BASE.alsa-lib= /usr
.include "../../mk/buildlink3/pkgconfig-builtin.mk"
###
### The section below only applies if we are not including this file
### solely to determine whether a built-in implementation exists.
###
CHECK_BUILTIN.alsa-lib?= no
.if !empty(CHECK_BUILTIN.alsa-lib:M[nN][oO])
. if !empty(USE_BUILTIN.alsa-lib:M[yY][eE][sS])
BUILDLINK_PREFIX.alsa-lib= /usr
BUILDLINK_FILES.alsa-lib+= lib/pkgconfig/alsa.pc
. endif
.endif # CHECK_BUILTIN.alsa-lib

27
alsa-lib/distinfo Normal file
View File

@ -0,0 +1,27 @@
$NetBSD: distinfo,v 1.28 2017/06/27 15:51:39 jperkin Exp $
SHA1 (alsa-lib-1.2.3.2.tar.bz2) = 2dfe24ae4872c0a390791a515d50de4047eff02b
RMD160 (alsa-lib-1.2.3.2.tar.bz2) = 453431be0a6914c5011d410ed25ec36d90220947
SHA512 (alsa-lib-1.2.3.2.tar.bz2) = 1fbc6360fda841bd9ca488739bdc9f4142c1b4a07ff767f48f1e160e3d4dff914aed422c97088e238b5e77d7e30aa79ff72569c3348a4cf4a412e1e4bce0bf2a
Size (alsa-lib-1.2.3.2.tar.bz2) = 1038591 bytes
SHA1 (patch-ad) = 79a0f048751899247ec12990cd02332b977af248
SHA1 (patch-ae) = 7ad3a3c3ee4be2c80fa6b0a2ea28563efd399a60
SHA1 (patch-af) = 257b06f10616c04c2724e30777b027e5e7e443f9
SHA1 (patch-ah) = 4dd4e27d0dfb6cedf79775b6d01a0b8c6617cdf0
SHA1 (patch-aq) = 29fc896b2acad44e5fa9619aca1df5dddd76fa5e
SHA1 (patch-bg) = b726769272dd214e67f2407ed5a0199189540557
SHA1 (patch-bi) = 7e74ebe53cc2ab273f5235775e391a6ef28d1006
SHA1 (patch-bj) = 5b7a36747e57e41eddb05cd1b1d9771a36b0c4f7
SHA1 (patch-bk) = 55754e4d0ac947c2e7e59b604a21fb5798ae5b39
SHA1 (patch-configure.ac) = cc034d07eab13caa5ff8748e8eea37ae9dd367f5
SHA1 (patch-include_sound_asound.h) = 5d85d804fec62250d2a3e5d269397641e13bc957
SHA1 (patch-include_sound_type__compat.h) = a5dea86a0fd998d35147820269786d2cf8eff5e0
SHA1 (patch-include_sound_uapi_asoc.h) = 5f1da418a2ad4ae066b34c75c9106108711b5d3d
SHA1 (patch-include_sound_uapi_asound.h) = 051616bbbab3339d20818ddb40cde8502295a026
SHA1 (patch-include_type__compat.h) = 3cb245d8ea171f987859e1b5a89b0908c2037492
SHA1 (patch-src_conf.c) = 432e04179798c54a76f5ce072dd9c0b79221df85
SHA1 (patch-src_control_control__hw.c) = 07cfe3abe586b32f6b989403cd162599da07e865
SHA1 (patch-src_pcm_pcm__mmap.c) = 6d2325ebbc029e0b964f3a2de0516705ca8263e2
SHA1 (patch-src_seq_seq__midi__event.c) = cf4ff866cf2cff3e78dc589b43840e16a1cf40b1
SHA1 (patch-src_shmarea.c) = 44e21f48c4cb5d8b82888ea92b7f55b73fcee21a
SHA1 (patch-src_ucm_parser.c) = 57a99eb617eb8e8f290ddd821fe8a4c99506d536

18
alsa-lib/patches/patch-ad Normal file
View File

@ -0,0 +1,18 @@
$NetBSD: patch-ad,v 1.7 2016/04/15 08:47:50 wiz Exp $
--- include/global.h.orig 2015-11-09 07:39:18.000000000 +0000
+++ include/global.h
@@ -30,6 +30,13 @@
/* for timeval and timespec */
#include <time.h>
+#if defined(__FreeBSD__)
+#include <sys/timespec.h>
+#endif
+
+#ifdef __sun
+#include <alloca.h>
+#endif
#ifdef __cplusplus
extern "C" {

33
alsa-lib/patches/patch-ae Normal file
View File

@ -0,0 +1,33 @@
$NetBSD: patch-ae,v 1.9 2016/06/03 15:45:44 jperkin Exp $
- Don't assert GNU ld on Solaris, where it might not be true.
- Add endian compat.
--- include/local.h.orig 2016-03-31 13:10:39.000000000 +0000
+++ include/local.h
@@ -43,6 +43,15 @@
#ifndef __BIG_ENDIAN
#define __BIG_ENDIAN BIG_ENDIAN
#endif
+#elif defined(__sun)
+#include <sys/byteorder.h>
+#define __LITTLE_ENDIAN 1234
+#define __BIG_ENDIAN 4321
+#ifdef _BIG_ENDIAN
+#define __BYTE_ORDER __BIG_ENDIAN
+#else
+#define __BYTE_ORDER __LITTLE_ENDIAN
+#endif
#else
#error Header defining endianness not defined
#endif
@@ -253,7 +262,9 @@ extern snd_lib_error_handler_t snd_err_m
/*
*/
+#ifndef __sun
#define HAVE_GNU_LD
+#endif
#define HAVE_ELF
#define HAVE_ASM_PREVIOUS_DIRECTIVE

22
alsa-lib/patches/patch-af Normal file
View File

@ -0,0 +1,22 @@
$NetBSD: patch-af,v 1.5 2016/04/15 08:47:50 wiz Exp $
--- include/search.h.orig 2008-10-29 08:42:10.000000000 -0400
+++ include/search.h
@@ -20,7 +20,17 @@
#ifndef _SEARCH_H
#define _SEARCH_H 1
+#if !defined(__FreeBSD__) && !defined(__DragonFly__) && !defined(__sun)
#include <features.h>
+#else
+#ifdef __sun
+#define __P(x) x
+#define __BEGIN_DECLS
+#define __END_DECLS
+#endif
+#define __PMT __P
+typedef void * __ptr_t;
+#endif
#define __need_size_t
#include <stddef.h>

13
alsa-lib/patches/patch-ah Normal file
View File

@ -0,0 +1,13 @@
$NetBSD: patch-ah,v 1.4 2016/04/15 08:47:50 wiz Exp $
--- src/pcm/pcm.c.orig 2013-07-08 12:31:36.000000000 +0000
+++ src/pcm/pcm.c
@@ -630,7 +630,7 @@ playback devices.
#include <stdio.h>
#include <string.h>
-#include <malloc.h>
+#include <stdlib.h>
#include <stdarg.h>
#include <signal.h>
#include <ctype.h>

56
alsa-lib/patches/patch-aq Normal file
View File

@ -0,0 +1,56 @@
$NetBSD: patch-aq,v 1.4 2016/04/15 08:47:50 wiz Exp $
--- src/pcm/pcm_hw.c.orig 2020-06-29 10:51:08.000000000 +0000
+++ src/pcm/pcm_hw.c
@@ -278,10 +278,11 @@ static int snd_pcm_hw_nonblock(snd_pcm_t
static int snd_pcm_hw_async(snd_pcm_t *pcm, int sig, pid_t pid)
{
- long flags;
snd_pcm_hw_t *hw = pcm->private_data;
int fd = hw->fd, err;
+#ifndef __sun
+ long flags;
if ((flags = fcntl(fd, F_GETFL)) < 0) {
err = -errno;
SYSMSG("F_GETFL failed (%i)", err);
@@ -296,13 +297,16 @@ static int snd_pcm_hw_async(snd_pcm_t *p
SYSMSG("F_SETFL for O_ASYNC failed (%i)", err);
return err;
}
+#endif
if (sig < 0)
return 0;
+#ifndef __sun
if (fcntl(fd, F_SETSIG, (long)sig) < 0) {
err = -errno;
SYSMSG("F_SETSIG failed (%i)", err);
return err;
}
+#endif
if (fcntl(fd, F_SETOWN, (long)pid) < 0) {
err = -errno;
SYSMSG("F_SETOWN failed (%i)", err);
@@ -1555,8 +1559,10 @@ int snd_pcm_hw_open_fd(snd_pcm_t **pcmp,
mode = 0;
if (fmode & O_NONBLOCK)
mode |= SND_PCM_NONBLOCK;
+#ifndef __sun
if (fmode & O_ASYNC)
mode |= SND_PCM_ASYNC;
+#endif
if (fmode & O_APPEND)
mode |= SND_PCM_APPEND;
@@ -1705,8 +1711,10 @@ int snd_pcm_hw_open(snd_pcm_t **pcmp, co
fmode = O_RDWR;
if (mode & SND_PCM_NONBLOCK)
fmode |= O_NONBLOCK;
+#ifndef __sun
if (mode & SND_PCM_ASYNC)
fmode |= O_ASYNC;
+#endif
if (mode & SND_PCM_APPEND)
fmode |= O_APPEND;
fd = snd_open_device(filename, fmode);

42
alsa-lib/patches/patch-bg Normal file
View File

@ -0,0 +1,42 @@
$NetBSD: patch-bg,v 1.3 2016/04/15 08:47:50 wiz Exp $
--- src/timer/timer_hw.c.orig 2016-03-07 10:09:24.000000000 +0000
+++ src/timer/timer_hw.c
@@ -66,11 +66,14 @@ static int snd_timer_hw_nonblock(snd_tim
static int snd_timer_hw_async(snd_timer_t *timer, int sig, pid_t pid)
{
+#ifndef __sun
long flags;
+#endif
int fd;
assert(timer);
fd = timer->poll_fd;
+#ifndef __sun
if ((flags = fcntl(fd, F_GETFL)) < 0) {
SYSERR("F_GETFL failed");
return -errno;
@@ -83,13 +86,21 @@ static int snd_timer_hw_async(snd_timer_
SYSERR("F_SETFL for O_ASYNC failed");
return -errno;
}
+#endif
if (sig < 0)
return 0;
+#ifndef __sun
#ifdef F_SETSIG
if (fcntl(fd, F_SETSIG, (long)sig) < 0) {
SYSERR("F_SETSIG failed");
return -errno;
- }
+ }
+#else
+ if (fcntl(fd, F_SETFL, O_ASYNC) < 0) {
+ SYSERR("F_SETFL failed");
+ return -errno;
+ }
+#endif
#endif
if (fcntl(fd, F_SETOWN, (long)pid) < 0) {
SYSERR("F_SETOWN failed");

14
alsa-lib/patches/patch-bi Normal file
View File

@ -0,0 +1,14 @@
$NetBSD: patch-bi,v 1.2 2016/04/15 08:47:50 wiz Exp $
For dlopen(), dlclose()...
--- src/pcm/pcm_ladspa.c.orig 2008-12-19 00:06:18.000000000 -0500
+++ src/pcm/pcm_ladspa.c 2008-12-19 00:06:31.000000000 -0500
@@ -33,6 +33,7 @@
*/
#include <dirent.h>
+#include <dlfcn.h>
#include <locale.h>
#include <math.h>
#include "pcm_local.h"

22
alsa-lib/patches/patch-bj Normal file
View File

@ -0,0 +1,22 @@
$NetBSD: patch-bj,v 1.1 2008/12/25 13:18:00 hasso Exp $
--- src/pcm/pcm_direct.c.orig 2008-12-25 07:49:08 +0200
+++ src/pcm/pcm_direct.c 2008-12-25 07:48:37 +0200
@@ -44,7 +44,7 @@
*
*/
-union semun {
+union semun_l {
int val; /* Value for SETVAL */
struct semid_ds *buf; /* Buffer for IPC_STAT, IPC_SET */
unsigned short *array; /* Array for GETALL, SETALL */
@@ -58,7 +58,7 @@ union semun {
int snd_pcm_direct_semaphore_create_or_connect(snd_pcm_direct_t *dmix)
{
- union semun s;
+ union semun_l s;
struct semid_ds buf;
int i;

28
alsa-lib/patches/patch-bk Normal file
View File

@ -0,0 +1,28 @@
$NetBSD: patch-bk,v 1.2 2014/03/25 23:06:07 asau Exp $
--- src/async.c.orig 2008-12-25 08:18:22 +0200
+++ src/async.c 2008-12-25 08:20:39 +0200
@@ -51,6 +51,15 @@ static LIST_HEAD(snd_async_handlers);
static void snd_async_handler(int signo ATTRIBUTE_UNUSED, siginfo_t *siginfo, void *context ATTRIBUTE_UNUSED)
{
+#if defined(__FreeBSD__) || defined(__DragonFly__)
+ /* XXX XXX XXX */
+ struct list_head *i;
+ list_for_each(i, &snd_async_handlers) {
+ snd_async_handler_t *h = list_entry(i, snd_async_handler_t, glist);
+ if (h->callback)
+ h->callback(h);
+ }
+#else
int fd;
struct list_head *i;
//assert(siginfo->si_code == SI_SIGIO);
@@ -60,6 +69,7 @@ static void snd_async_handler(int signo
if (h->fd == fd && h->callback)
h->callback(h);
}
+#endif
}
/**

View File

@ -0,0 +1,20 @@
$NetBSD: patch-configure.ac,v 1.2 2017/05/29 12:42:25 wiz Exp $
--- configure.ac.orig 2020-06-29 10:51:08.000000000 +0000
+++ configure.ac
@@ -732,6 +732,15 @@ AC_OUTPUT(Makefile doc/Makefile doc/pict
test/Makefile test/lsb/Makefile \
utils/Makefile utils/alsa-lib.spec utils/alsa.pc utils/alsa-topology.pc)
+case $host_os in
+ netbsd*|freebsd*|dragonfly*)
+ HAVE_LIBDL=yes
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_LIBDL 1
+_ACEOF
+ ;;
+esac
+
dnl Create asoundlib.h dynamically according to configure options
echo "Creating asoundlib.h..."
cp "$srcdir"/include/asoundlib-head.h include/asoundlib.h

View File

@ -0,0 +1,10 @@
$NetBSD$
--- include/sound/asound.h.orig 2020-06-29 10:51:08.000000000 +0000
+++ include/sound/asound.h
@@ -8,4 +8,5 @@
#define __kernel_long_t long
#endif
+#include <alsa/sound/type_compat.h>
#include <alsa/sound/uapi/asound.h>

View File

@ -0,0 +1,47 @@
$NetBSD$
--- include/sound/type_compat.h.orig 2020-06-29 10:51:08.000000000 +0000
+++ include/sound/type_compat.h
@@ -1,5 +1,5 @@
-#ifndef __TYPE_COMPAT_H
-#define __TYPE_COMPAT_H
+#ifndef __SOUND_TYPE_COMPAT_H
+#define __SOUND_TYPE_COMPAT_H
#ifndef DOC_HIDDEN
#include <stdint.h>
@@ -16,6 +16,20 @@ typedef int32_t __s32;
typedef int64_t __s64;
#include <endian.h>
+#if defined(__NetBSD__)
+#include <machine/bswap.h>
+#if BYTE_ORDER == LITTLE_ENDIAN
+#define __cpu_to_le32(x) (x)
+#define __cpu_to_be32(x) bswap32(x)
+#define __cpu_to_le16(x) (x)
+#define __cpu_to_be16(x) bswap16(x)
+#else
+#define __cpu_to_le32(x) bswap32(x)
+#define __cpu_to_be32(x) (x)
+#define __cpu_to_le16(x) bswap16(x)
+#define __cpu_to_be16(x) (x)
+#endif
+#else
#include <byteswap.h>
#if __BYTE_ORDER == __LITTLE_ENDIAN
#define __cpu_to_le32(x) (x)
@@ -28,6 +42,7 @@ typedef int64_t __s64;
#define __cpu_to_le16(x) bswap_16(x)
#define __cpu_to_be16(x) (x)
#endif
+#endif
#define __le32_to_cpu __cpu_to_le32
#define __be32_to_cpu __cpu_to_be32
@@ -54,4 +69,4 @@ typedef int64_t __s64;
#endif /* DOC_HIDDEN */
-#endif /* __TYPE_COMPAT_H */
+#endif /* __SOUND_TYPE_COMPAT_H */

View File

@ -0,0 +1,14 @@
$NetBSD$
--- include/sound/uapi/asoc.h.orig 2020-06-29 10:51:08.000000000 +0000
+++ include/sound/uapi/asoc.h
@@ -16,7 +16,9 @@
#ifndef __LINUX_UAPI_SND_ASOC_H
#define __LINUX_UAPI_SND_ASOC_H
+#if defined(__linux__)
#include <linux/types.h>
+#endif
/*
* Maximum number of channels topology kcontrol can represent.

View File

@ -0,0 +1,19 @@
$NetBSD$
--- include/sound/uapi/asound.h.orig 2020-06-29 10:51:08.000000000 +0000
+++ include/sound/uapi/asound.h
@@ -545,12 +545,12 @@ struct __snd_pcm_sync_ptr {
} c;
};
-#if defined(__BYTE_ORDER) ? __BYTE_ORDER == __BIG_ENDIAN : defined(__BIG_ENDIAN)
+#if (defined(__BYTE_ORDER) ? __BYTE_ORDER == __BIG_ENDIAN : defined(__BIG_ENDIAN)) || (defined(BYTE_ORDER) ? BYTE_ORDER == BIG_ENDIAN : defined(BIG_ENDIAN))
typedef char __pad_before_uframe[sizeof(__u64) - sizeof(snd_pcm_uframes_t)];
typedef char __pad_after_uframe[0];
#endif
-#if defined(__BYTE_ORDER) ? __BYTE_ORDER == __LITTLE_ENDIAN : defined(__LITTLE_ENDIAN)
+#if defined(__BYTE_ORDER) ? __BYTE_ORDER == __LITTLE_ENDIAN : defined(__LITTLE_ENDIAN) || defined(BYTE_ORDER) ? BYTE_ORDER == LITTLE_ENDIAN : defined(LITTLE_ENDIAN)
typedef char __pad_before_uframe[0];
typedef char __pad_after_uframe[sizeof(__u64) - sizeof(snd_pcm_uframes_t)];
#endif

View File

@ -0,0 +1,14 @@
$NetBSD: patch-include_type__compat.h,v 1.1 2017/02/22 14:48:09 wiz Exp $
--- include/type_compat.h.orig 2016-12-20 14:43:20.000000000 +0000
+++ include/type_compat.h
@@ -29,6 +29,9 @@
#define ESTRPIPE EPIPE
#endif
+#ifndef __u8
+#define __u8 uint8_t
+#endif
#ifndef __u16
#define __u16 uint16_t
#endif

View File

@ -0,0 +1,26 @@
$NetBSD: patch-src_conf.c,v 1.5 2016/04/15 08:47:50 wiz Exp $
* SunOS has no dirent d_type
--- src/conf.c.orig 2015-11-09 07:39:18.000000000 +0000
+++ src/conf.c
@@ -3419,11 +3419,19 @@ static int snd_config_hooks(snd_config_t
static int config_filename_filter(const struct dirent *dirent)
{
+#ifdef __sun
+ struct stat s;
+#endif
size_t flen;
if (dirent == NULL)
return 0;
+#ifdef __sun
+ stat(dirent->d_name, &s);
+ if (s.st_mode & S_IFDIR)
+#else
if (dirent->d_type == DT_DIR)
+#endif
return 0;
flen = strlen(dirent->d_name);

View File

@ -0,0 +1,44 @@
$NetBSD: patch-src_control_control__hw.c,v 1.1 2012/02/15 19:43:51 hans Exp $
--- src/control/control_hw.c.orig 2009-12-16 16:18:51.000000000 +0100
+++ src/control/control_hw.c 2012-01-15 01:48:06.780384687 +0100
@@ -80,10 +80,11 @@ static int snd_ctl_hw_nonblock(snd_ctl_t
static int snd_ctl_hw_async(snd_ctl_t *ctl, int sig, pid_t pid)
{
- long flags;
snd_ctl_hw_t *hw = ctl->private_data;
int fd = hw->fd;
+#ifndef __sun
+ long flags;
if ((flags = fcntl(fd, F_GETFL)) < 0) {
SYSERR("F_GETFL failed");
return -errno;
@@ -96,12 +97,15 @@ static int snd_ctl_hw_async(snd_ctl_t *c
SYSERR("F_SETFL for O_ASYNC failed");
return -errno;
}
+#endif
if (sig < 0)
return 0;
+#ifndef __sun
if (fcntl(fd, F_SETSIG, (long)sig) < 0) {
SYSERR("F_SETSIG failed");
return -errno;
}
+#endif
if (fcntl(fd, F_SETOWN, (long)pid) < 0) {
SYSERR("F_SETOWN failed");
return -errno;
@@ -383,8 +387,10 @@ int snd_ctl_hw_open(snd_ctl_t **handle,
fmode = O_RDWR;
if (mode & SND_CTL_NONBLOCK)
fmode |= O_NONBLOCK;
+#ifndef __sun
if (mode & SND_CTL_ASYNC)
fmode |= O_ASYNC;
+#endif
fd = snd_open_device(filename, fmode);
if (fd < 0) {
snd_card_load(card);

View File

@ -0,0 +1,13 @@
$NetBSD: patch-src_pcm_pcm__mmap.c,v 1.2 2016/02/18 15:15:57 wiz Exp $
--- src/pcm/pcm_mmap.c.orig 2020-06-29 10:51:08.000000000 +0000
+++ src/pcm/pcm_mmap.c
@@ -20,7 +20,7 @@
#include "config.h"
#include <stdio.h>
-#include <malloc.h>
+#include <stdlib.h>
#include <string.h>
#include <poll.h>
#include <sys/mman.h>

View File

@ -0,0 +1,13 @@
$NetBSD: patch-src_seq_seq__midi__event.c,v 1.1 2014/03/25 23:06:07 asau Exp $
--- src/seq/seq_midi_event.c.orig 2020-06-29 10:51:08.000000000 +0000
+++ src/seq/seq_midi_event.c
@@ -28,7 +28,7 @@
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
*/
-#include <malloc.h>
+#include <stdlib.h>
#include "local.h"
#ifndef DOC_HIDDEN

View File

@ -0,0 +1,13 @@
$NetBSD: patch-src_shmarea.c,v 1.2 2016/02/18 15:15:57 wiz Exp $
--- src/shmarea.c.orig 2020-06-29 10:51:08.000000000 +0000
+++ src/shmarea.c
@@ -24,7 +24,7 @@
#ifdef HAVE_SYS_SHM_H
#include <stdio.h>
-#include <malloc.h>
+#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <poll.h>

View File

@ -0,0 +1,31 @@
$NetBSD: patch-src_ucm_parser.c,v 1.7 2017/06/27 15:51:39 jperkin Exp $
* SunOS has no dirent d_type
--- src/ucm/parser.c.orig 2020-06-29 10:51:08.000000000 +0000
+++ src/ucm/parser.c
@@ -2220,7 +2220,13 @@ static int filename_filter(const struct
{
if (dirent == NULL)
return 0;
+#ifdef __sun
+ struct stat s;
+ stat(dirent->d_name, &s);
+ if (s.st_mode & S_IFDIR) {
+#else
if (dirent->d_type == DT_DIR) {
+#endif
if (dirent->d_name[0] == '.') {
if (dirent->d_name[1] == '\0')
return 0;
@@ -2316,8 +2322,10 @@ int uc_mgr_scan_master_configs(const cha
snprintf(fn, sizeof(fn), "%s.conf", d_name);
ucm_filename(filename, sizeof(filename), 2, d_name, fn);
+#if defined(__linux__)
if (eaccess(filename, R_OK))
continue;
+#endif
err = uc_mgr_config_load(2, filename, &cfg);
if (err < 0)