Commit 392988ed authored by Timo Teräs's avatar Timo Teräs

main/alsa-lib: fix musl build

fix various idiotic constructs. patches are mostly from sabotage,
but some I wrote myself too.
parent 8c1eeed3
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=alsa-lib
pkgver=1.0.27.2
pkgrel=0
pkgrel=1
pkgdesc="An alternative implementation of Linux sound support"
url="http://www.alsa-project.org"
arch="all"
license="GPL"
depends=
subpackages="$pkgname-dev"
source="http://alsa.cybermirror.org/lib/$pkgname-$pkgver.tar.bz2"
source="http://alsa.cybermirror.org/lib/$pkgname-$pkgver.tar.bz2
alsa-lib_pcm_h.patch
alsa-lib_mixed_types.patch
alsa-lib_kernel_off_t.patch
alsa-lib-portable-mutex.patch
fix-headers.patch"
_builddir="$srcdir/$pkgname-$pkgver"
prepare() {
cd "$_builddir"
update_config_sub || return 1
rm src/compat/hsearch_r.c && touch src/compat/hsearch_r.c
for i in $source; do
case $i in
*.patch) msg $i; patch -p1 -i "$srcdir"/$i || return 1;;
esac
done
}
build() {
cd "$srcdir/$pkgname-$pkgver"
cd "$_builddir"
./configure \
--build=$CBUILD \
--host=$CHOST \
......@@ -33,6 +51,21 @@ package() {
find "$pkgdir" -iname *.la -delete
}
md5sums="69129a7c37697f81ac092335e9fa452b alsa-lib-1.0.27.2.tar.bz2"
sha256sums="690ed393e7efd4fc7e3a2d2cda5449298ca0c895197e5914e350882012430d19 alsa-lib-1.0.27.2.tar.bz2"
sha512sums="3fa9160e001cf21ddc6332c3748f8aa27bd1b514616fd1a9993c34128fe99d07e2dfc5f1a9177e1c17456d1361496f90bf3552f940fd85c6ea5ac9bbc30fe8ce alsa-lib-1.0.27.2.tar.bz2"
md5sums="69129a7c37697f81ac092335e9fa452b alsa-lib-1.0.27.2.tar.bz2
4018a2f02d7c93935b6a8fa0bc3f2191 alsa-lib_pcm_h.patch
d949fb5ff425e70f1896f7231f30469e alsa-lib_mixed_types.patch
1c730d98856f5753c8a12794e616b543 alsa-lib_kernel_off_t.patch
53be16ad5e552d62730dd8386f32569d alsa-lib-portable-mutex.patch
c5cd635119b71c97bad48590fb629cda fix-headers.patch"
sha256sums="690ed393e7efd4fc7e3a2d2cda5449298ca0c895197e5914e350882012430d19 alsa-lib-1.0.27.2.tar.bz2
faa8efc9b2e5d110d0daffe473c86efcbc6305a7eafd016b1334581db466dbdf alsa-lib_pcm_h.patch
ac2b77959404ea81d2f1a539c9c0e9e15b5c2c452285712aa10b6f8da8f9eefa alsa-lib_mixed_types.patch
ec7a8cb2b82d59b137f40df9e6bc3de1519a150c7c2718f9906b721ef4fd6e63 alsa-lib_kernel_off_t.patch
fa2ada95443835aead2e3a5a23262242885f4b1297779d94c3545aa137b05858 alsa-lib-portable-mutex.patch
41bb087abf85f194357c2926d7cd87c973c06649d4ef449907188b555e8d1a72 fix-headers.patch"
sha512sums="3fa9160e001cf21ddc6332c3748f8aa27bd1b514616fd1a9993c34128fe99d07e2dfc5f1a9177e1c17456d1361496f90bf3552f940fd85c6ea5ac9bbc30fe8ce alsa-lib-1.0.27.2.tar.bz2
0ea37cda27b440c82f0bc0e34f67d423678d348874c18063036e4347f961bbbce4074ed0aaa518d25d0cedd73818e66e1cbc30c6ff4bf9e6479f64012df0199c alsa-lib_pcm_h.patch
990d83a761958f350749fda57def15c73890afeae4fa303dc6af36c453a723a2c98d3cf8f44344da539e6c3224d96bfa91861e59126ec2a3d97dc4c0f36fbc61 alsa-lib_mixed_types.patch
800362bbc8823afdd04480c319c2a9a2d8823712197e8c59af4c4ef80602435aace12a75fcdf5a9824d01e16397568636141980bff08f098f1ad4b794486834e alsa-lib_kernel_off_t.patch
6bacd0db2be2140150cecc31062726c9ec3a367cf6da114828ae98dace2233b2ac4c7bc74318e125aa7eafbb3085fecc017ac51b7414546b2803230d610bb925 alsa-lib-portable-mutex.patch
c8fa7c619d8e464fb0fe8f6b11b7dc77af14b42b4709b81613688be1e348e0c81efa64cd3176c1b3d2a77cb40043e091e27a6e06bbc99f177199fc0ddc502c26 fix-headers.patch"
--- alsa-lib-1.0.27.2.orig/src/conf.c
+++ alsa-lib-1.0.27.2/src/conf.c
@@ -427,8 +427,8 @@
#ifndef DOC_HIDDEN
#ifdef HAVE_LIBPTHREAD
-static pthread_mutex_t snd_config_update_mutex =
- PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP;
+static pthread_mutex_t snd_config_update_mutex;
+static pthread_once_t snd_config_update_mutex_once = PTHREAD_ONCE_INIT;
#endif
struct _snd_config {
@@ -472,8 +472,19 @@
#ifdef HAVE_LIBPTHREAD
+static void snd_config_init_mutex(void)
+{
+ pthread_mutexattr_t attr;
+
+ pthread_mutexattr_init(&attr);
+ pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
+ pthread_mutex_init(&snd_config_update_mutex, &attr);
+ pthread_mutexattr_destroy(&attr);
+}
+
static inline void snd_config_lock(void)
{
+ pthread_once(&snd_config_update_mutex_once, snd_config_init_mutex);
pthread_mutex_lock(&snd_config_update_mutex);
}
--- alsa-lib-1.0.27.2.org/include/local.h
+++ alsa-lib-1.0.27.2/include/local.h
@@ -116,7 +116,6 @@
/* kill and replace kernel-specific types */
#define __user
#define __force
-#define __kernel_off_t off_t
#include <sound/asound.h>
--- alsa-lib-1.0.25.orig/src/pcm/pcm_misc.c 2013-07-22 23:16:24.942000003 +0000
+++ alsa-lib-1.0.25/src/pcm/pcm_misc.c 2013-07-22 23:18:34.345000003 +0000
@@ -363,7 +363,7 @@
* \param format Sample format
* \return silence 64 bit word
*/
-u_int64_t snd_pcm_format_silence_64(snd_pcm_format_t format)
+uint64_t snd_pcm_format_silence_64(snd_pcm_format_t format)
{
switch (format) {
case SNDRV_PCM_FORMAT_S8:
@@ -437,7 +437,7 @@
{
union {
float f[2];
- u_int64_t i;
+ uint64_t i;
} u;
u.f[0] = u.f[1] = 0.0;
#ifdef SNDRV_LITTLE_ENDIAN
@@ -450,7 +450,7 @@
{
union {
double f;
- u_int64_t i;
+ uint64_t i;
} u;
u.f = 0.0;
#ifdef SNDRV_LITTLE_ENDIAN
@@ -463,7 +463,7 @@
{
union {
float f[2];
- u_int64_t i;
+ uint64_t i;
} u;
u.f[0] = u.f[1] = 0.0;
#ifdef SNDRV_LITTLE_ENDIAN
@@ -476,7 +476,7 @@
{
union {
double f;
- u_int64_t i;
+ uint64_t i;
} u;
u.f = 0.0;
#ifdef SNDRV_LITTLE_ENDIAN
@@ -509,10 +509,10 @@
* \param format Sample format
* \return silence 32 bit word
*/
-u_int32_t snd_pcm_format_silence_32(snd_pcm_format_t format)
+uint32_t snd_pcm_format_silence_32(snd_pcm_format_t format)
{
assert(snd_pcm_format_physical_width(format) <= 32);
- return (u_int32_t)snd_pcm_format_silence_64(format);
+ return (uint32_t)snd_pcm_format_silence_64(format);
}
/**
@@ -520,10 +520,10 @@
* \param format Sample format
* \return silence 16 bit word
*/
-u_int16_t snd_pcm_format_silence_16(snd_pcm_format_t format)
+uint16_t snd_pcm_format_silence_16(snd_pcm_format_t format)
{
assert(snd_pcm_format_physical_width(format) <= 16);
- return (u_int16_t)snd_pcm_format_silence_64(format);
+ return (uint16_t)snd_pcm_format_silence_64(format);
}
/**
@@ -531,10 +531,10 @@
* \param format Sample format
* \return silence 8 bit word
*/
-u_int8_t snd_pcm_format_silence(snd_pcm_format_t format)
+uint8_t snd_pcm_format_silence(snd_pcm_format_t format)
{
assert(snd_pcm_format_physical_width(format) <= 8);
- return (u_int8_t)snd_pcm_format_silence_64(format);
+ return (uint8_t)snd_pcm_format_silence_64(format);
}
/**
@@ -550,7 +550,7 @@
return 0;
switch (snd_pcm_format_physical_width(format)) {
case 4: {
- u_int8_t silence = snd_pcm_format_silence_64(format);
+ uint8_t silence = snd_pcm_format_silence_64(format);
unsigned int samples1;
if (samples % 2 != 0)
return -EINVAL;
@@ -559,13 +559,13 @@
break;
}
case 8: {
- u_int8_t silence = snd_pcm_format_silence_64(format);
+ uint8_t silence = snd_pcm_format_silence_64(format);
memset(data, silence, samples);
break;
}
case 16: {
- u_int16_t silence = snd_pcm_format_silence_64(format);
- u_int16_t *pdata = (u_int16_t *)data;
+ uint16_t silence = snd_pcm_format_silence_64(format);
+ uint16_t *pdata = (uint16_t *)data;
if (! silence)
memset(data, 0, samples * 2);
else {
@@ -575,8 +575,8 @@
break;
}
case 24: {
- u_int32_t silence = snd_pcm_format_silence_64(format);
- u_int8_t *pdata = (u_int8_t *)data;
+ uint32_t silence = snd_pcm_format_silence_64(format);
+ uint8_t *pdata = (uint8_t *)data;
if (! silence)
memset(data, 0, samples * 3);
else {
@@ -595,8 +595,8 @@
break;
}
case 32: {
- u_int32_t silence = snd_pcm_format_silence_64(format);
- u_int32_t *pdata = (u_int32_t *)data;
+ uint32_t silence = snd_pcm_format_silence_64(format);
+ uint32_t *pdata = (uint32_t *)data;
if (! silence)
memset(data, 0, samples * 4);
else {
@@ -606,8 +606,8 @@
break;
}
case 64: {
- u_int64_t silence = snd_pcm_format_silence_64(format);
- u_int64_t *pdata = (u_int64_t *)data;
+ uint64_t silence = snd_pcm_format_silence_64(format);
+ uint64_t *pdata = (uint64_t *)data;
if (! silence)
memset(data, 0, samples * 8);
else {
--- alsa-lib-1.0.25/include/pcm.h
+++ alsa-lib-1.0.25.patched/include/pcm.h
@@ -33,6 +33,7 @@
extern "C" {
#endif
+#include <stdint.h>
/**
* \defgroup PCM PCM Interface
* See the \ref pcm page for more details.
@@ -941,10 +942,10 @@
int snd_pcm_format_physical_width(snd_pcm_format_t format); /* in bits */
snd_pcm_format_t snd_pcm_build_linear_format(int width, int pwidth, int unsignd, int big_endian);
ssize_t snd_pcm_format_size(snd_pcm_format_t format, size_t samples);
-u_int8_t snd_pcm_format_silence(snd_pcm_format_t format);
-u_int16_t snd_pcm_format_silence_16(snd_pcm_format_t format);
-u_int32_t snd_pcm_format_silence_32(snd_pcm_format_t format);
-u_int64_t snd_pcm_format_silence_64(snd_pcm_format_t format);
+uint8_t snd_pcm_format_silence(snd_pcm_format_t format);
+uint16_t snd_pcm_format_silence_16(snd_pcm_format_t format);
+uint32_t snd_pcm_format_silence_32(snd_pcm_format_t format);
+uint64_t snd_pcm_format_silence_64(snd_pcm_format_t format);
int snd_pcm_format_set_silence(snd_pcm_format_t format, void *buf, unsigned int samples);
snd_pcm_sframes_t snd_pcm_bytes_to_frames(snd_pcm_t *pcm, ssize_t bytes);
Common subdirectories: alsa-lib-1.0.27.2.orig/include/alsa and alsa-lib-1.0.27.2/include/alsa
--- alsa-lib-1.0.27.2.orig/include/global.h
+++ alsa-lib-1.0.27.2/include/global.h
@@ -133,18 +133,6 @@
int snd_user_file(const char *file, char **result);
-#if !defined(_POSIX_C_SOURCE) && !defined(_POSIX_SOURCE)
-struct timeval {
- time_t tv_sec; /* seconds */
- long tv_usec; /* microseconds */
-};
-
-struct timespec {
- time_t tv_sec; /* seconds */
- long tv_nsec; /* nanoseconds */
-};
-#endif
-
/** Timestamp */
typedef struct timeval snd_timestamp_t;
/** Hi-res timestamp */
--- alsa-lib-1.0.27.2.orig/include/local.h
+++ alsa-lib-1.0.27.2/include/local.h
@@ -30,7 +30,7 @@
#include <assert.h>
#include <endian.h>
#include <stdarg.h>
-#include <sys/poll.h>
+#include <poll.h>
#include <errno.h>
#include <linux/ioctl.h>
Common subdirectories: alsa-lib-1.0.27.2.orig/include/sound and alsa-lib-1.0.27.2/include/sound
--- alsa-lib-1.0.27.2/src/shmarea.c.orig
+++ alsa-lib-1.0.27.2/src/shmarea.c
@@ -19,7 +19,7 @@
*/
#include <stdio.h>
-#include <malloc.h>
+#include <stdlib.h>
#include <string.h>
#include <errno.h>
#include <sys/poll.h>
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment