/[gentoo-x86]/eclass/gst-plugins10.eclass
Gentoo

Contents of /eclass/gst-plugins10.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.9 - (hide annotations) (download)
Wed Jan 16 22:52:37 2013 UTC (18 months, 1 week ago) by eva
Branch: MAIN
Changes since 1.8: +10 -4 lines
Update eclass documentation to be correclty parsed, bug #452204.

1 eva 1.9 # Copyright 1999-2013 Gentoo Foundation
2 zaheerm 1.1 # Distributed under the terms of the GNU General Public License v2
3 eva 1.9 # $Header: /var/cvsroot/gentoo-x86/eclass/gst-plugins10.eclass,v 1.8 2012/12/02 17:16:20 eva Exp $
4 zaheerm 1.1
5 eva 1.8 # @ECLASS: gst-plugins10.eclass
6     # @MAINTAINER:
7     # gstreamer@gentoo.org
8     # @AUTHOR:
9     # Gilles Dartiguelongue <eva@gentoo.org>
10     # Saleem Abdulrasool <compnerd@gentoo.org>
11     # foser <foser@gentoo.org>
12     # zaheerm <zaheerm@gentoo.org>
13     # @BLURB: Manages build for invididual ebuild for gst-plugins.
14     # @DESCRIPTION:
15     # Eclass to make external gst-plugins emergable on a per-plugin basis and
16     # to solve the problem with gst-plugins generating far too much unneeded
17     # dependancies.
18 zaheerm 1.1 #
19 eva 1.8 # GStreamer consuming applications should depend on the specific plugins they
20     # need as defined in their source code.
21 zaheerm 1.1 #
22 eva 1.8 # In case of spider usage, obtain recommended plugins to use from Gentoo
23     # developers responsible for gstreamer <gstreamer@gentoo.org> or the application
24 leio 1.4 # developer.
25 zaheerm 1.1
26 eva 1.8 inherit eutils multilib toolchain-funcs versionator
27 zaheerm 1.1
28 eva 1.8 GST_EXPF=""
29     case "${EAPI:-0}" in
30     2|3|4|5)
31     GST_EXPF="src_configure src_compile src_install"
32     ;;
33     1)
34     GST_EXPF="src_compile src_install"
35     ;;
36     0)
37     die "EAPI=\"${EAPI:-0}\" is not supported anymore"
38     ;;
39     *)
40     die "EAPI=\"${EAPI}\" is not supported yet"
41     ;;
42     esac
43     EXPORT_FUNCTIONS ${GST_EXPF}
44    
45     # @ECLASS-VARIABLE: GST_LA_PUNT
46     # @DESCRIPTION:
47     # Should we delete all the .la files?
48     # NOT to be used without due consideration.
49 eva 1.9 # Defaults to no for EAPI < 5.
50 eva 1.8 if has "${EAPI:-0}" 0 1 2 3; then
51     : ${GST_LA_PUNT:="no"}
52     else
53     : ${GST_LA_PUNT:="yes"}
54     fi
55    
56     # @ECLASS-VARIABLE: GST_PLUGINS_BUILD
57     # @DESCRIPTION:
58     # Defines the plugins to be built.
59     # May be set by an ebuild and contain more than one indentifier, space
60     # seperated (only src_configure can handle mutiple plugins at this time).
61     GST_PLUGINS_BUILD=${PN/gst-plugins-/}
62 zaheerm 1.1
63 eva 1.8 # @ECLASS-VARIABLE: GST_PLUGINS_BUILD_DIR
64     # @DESCRIPTION:
65     # Actual build directory of the plugin.
66     # Most often the same as the configure switch name.
67     GST_PLUGINS_BUILD_DIR=${PN/gst-plugins-/}
68 zaheerm 1.1
69 eva 1.8 # @ECLASS-VARIABLE: GST_TARBALL_SUFFIX
70     # @DESCRIPTION:
71     # Most projects hosted on gstreamer.freedesktop.org mirrors provide tarballs as
72     # tar.bz2 or tar.xz. This eclass defaults to bz2 for EAPI 0, 1, 2, 3 and
73     # defaults to xz for everything else. This is because the gstreamer mirrors
74     # are moving to only have xz tarballs for new releases.
75     if has "${EAPI:-0}" 0 1 2 3; then
76     : ${GST_TARBALL_SUFFIX:="bz2"}
77     else
78     : ${GST_TARBALL_SUFFIX:="xz"}
79     fi
80    
81     # Even though xz-utils are in @system, they must still be added to DEPEND; see
82     # http://archives.gentoo.org/gentoo-dev/msg_a0d4833eb314d1be5d5802a3b710e0a4.xml
83     if [[ ${GST_TARBALL_SUFFIX} == "xz" ]]; then
84     DEPEND="${DEPEND} app-arch/xz-utils"
85     fi
86    
87     # @ECLASS-VARIABLE: GST_ORG_MODULE
88     # @DESCRIPTION:
89     # Name of the module as hosted on gstreamer.freedesktop.org mirrors.
90     # Leave unset if package name matches module name.
91     : ${GST_ORG_MODULE:=$PN}
92    
93     # @ECLASS-VARIABLE: GST_ORG_PVP
94     # @INTERNAL
95     # @DESCRIPTION:
96     # Major and minor numbers of the version number.
97     : ${GST_ORG_PVP:=$(get_version_component_range 1-2)}
98 zaheerm 1.1
99    
100     DESCRIPTION="${BUILD_GST_PLUGINS} plugin for gstreamer"
101     HOMEPAGE="http://gstreamer.freedesktop.org/"
102 eva 1.8 SRC_URI="http://gstreamer.freedesktop.org/src/${GST_ORG_MODULE}/${GST_ORG_MODULE}-${PV}.tar.${GST_TARBALL_SUFFIX}"
103    
104 zaheerm 1.1 LICENSE="GPL-2"
105 eva 1.8 SLOT="${GST_ORG_PVP}"
106    
107     S="${WORKDIR}/${GST_ORG_MODULE}-${PV}"
108 zaheerm 1.1
109 eva 1.8 RDEPEND="
110     >=dev-libs/glib-2.6:2
111     media-libs/gstreamer:${SLOT}
112     "
113     DEPEND="
114     >=sys-apps/sed-4
115     virtual/pkgconfig
116     "
117    
118     if [[ ${PN} != ${GST_ORG_MODULE} ]]; then
119     # Do not run test phase for invididual plugin ebuilds.
120     RESTRICT="test"
121     RDEPEND="${RDEPEND} >=media-libs/${GST_ORG_MODULE}-${PV}:${SLOT}"
122     else
123     IUSE="nls"
124     DEPEND="${DEPEND} nls? ( >=sys-devel/gettext-0.17 )"
125     fi
126    
127     #if [[ ${SLOT} == "0.10" ]]; then
128     # XXX: verify with old ebuilds.
129     # DEPEND="${DEPEND} dev-libs/liboil"
130     #fi
131    
132     DEPEND="${DEPEND} ${RDEPEND}"
133    
134     # @FUNCTION: gst-plugins10_get_plugins
135     # @INTERNAL
136     # @DESCRIPTION:
137     # Get the list of plugins requiring external dependencies.
138     gst-plugins10_get_plugins() {
139     # Must be called from src_prepare/src_configure
140     GST_PLUGINS_LIST=$(sed -rn 's/^AG_GST_CHECK_FEATURE\((\w+),.*/ \1 /p' \
141     "${S}"/configure.* | tr '[:upper:]' '[:lower:]')
142     }
143 zaheerm 1.1
144 eva 1.8 # @FUNCTION: gst-plugins10_find_plugin_dir
145     # @INTERNAL
146     # @DESCRIPTION:
147     # Finds plugin build directory and cd to it.
148 zaheerm 1.1 gst-plugins10_find_plugin_dir() {
149 pva 1.3 if [[ ! -d ${S}/ext/${GST_PLUGINS_BUILD_DIR} ]]; then
150     if [[ ! -d ${S}/sys/${GST_PLUGINS_BUILD_DIR} ]]; then
151 zaheerm 1.1 ewarn "No such plugin directory"
152     die
153     fi
154 leio 1.4 einfo "Building system plugin ${GST_PLUGINS_BUILD_DIR} ..."
155 pva 1.3 cd "${S}"/sys/${GST_PLUGINS_BUILD_DIR}
156 zaheerm 1.1 else
157 leio 1.4 einfo "Building external plugin ${GST_PLUGINS_BUILD_DIR} ..."
158 pva 1.3 cd "${S}"/ext/${GST_PLUGINS_BUILD_DIR}
159 zaheerm 1.1 fi
160 eva 1.8 }
161    
162     # @FUNCTION: gst-plugins10_system_link
163     # @USAGE: gst-plugins10_system_link gst-libs/gst/audio:gstreamer-audio [...]
164     # @DESCRIPTION:
165     # Walks through makefiles in order to make sure build will link against system
166     # librairies.
167     # Takes a list of path fragments and corresponding pkgconfig libraries
168     # separated by colon (:). Will replace the path fragment by the output of
169     # pkgconfig.
170     gst-plugins10_system_link() {
171     local directory libs pkgconfig pc tuple
172     pkgconfig=$(tc-getPKG_CONFIG)
173    
174     gst-plugins10_find_plugin_dir
175    
176     for tuple in $@ ; do
177     directory="$(echo ${tuple} | cut -f1 -d':')"
178     pc="$(echo ${tuple} | cut -f2 -d':')-${SLOT}"
179     libs="$(${pkgconfig} --libs-only-l ${pc})"
180 zaheerm 1.1
181 eva 1.8 sed -e "s:\$(top_builddir)/${directory}/.*\.la:${libs}:" \
182     -i Makefile.am Makefile.in || die
183     done
184 zaheerm 1.1 }
185    
186 eva 1.8 # @FUNCTION: gst-plugins10_remove_unversioned_binaries
187     # @INTERNAL
188     # @DESCRIPTION:
189     # Remove the unversioned binaries gstreamer provides to prevent file collision
190 eva 1.9 # with other slots. DEPRECATED
191 zaheerm 1.1 gst-plugins10_remove_unversioned_binaries() {
192 vapier 1.5 cd "${D}"/usr/bin
193     local gst_bins
194 eva 1.8 for gst_bins in *-${SLOT} ; do
195 vapier 1.5 [[ -e ${gst_bins} ]] || continue
196 eva 1.8 rm ${gst_bins/-${SLOT}/}
197     einfo "Removed ${gst_bins/-${SLOT}/}"
198 zaheerm 1.1 done
199 eva 1.8 }
200    
201     # @FUNCTION: gst-plugins10_src_configure
202 eva 1.9 # @DESCRIPTION:
203     # Handles logic common to configuring gstreamer plugins
204 eva 1.8 gst-plugins10_src_configure() {
205     local plugin gst_conf
206 zaheerm 1.1
207 eva 1.8 if has ${EAPI:-0} 0 1 2 3 ; then
208     gst_conf="${gst_conf} --disable-dependency-tracking"
209     fi
210    
211     if has ${EAPI:-0} 0 1 2 3 4 ; then
212     gst_conf="${gst_conf} --disable-silent-rules"
213     fi
214    
215     gst-plugins10_get_plugins
216    
217     for plugin in ${GST_PLUGINS_LIST} ; do
218     if has ${plugin} ${GST_PLUGINS_BUILD} ; then
219     gst_conf="${gst_conf} --enable-${plugin}"
220     else
221     gst_conf="${gst_conf} --disable-${plugin}"
222     fi
223     done
224    
225     if grep -q "ORC_CHECK" configure.* ; then
226     if in_iuse orc ; then
227     gst_conf="${gst_conf} $(use_enable orc)"
228     else
229     gst_conf="${gst_conf} --disable-orc"
230     fi
231     fi
232    
233     if grep -q "AM_MAINTAINER_MODE" configure.* ; then
234     gst_conf="${gst_conf} --disable-maintainer-mode"
235     fi
236    
237     if grep -q "disable-schemas-compile" configure ; then
238     gst_conf="${gst_conf} --disable-schemas-compile"
239     fi
240    
241     if [[ ${PN} == ${GST_ORG_MODULE} ]]; then
242     gst_conf="${gst_conf} $(use_enable nls)"
243     fi
244    
245     einfo "Configuring to build ${GST_PLUGINS_BUILD} plugin(s) ..."
246     econf \
247     --with-package-name="Gentoo GStreamer ebuild" \
248     --with-package-origin="http://www.gentoo.org" \
249     ${gst_conf} $@
250 zaheerm 1.1 }
251 eva 1.8
252     # @FUNCTION: gst-plugins10_src_compile
253 eva 1.9 # @DESCRIPTION:
254     # Compiles requested gstreamer plugin.
255 eva 1.8 gst-plugins10_src_compile() {
256     has ${EAPI:-0} 0 1 && gst-plugins10_src_configure "$@"
257    
258     gst-plugins10_find_plugin_dir
259    
260     if has "${EAPI:-0}" 0 1 2 3 ; then
261     emake || die
262     else
263     default
264     fi
265     }
266    
267     # @FUNCTION: gst-plugins10_src_install
268 eva 1.9 # @DESCRIPTION:
269     # Installs requested gstreamer plugin.
270 eva 1.8 gst-plugins10_src_install() {
271     gst-plugins10_find_plugin_dir
272    
273     if has "${EAPI:-0}" 0 1 2 3 ; then
274     emake install DESTDIR="${D}" || die
275     [[ -e README ]] && dodoc README
276     else
277     default
278     fi
279    
280     [[ ${GST_LA_PUNT} = "yes" ]] && prune_libtool_files --modules
281     }

  ViewVC Help
Powered by ViewVC 1.1.20