commit:     a7d86faf81d3ea5b46abf91cd030ab9992928b78
Author:     Daniel Campbell <zlg <AT> gentoo <DOT> org>
AuthorDate: Mon Aug 24 09:40:43 2015 +0000
Commit:     Daniel Campbell <zlg <AT> gentoo <DOT> org>
CommitDate: Mon Aug 24 09:40:43 2015 +0000
URL:        https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=a7d86faf

media-sound/apulse: Revbump to 0.1.6-r1

Introduces script to automagically assign libdir based on the
executable being passed through to apulse. Will need expansion
if/when arches besides x86 and amd64 need apulse.

Bug: 547524

Package-Manager: portage-2.2.20.1

 media-sound/apulse/apulse-0.1.6-r1.ebuild | 33 +++++++++++++++++++++++++
 media-sound/apulse/files/apulse           | 40 +++++++++++++++++++++++++++++++
 2 files changed, 73 insertions(+)

diff --git a/media-sound/apulse/apulse-0.1.6-r1.ebuild 
b/media-sound/apulse/apulse-0.1.6-r1.ebuild
new file mode 100644
index 0000000..2f68179
--- /dev/null
+++ b/media-sound/apulse/apulse-0.1.6-r1.ebuild
@@ -0,0 +1,33 @@
+# Copyright 1999-2015 Gentoo Foundation
+# Distributed under the terms of the GNU General Public License v2
+# $Id$
+
+EAPI=5
+
+inherit multilib cmake-multilib
+
+DESCRIPTION="PulseAudio emulation for ALSA"
+HOMEPAGE="https://github.com/i-rinat/apulse";
+SRC_URI="https://github.com/i-rinat/${PN}/archive/v${PV}.tar.gz -> ${P}.tar.gz"
+
+LICENSE="MIT LGPL-2.1"
+SLOT="0"
+KEYWORDS="~amd64 ~x86"
+
+DEPEND="dev-libs/glib:2[${MULTILIB_USEDEP}]
+       media-libs/alsa-lib[${MULTILIB_USEDEP}]"
+RDEPEND="${DEPEND}
+       !!media-plugins/alsa-plugins[pulseaudio]"
+
+MULTILIB_CHOST_TOOLS=( /usr/bin/apulse )
+
+multilib_src_configure() {
+       local mycmakeargs="-DAPULSEPATH=${EPREFIX}/usr/$(get_libdir)/apulse"
+
+       cmake-utils_src_configure
+}
+
+multilib_src_install() {
+       cmake-utils_src_install
+       dobin "${FILESDIR}"/apulse
+}

diff --git a/media-sound/apulse/files/apulse b/media-sound/apulse/files/apulse
new file mode 100755
index 0000000..f419565
--- /dev/null
+++ b/media-sound/apulse/files/apulse
@@ -0,0 +1,40 @@
+#!/bin/sh
+# Author:  Daniel Campbell <z...@gentoo.org>
+# License: Creative Commons Public Domain Dedication (CC0 1.0)
+#          <https://creativecommons.org/publicdomain/zero/1.0/>
+
+# apulse needs at least one argument
+if [ $# -lt 1 ]; then
+       echo "Usage: apulse <app-path> [options]"
+       exit
+fi
+
+# Get the full path of our application
+app_path=$(which ${1} 2>/dev/null)
+
+# The app might not be picked up by `which`, so let's use realpath as a backup
+[ -z ${app_path} ] && app_path=$(realpath ${1})
+
+# Then make sure it's executable
+[ ! -x ${app_path} ] && echo "${app_path} is not executable!" && exit 8
+
+# Fetch the app's ABI
+app_abi=$(file -L ${app_path} | sed 's/\([^,]*\), \([^,]*\), \(.*\)/\2/')
+
+# Determine libdir based on app_abi
+# Applications that don't have a header will default to native libdir
+case $app_abi in
+       Intel\ 80386)
+               APULSE_ABI="32"
+               ;;
+       x86-64)
+               APULSE_ABI="64"
+               ;;
+       *)
+               APULSE_ABI=$(readlink /usr/lib)
+               APULSE_ABI=${APULSE_ABI#lib}
+               ;;
+esac
+
+# Set library path for the application so it'll use apulse
+LD_LIBRARY_PATH=/usr/lib${APULSE_ABI}/apulse${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}
 exec "$@"

Reply via email to