Gentoo Archives: gentoo-commits

From: "Anthony G. Basile" <blueness@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/hardened-dev:musl commit in: media-libs/alsa-lib/, media-libs/alsa-lib/files/
Date: Sat, 22 Feb 2014 14:27:32
Message-Id: 1393079284.ebd50f054246ca05a7e3c0452ee261ac5bb82127.blueness@gentoo
1 commit: ebd50f054246ca05a7e3c0452ee261ac5bb82127
2 Author: Felix Janda <felix.janda <AT> posteo <DOT> de>
3 AuthorDate: Sun Feb 16 21:39:07 2014 +0000
4 Commit: Anthony G. Basile <blueness <AT> gentoo <DOT> org>
5 CommitDate: Sat Feb 22 14:28:04 2014 +0000
6 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/hardened-dev.git;a=commit;h=ebd50f05
7
8 media-libs/alsa-lib: move to tree
9
10 ---
11 media-libs/alsa-lib/alsa-lib-1.0.27.1-r99.ebuild | 79 ++++++++++++++++++++++
12 .../alsa-lib/files/alsa-lib-1.0.25-pcm-h.patch | 27 ++++++++
13 .../alsa-lib/files/alsa-lib-1.0.27.1-musl.patch | 24 +++++++
14 .../alsa-lib/files/alsa-lib-1.0.27.1-rewind.patch | 40 +++++++++++
15 .../files/alsa-lib-1.0.27.2-portable-mutex.patch | 35 ++++++++++
16 media-libs/alsa-lib/metadata.xml | 14 ++++
17 6 files changed, 219 insertions(+)
18
19 diff --git a/media-libs/alsa-lib/alsa-lib-1.0.27.1-r99.ebuild b/media-libs/alsa-lib/alsa-lib-1.0.27.1-r99.ebuild
20 new file mode 100644
21 index 0000000..7f8b983
22 --- /dev/null
23 +++ b/media-libs/alsa-lib/alsa-lib-1.0.27.1-r99.ebuild
24 @@ -0,0 +1,79 @@
25 +# Copyright 1999-2013 Gentoo Foundation
26 +# Distributed under the terms of the GNU General Public License v2
27 +# $Header: /var/cvsroot/gentoo-x86/media-libs/alsa-lib/alsa-lib-1.0.27.1.ebuild,v 1.15 2013/09/01 18:36:03 ago Exp $
28 +
29 +EAPI=5
30 +
31 +# no support for python3_2 or above yet wrt #471326
32 +PYTHON_COMPAT=( python2_7 )
33 +
34 +inherit autotools eutils multilib python-single-r1
35 +
36 +DESCRIPTION="Advanced Linux Sound Architecture Library"
37 +HOMEPAGE="http://www.alsa-project.org/"
38 +SRC_URI="mirror://alsaproject/lib/${P}.tar.bz2"
39 +
40 +LICENSE="LGPL-2.1"
41 +SLOT="0"
42 +KEYWORDS="amd64 arm x86"
43 +IUSE="doc debug alisp python"
44 +
45 +RDEPEND="python? ( ${PYTHON_DEPS} )"
46 +DEPEND="${RDEPEND}
47 + doc? ( >=app-doc/doxygen-1.2.6 )"
48 +
49 +pkg_setup() {
50 + use python && python-single-r1_pkg_setup
51 +}
52 +
53 +src_prepare() {
54 + find . -name Makefile.am -exec sed -i -e '/CFLAGS/s:-g -O2::' {} + || die
55 + # force use of correct python-config wrt #478802
56 + if [[ ${ABI} == ${DEFAULT_ABI} ]]; then
57 + use python && { sed -i -e "s:python-config:$EPYTHON-config:" configure.in || die; }
58 + fi
59 + epatch "${FILESDIR}"/${P}-rewind.patch #477282
60 + epatch "${FILESDIR}"/${P}-musl.patch
61 + epatch "${FILESDIR}"/${PN}-1.0.25-pcm-h.patch
62 + epatch "${FILESDIR}"/${PN}-1.0.27.2-portable-mutex.patch
63 + epatch_user
64 + eautoreconf
65 +}
66 +
67 +src_configure() {
68 + local myconf
69 + use elibc_uclibc && myconf="--without-versioned"
70 +
71 + ECONF_SOURCE=${S} \
72 + econf \
73 + --disable-maintainer-mode \
74 + --enable-shared \
75 + --disable-resmgr \
76 + --enable-rawmidi \
77 + --enable-seq \
78 + --enable-aload \
79 + $(use_with debug) \
80 + $(use_enable alisp) \
81 + $(use_enable python) \
82 + ${myconf}
83 +}
84 +
85 +src_compile() {
86 + emake
87 +
88 + if use doc; then
89 + emake doc
90 + fgrep -Zrl "${S}" doc/doxygen/html | \
91 + xargs -0 sed -i -e "s:${S}::"
92 + fi
93 +}
94 +
95 +src_install() {
96 + emake DESTDIR="${D}" install
97 + if use doc; then
98 + dohtml -r doc/doxygen/html/.
99 + fi
100 + prune_libtool_files --all
101 + find "${ED}"/usr/$(get_libdir)/alsa-lib -name '*.a' -exec rm -f {} +
102 + dodoc ChangeLog doc/asoundrc.txt NOTES TODO
103 +}
104
105 diff --git a/media-libs/alsa-lib/files/alsa-lib-1.0.25-pcm-h.patch b/media-libs/alsa-lib/files/alsa-lib-1.0.25-pcm-h.patch
106 new file mode 100644
107 index 0000000..7d6dc13
108 --- /dev/null
109 +++ b/media-libs/alsa-lib/files/alsa-lib-1.0.25-pcm-h.patch
110 @@ -0,0 +1,27 @@
111 +taken from sabotage linux
112 +
113 +--- alsa-lib-1.0.25/include/pcm.h
114 ++++ alsa-lib-1.0.25.patched/include/pcm.h
115 +@@ -33,6 +33,7 @@
116 + extern "C" {
117 + #endif
118 +
119 ++#include <stdint.h>
120 + /**
121 + * \defgroup PCM PCM Interface
122 + * See the \ref pcm page for more details.
123 +@@ -941,10 +942,10 @@
124 + int snd_pcm_format_physical_width(snd_pcm_format_t format); /* in bits */
125 + snd_pcm_format_t snd_pcm_build_linear_format(int width, int pwidth, int unsignd, int big_endian);
126 + ssize_t snd_pcm_format_size(snd_pcm_format_t format, size_t samples);
127 +-u_int8_t snd_pcm_format_silence(snd_pcm_format_t format);
128 +-u_int16_t snd_pcm_format_silence_16(snd_pcm_format_t format);
129 +-u_int32_t snd_pcm_format_silence_32(snd_pcm_format_t format);
130 +-u_int64_t snd_pcm_format_silence_64(snd_pcm_format_t format);
131 ++uint8_t snd_pcm_format_silence(snd_pcm_format_t format);
132 ++uint16_t snd_pcm_format_silence_16(snd_pcm_format_t format);
133 ++uint32_t snd_pcm_format_silence_32(snd_pcm_format_t format);
134 ++uint64_t snd_pcm_format_silence_64(snd_pcm_format_t format);
135 + int snd_pcm_format_set_silence(snd_pcm_format_t format, void *buf, unsigned int samples);
136 +
137 + snd_pcm_sframes_t snd_pcm_bytes_to_frames(snd_pcm_t *pcm, ssize_t bytes);
138
139 diff --git a/media-libs/alsa-lib/files/alsa-lib-1.0.27.1-musl.patch b/media-libs/alsa-lib/files/alsa-lib-1.0.27.1-musl.patch
140 new file mode 100644
141 index 0000000..0521fe0
142 --- /dev/null
143 +++ b/media-libs/alsa-lib/files/alsa-lib-1.0.27.1-musl.patch
144 @@ -0,0 +1,24 @@
145 +diff -ur a/alsa-lib-1.0.27.1/configure.in b/alsa-lib-1.0.27.1/configure.in
146 +--- a/alsa-lib-1.0.27.1/configure.in 2013-05-21 08:48:28.000000000 +0000
147 ++++ b/alsa-lib-1.0.27.1/configure.in 2014-02-16 21:04:29.833236371 +0000
148 +@@ -64,7 +64,7 @@
149 +
150 + dnl Checks for library functions.
151 + AC_PROG_GCC_TRADITIONAL
152 +-AC_CHECK_FUNC([hsearch_r], [HAVE_HSEARCH_R=yes])
153 ++AC_CHECK_FUNC([hsearch], [HAVE_HSEARCH_R=yes])
154 + AM_CONDITIONAL([ALSA_HSEARCH_R], [test "x$HAVE_HSEARCH_R" != xyes])
155 + AC_CHECK_FUNCS([uselocale])
156 +
157 +diff -ur a/alsa-lib-1.0.27.1/include/global.h b/alsa-lib-1.0.27.1/include/global.h
158 +--- a/alsa-lib-1.0.27.1/include/global.h 2013-05-21 08:48:28.000000000 +0000
159 ++++ b/alsa-lib-1.0.27.1/include/global.h 2014-02-16 20:08:10.954478169 +0000
160 +@@ -133,7 +133,7 @@
161 +
162 + int snd_user_file(const char *file, char **result);
163 +
164 +-#if !defined(_POSIX_C_SOURCE) && !defined(_POSIX_SOURCE)
165 ++#if 0
166 + struct timeval {
167 + time_t tv_sec; /* seconds */
168 + long tv_usec; /* microseconds */
169
170 diff --git a/media-libs/alsa-lib/files/alsa-lib-1.0.27.1-rewind.patch b/media-libs/alsa-lib/files/alsa-lib-1.0.27.1-rewind.patch
171 new file mode 100644
172 index 0000000..f585645
173 --- /dev/null
174 +++ b/media-libs/alsa-lib/files/alsa-lib-1.0.27.1-rewind.patch
175 @@ -0,0 +1,40 @@
176 +From f2d39afe6139ab16aa2aeea0f51f32db79ab1262 Mon Sep 17 00:00:00 2001
177 +From: David Henningsson <david.henningsson@×××××××××.com>
178 +Date: Thu, 30 May 2013 12:26:34 +0200
179 +Subject: [PATCH] pcm_plugin: Fix return value of snd_pcm_rewind
180 +
181 +In case the rewind did not rewind as much as expected, e g due to
182 +time delay between the latest avail update and the rewind, we must
183 +properly account for that in the plugin layer.
184 +
185 +Otherwise, the plugin's appl ptr and the hw's appl ptr become
186 +unsynchronised, which is very bad, especially in mmap_shadow plugins,
187 +e g, this could cause the overlapping memcpy in the softvol plugin
188 +as seen here:
189 +https://bugs.freedesktop.org/show_bug.cgi?id=64299
190 +
191 +Signed-off-by: David Henningsson <david.henningsson@×××××××××.com>
192 +Signed-off-by: Jaroslav Kysela <perex@×××××.cz>
193 +---
194 + src/pcm/pcm_plugin.c | 4 ++--
195 + 1 file changed, 2 insertions(+), 2 deletions(-)
196 +
197 +diff --git a/src/pcm/pcm_plugin.c b/src/pcm/pcm_plugin.c
198 +index 96218a8..17157e8 100644
199 +--- a/src/pcm/pcm_plugin.c
200 ++++ b/src/pcm/pcm_plugin.c
201 +@@ -219,9 +219,9 @@ static snd_pcm_sframes_t snd_pcm_plugin_rewind(snd_pcm_t *pcm, snd_pcm_uframes_t
202 + snd_atomic_write_end(&plugin->watom);
203 + return sframes;
204 + }
205 +- snd_pcm_mmap_appl_backward(pcm, (snd_pcm_uframes_t) frames);
206 ++ snd_pcm_mmap_appl_backward(pcm, (snd_pcm_uframes_t) sframes);
207 + snd_atomic_write_end(&plugin->watom);
208 +- return (snd_pcm_sframes_t) frames;
209 ++ return (snd_pcm_sframes_t) sframes;
210 + }
211 +
212 + static snd_pcm_sframes_t snd_pcm_plugin_forwardable(snd_pcm_t *pcm)
213 +--
214 +1.7.11.7
215 +
216
217 diff --git a/media-libs/alsa-lib/files/alsa-lib-1.0.27.2-portable-mutex.patch b/media-libs/alsa-lib/files/alsa-lib-1.0.27.2-portable-mutex.patch
218 new file mode 100644
219 index 0000000..c4f90d2
220 --- /dev/null
221 +++ b/media-libs/alsa-lib/files/alsa-lib-1.0.27.2-portable-mutex.patch
222 @@ -0,0 +1,35 @@
223 +taken from sabotage linux
224 +
225 +--- alsa-lib-1.0.27.2.orig/src/conf.c
226 ++++ alsa-lib-1.0.27.2/src/conf.c
227 +@@ -427,8 +427,8 @@
228 + #ifndef DOC_HIDDEN
229 +
230 + #ifdef HAVE_LIBPTHREAD
231 +-static pthread_mutex_t snd_config_update_mutex =
232 +- PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP;
233 ++static pthread_mutex_t snd_config_update_mutex;
234 ++static pthread_once_t snd_config_update_mutex_once = PTHREAD_ONCE_INIT;
235 + #endif
236 +
237 + struct _snd_config {
238 +@@ -472,8 +472,19 @@
239 +
240 + #ifdef HAVE_LIBPTHREAD
241 +
242 ++static void snd_config_init_mutex(void)
243 ++{
244 ++ pthread_mutexattr_t attr;
245 ++
246 ++ pthread_mutexattr_init(&attr);
247 ++ pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
248 ++ pthread_mutex_init(&snd_config_update_mutex, &attr);
249 ++ pthread_mutexattr_destroy(&attr);
250 ++}
251 ++
252 + static inline void snd_config_lock(void)
253 + {
254 ++ pthread_once(&snd_config_update_mutex_once, snd_config_init_mutex);
255 + pthread_mutex_lock(&snd_config_update_mutex);
256 + }
257 +
258
259 diff --git a/media-libs/alsa-lib/metadata.xml b/media-libs/alsa-lib/metadata.xml
260 new file mode 100644
261 index 0000000..0ea67ae
262 --- /dev/null
263 +++ b/media-libs/alsa-lib/metadata.xml
264 @@ -0,0 +1,14 @@
265 +<?xml version="1.0" encoding="UTF-8"?>
266 +<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
267 +<pkgmetadata>
268 + <herd>alsa</herd>
269 + <maintainer>
270 + <email>alsa-bugs@g.o</email>
271 + </maintainer>
272 + <use>
273 + <flag name="alisp">Enable support for ALISP (ALSA LISP) interpreter for advanced features.</flag>
274 + </use>
275 + <upstream>
276 + <remote-id type="cpe">cpe:/a:alsa-project:alsa-lib</remote-id>
277 + </upstream>
278 +</pkgmetadata>