Hi all,

this patch adds support for building plugins in different directory.

This has been a long TODO item but there is now a need for it since the
amrnb and amrwb codecs both depend on the same lib and I see no reason
to not have them under the same ebuild.

I am attaching the sample ebuild with it.

AMR* ebuild request is here:
https://bugs.gentoo.org/show_bug.cgi?id=306855

-- 
Gilles Dartiguelongue <e...@gentoo.org>
Gentoo
Index: gst-plugins10.eclass
===================================================================
RCS file: /var/cvsroot/gentoo-x86/eclass/gst-plugins10.eclass,v
retrieving revision 1.9
diff -u -B -r1.9 gst-plugins10.eclass
--- gst-plugins10.eclass	16 Jan 2013 22:52:37 -0000	1.9
+++ gst-plugins10.eclass	23 Jan 2013 22:56:06 -0000
@@ -58,13 +58,13 @@
 # Defines the plugins to be built.
 # May be set by an ebuild and contain more than one indentifier, space
 # seperated (only src_configure can handle mutiple plugins at this time).
-GST_PLUGINS_BUILD=${PN/gst-plugins-/}
+: ${GST_PLUGINS_BUILD:=${PN/gst-plugins-/}}
 
 # @ECLASS-VARIABLE: GST_PLUGINS_BUILD_DIR
 # @DESCRIPTION:
 # Actual build directory of the plugin.
 # Most often the same as the configure switch name.
-GST_PLUGINS_BUILD_DIR=${PN/gst-plugins-/}
+: ${GST_PLUGINS_BUILD_DIR:=${PN/gst-plugins-/}}
 
 # @ECLASS-VARIABLE: GST_TARBALL_SUFFIX
 # @DESCRIPTION:
@@ -142,20 +142,24 @@
 }
 
 # @FUNCTION: gst-plugins10_find_plugin_dir
+# @USAGE: gst-plugins10_find_plugin_dir [<build_dir>]
 # @INTERNAL
 # @DESCRIPTION:
 # Finds plugin build directory and cd to it.
+# Defaults to ${GST_PLUGINS_BUILD_DIR} if argument is not provided
 gst-plugins10_find_plugin_dir() {
-	if [[ ! -d ${S}/ext/${GST_PLUGINS_BUILD_DIR} ]]; then
-		if [[ ! -d ${S}/sys/${GST_PLUGINS_BUILD_DIR} ]]; then
+	local build_dir=${1:-${GST_PLUGINS_BUILD_DIR}}
+
+	if [[ ! -d ${S}/ext/${build_dir} ]]; then
+		if [[ ! -d ${S}/sys/${build_dir} ]]; then
 			ewarn "No such plugin directory"
 			die
 		fi
-		einfo "Building system plugin ${GST_PLUGINS_BUILD_DIR} ..."
-		cd "${S}"/sys/${GST_PLUGINS_BUILD_DIR}
+		einfo "Building system plugin in ${build_dir}..."
+		cd "${S}"/sys/${build_dir}
 	else
-		einfo "Building external plugin ${GST_PLUGINS_BUILD_DIR} ..."
-		cd "${S}"/ext/${GST_PLUGINS_BUILD_DIR}
+		einfo "Building external plugin in ${build_dir}..."
+		cd "${S}"/ext/${build_dir}
 	fi
 }
 
@@ -171,15 +175,16 @@
 	local directory libs pkgconfig pc tuple
 	pkgconfig=$(tc-getPKG_CONFIG)
 
-	gst-plugins10_find_plugin_dir
-
-	for tuple in $@ ; do
-		directory="$(echo ${tuple} | cut -f1 -d':')"
-		pc="$(echo ${tuple} | cut -f2 -d':')-${SLOT}"
-		libs="$(${pkgconfig} --libs-only-l ${pc})"
+	for plugin_dir in ${GST_PLUGINS_BUILD_DIR} ; do
+		gst-plugins10_find_plugin_dir ${plugin_dir}
 
-		sed -e "s:\$(top_builddir)/${directory}/.*\.la:${libs}:" \
-			-i Makefile.am Makefile.in || die
+		for tuple in $@ ; do
+			directory="$(echo ${tuple} | cut -f1 -d':')"
+			pc="$(echo ${tuple} | cut -f2 -d':')-${SLOT}"
+			libs="$(${pkgconfig} --libs-only-l ${pc})"
+			sed -e "s:\$(top_builddir)/${directory}/.*\.la:${libs}:" \
+				-i Makefile.am Makefile.in || die
+		done
 	done
 }
 
@@ -253,29 +258,37 @@
 # @DESCRIPTION:
 # Compiles requested gstreamer plugin.
 gst-plugins10_src_compile() {
+	local plugin_dir
+	
 	has ${EAPI:-0} 0 1 && gst-plugins10_src_configure "$@"
 
-	gst-plugins10_find_plugin_dir
+	for plugin_dir in ${GST_PLUGINS_BUILD_DIR} ; do
+		gst-plugins10_find_plugin_dir ${plugin_dir}
 
-	if has "${EAPI:-0}" 0 1 2 3 ; then
-		emake || die
-	else
-		default
-	fi
+		if has "${EAPI:-0}" 0 1 2 3 ; then
+			emake || die
+		else
+			default
+		fi
+	done
 }
 
 # @FUNCTION: gst-plugins10_src_install
 # @DESCRIPTION:
 # Installs requested gstreamer plugin.
 gst-plugins10_src_install() {
-	gst-plugins10_find_plugin_dir
-
-	if has "${EAPI:-0}" 0 1 2 3 ; then
-		emake install DESTDIR="${D}" || die
-		[[ -e README ]] && dodoc README
-	else
-		default
-	fi
+	local plugin_dir
+	
+	for plugin_dir in ${GST_PLUGINS_BUILD_DIR} ; do
+		gst-plugins10_find_plugin_dir ${plugin_dir}
+
+		if has "${EAPI:-0}" 0 1 2 3 ; then
+			emake install DESTDIR="${D}" || die
+			[[ -e README ]] && dodoc README
+		else
+			default
+		fi
+	done
 
 	[[ ${GST_LA_PUNT} = "yes" ]] && prune_libtool_files --modules
 }
# Copyright 1999-2013 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $

EAPI="5"

inherit gst-plugins-ugly

DESCRIPTION="GStreamer plugin for AMRNB/AMRWB codec"
HOMEPAGE="http://gstreamer.freedesktop.org/";

LICENSE="GPL-2"
KEYWORDS="~amd64 ~x86"
IUSE=""

RDEPEND="media-libs/opencore-amr"
DEPEND="${RDEPEND}"

GST_PLUGINS_BUILD="amrnb amrwb"
GST_PLUGINS_BUILD_DIR="amrnb amrwbdec"

Attachment: signature.asc
Description: This is a digitally signed message part

Reply via email to