aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTimo Teräs <timo.teras@iki.fi>2013-09-27 14:04:50 +0000
committerTimo Teräs <timo.teras@iki.fi>2013-09-27 14:22:24 +0000
commit392988ed3d9401f39ab7fed37a8d76de993eda8b (patch)
tree3808e3213159e018bebda1b23f66a08152fbb3e6
parent8c1eeed3e8232fde1d7f46153adc5612d1701e35 (diff)
downloadaports-392988ed3d9401f39ab7fed37a8d76de993eda8b.tar.bz2
aports-392988ed3d9401f39ab7fed37a8d76de993eda8b.tar.xz
main/alsa-lib: fix musl build
fix various idiotic constructs. patches are mostly from sabotage, but some I wrote myself too.
-rw-r--r--main/alsa-lib/APKBUILD45
-rw-r--r--main/alsa-lib/alsa-lib-portable-mutex.patch33
-rw-r--r--main/alsa-lib/alsa-lib_kernel_off_t.patch10
-rw-r--r--main/alsa-lib/alsa-lib_mixed_types.patch145
-rw-r--r--main/alsa-lib/alsa-lib_pcm_h.patch25
-rw-r--r--main/alsa-lib/fix-headers.patch45
6 files changed, 297 insertions, 6 deletions
diff --git a/main/alsa-lib/APKBUILD b/main/alsa-lib/APKBUILD
index ab945f67f5..f7f17472a5 100644
--- a/main/alsa-lib/APKBUILD
+++ b/main/alsa-lib/APKBUILD
@@ -1,16 +1,34 @@
# 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"
diff --git a/main/alsa-lib/alsa-lib-portable-mutex.patch b/main/alsa-lib/alsa-lib-portable-mutex.patch
new file mode 100644
index 0000000000..5ef530c38a
--- /dev/null
+++ b/main/alsa-lib/alsa-lib-portable-mutex.patch
@@ -0,0 +1,33 @@
+--- 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);
+ }
+
diff --git a/main/alsa-lib/alsa-lib_kernel_off_t.patch b/main/alsa-lib/alsa-lib_kernel_off_t.patch
new file mode 100644
index 0000000000..5884e8a9cd
--- /dev/null
+++ b/main/alsa-lib/alsa-lib_kernel_off_t.patch
@@ -0,0 +1,10 @@
+--- 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>
+
diff --git a/main/alsa-lib/alsa-lib_mixed_types.patch b/main/alsa-lib/alsa-lib_mixed_types.patch
new file mode 100644
index 0000000000..9869753915
--- /dev/null
+++ b/main/alsa-lib/alsa-lib_mixed_types.patch
@@ -0,0 +1,145 @@
+--- 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 {
diff --git a/main/alsa-lib/alsa-lib_pcm_h.patch b/main/alsa-lib/alsa-lib_pcm_h.patch
new file mode 100644
index 0000000000..1d430da5a9
--- /dev/null
+++ b/main/alsa-lib/alsa-lib_pcm_h.patch
@@ -0,0 +1,25 @@
+--- 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);
diff --git a/main/alsa-lib/fix-headers.patch b/main/alsa-lib/fix-headers.patch
new file mode 100644
index 0000000000..fbb28ee513
--- /dev/null
+++ b/main/alsa-lib/fix-headers.patch
@@ -0,0 +1,45 @@
+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>