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

Contents of /eclass/gst-plugins10.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.8 - (hide annotations) (download)
Sun Dec 2 17:16:20 2012 UTC (2 years ago) by eva
Branch: MAIN
Changes since 1.7: +237 -42 lines
Commit new gstreamer eclasses as reviewed on gentoo-dev mailing list with a few more fixes, most notably EAPI=1 support fixes. For a more detailed changelog, please see gnome overlay git log.

1 tetromino 1.7 # Copyright 1999-2012 Gentoo Foundation
2 zaheerm 1.1 # Distributed under the terms of the GNU General Public License v2
3 eva 1.8 # $Header: $
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     if has "${EAPI:-0}" 0 1 2 3; then
50     : ${GST_LA_PUNT:="no"}
51     else
52     : ${GST_LA_PUNT:="yes"}
53     fi
54    
55     # @ECLASS-VARIABLE: GST_PLUGINS_BUILD
56     # @DESCRIPTION:
57     # Defines the plugins to be built.
58     # May be set by an ebuild and contain more than one indentifier, space
59     # seperated (only src_configure can handle mutiple plugins at this time).
60     GST_PLUGINS_BUILD=${PN/gst-plugins-/}
61 zaheerm 1.1
62 eva 1.8 # @ECLASS-VARIABLE: GST_PLUGINS_BUILD_DIR
63     # @DESCRIPTION:
64     # Actual build directory of the plugin.
65     # Most often the same as the configure switch name.
66     GST_PLUGINS_BUILD_DIR=${PN/gst-plugins-/}
67 zaheerm 1.1
68 eva 1.8 # @ECLASS-VARIABLE: GST_TARBALL_SUFFIX
69     # @DESCRIPTION:
70     # Most projects hosted on gstreamer.freedesktop.org mirrors provide tarballs as
71     # tar.bz2 or tar.xz. This eclass defaults to bz2 for EAPI 0, 1, 2, 3 and
72     # defaults to xz for everything else. This is because the gstreamer mirrors
73     # are moving to only have xz tarballs for new releases.
74     if has "${EAPI:-0}" 0 1 2 3; then
75     : ${GST_TARBALL_SUFFIX:="bz2"}
76     else
77     : ${GST_TARBALL_SUFFIX:="xz"}
78     fi
79    
80     # Even though xz-utils are in @system, they must still be added to DEPEND; see
81     # http://archives.gentoo.org/gentoo-dev/msg_a0d4833eb314d1be5d5802a3b710e0a4.xml
82     if [[ ${GST_TARBALL_SUFFIX} == "xz" ]]; then
83     DEPEND="${DEPEND} app-arch/xz-utils"
84     fi
85    
86     # @ECLASS-VARIABLE: GST_ORG_MODULE
87     # @DESCRIPTION:
88     # Name of the module as hosted on gstreamer.freedesktop.org mirrors.
89     # Leave unset if package name matches module name.
90     : ${GST_ORG_MODULE:=$PN}
91    
92     # @ECLASS-VARIABLE: GST_ORG_PVP
93     # @INTERNAL
94     # @DESCRIPTION:
95     # Major and minor numbers of the version number.
96     : ${GST_ORG_PVP:=$(get_version_component_range 1-2)}
97 zaheerm 1.1
98    
99     DESCRIPTION="${BUILD_GST_PLUGINS} plugin for gstreamer"
100     HOMEPAGE="http://gstreamer.freedesktop.org/"
101 eva 1.8 SRC_URI="http://gstreamer.freedesktop.org/src/${GST_ORG_MODULE}/${GST_ORG_MODULE}-${PV}.tar.${GST_TARBALL_SUFFIX}"
102    
103 zaheerm 1.1 LICENSE="GPL-2"
104 eva 1.8 SLOT="${GST_ORG_PVP}"
105    
106     S="${WORKDIR}/${GST_ORG_MODULE}-${PV}"
107 zaheerm 1.1
108 eva 1.8 RDEPEND="
109     >=dev-libs/glib-2.6:2
110     media-libs/gstreamer:${SLOT}
111     "
112     DEPEND="
113     >=sys-apps/sed-4
114     virtual/pkgconfig
115     "
116    
117     if [[ ${PN} != ${GST_ORG_MODULE} ]]; then
118     # Do not run test phase for invididual plugin ebuilds.
119     RESTRICT="test"
120     RDEPEND="${RDEPEND} >=media-libs/${GST_ORG_MODULE}-${PV}:${SLOT}"
121     else
122     IUSE="nls"
123     DEPEND="${DEPEND} nls? ( >=sys-devel/gettext-0.17 )"
124     fi
125    
126     #if [[ ${SLOT} == "0.10" ]]; then
127     # XXX: verify with old ebuilds.
128     # DEPEND="${DEPEND} dev-libs/liboil"
129     #fi
130    
131     DEPEND="${DEPEND} ${RDEPEND}"
132    
133     # @FUNCTION: gst-plugins10_get_plugins
134     # @INTERNAL
135     # @DESCRIPTION:
136     # Get the list of plugins requiring external dependencies.
137     gst-plugins10_get_plugins() {
138     # Must be called from src_prepare/src_configure
139     GST_PLUGINS_LIST=$(sed -rn 's/^AG_GST_CHECK_FEATURE\((\w+),.*/ \1 /p' \
140     "${S}"/configure.* | tr '[:upper:]' '[:lower:]')
141     }
142 zaheerm 1.1
143 eva 1.8 # @FUNCTION: gst-plugins10_find_plugin_dir
144     # @INTERNAL
145     # @DESCRIPTION:
146     # Finds plugin build directory and cd to it.
147 zaheerm 1.1 gst-plugins10_find_plugin_dir() {
148 pva 1.3 if [[ ! -d ${S}/ext/${GST_PLUGINS_BUILD_DIR} ]]; then
149     if [[ ! -d ${S}/sys/${GST_PLUGINS_BUILD_DIR} ]]; then
150 zaheerm 1.1 ewarn "No such plugin directory"
151     die
152     fi
153 leio 1.4 einfo "Building system plugin ${GST_PLUGINS_BUILD_DIR} ..."
154 pva 1.3 cd "${S}"/sys/${GST_PLUGINS_BUILD_DIR}
155 zaheerm 1.1 else
156 leio 1.4 einfo "Building external plugin ${GST_PLUGINS_BUILD_DIR} ..."
157 pva 1.3 cd "${S}"/ext/${GST_PLUGINS_BUILD_DIR}
158 zaheerm 1.1 fi
159 eva 1.8 }
160    
161     # @FUNCTION: gst-plugins10_system_link
162     # @USAGE: gst-plugins10_system_link gst-libs/gst/audio:gstreamer-audio [...]
163     # @DESCRIPTION:
164     # Walks through makefiles in order to make sure build will link against system
165     # librairies.
166     # Takes a list of path fragments and corresponding pkgconfig libraries
167     # separated by colon (:). Will replace the path fragment by the output of
168     # pkgconfig.
169     gst-plugins10_system_link() {
170     local directory libs pkgconfig pc tuple
171     pkgconfig=$(tc-getPKG_CONFIG)
172    
173     gst-plugins10_find_plugin_dir
174    
175     for tuple in $@ ; do
176     directory="$(echo ${tuple} | cut -f1 -d':')"
177     pc="$(echo ${tuple} | cut -f2 -d':')-${SLOT}"
178     libs="$(${pkgconfig} --libs-only-l ${pc})"
179 zaheerm 1.1
180 eva 1.8 sed -e "s:\$(top_builddir)/${directory}/.*\.la:${libs}:" \
181     -i Makefile.am Makefile.in || die
182     done
183 zaheerm 1.1 }
184    
185 eva 1.8 # @FUNCTION: gst-plugins10_remove_unversioned_binaries
186     # @INTERNAL
187     # @DEPRECATED
188     # @DESCRIPTION:
189     # Remove the unversioned binaries gstreamer provides to prevent file collision
190     # with other slots.
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     gst-plugins10_src_configure() {
203     local plugin gst_conf
204 zaheerm 1.1
205 eva 1.8 if has ${EAPI:-0} 0 1 2 3 ; then
206     gst_conf="${gst_conf} --disable-dependency-tracking"
207     fi
208    
209     if has ${EAPI:-0} 0 1 2 3 4 ; then
210     gst_conf="${gst_conf} --disable-silent-rules"
211     fi
212    
213     gst-plugins10_get_plugins
214    
215     for plugin in ${GST_PLUGINS_LIST} ; do
216     if has ${plugin} ${GST_PLUGINS_BUILD} ; then
217     gst_conf="${gst_conf} --enable-${plugin}"
218     else
219     gst_conf="${gst_conf} --disable-${plugin}"
220     fi
221     done
222    
223     if grep -q "ORC_CHECK" configure.* ; then
224     if in_iuse orc ; then
225     gst_conf="${gst_conf} $(use_enable orc)"
226     else
227     gst_conf="${gst_conf} --disable-orc"
228     fi
229     fi
230    
231     if grep -q "AM_MAINTAINER_MODE" configure.* ; then
232     gst_conf="${gst_conf} --disable-maintainer-mode"
233     fi
234    
235     if grep -q "disable-schemas-compile" configure ; then
236     gst_conf="${gst_conf} --disable-schemas-compile"
237     fi
238    
239     if [[ ${PN} == ${GST_ORG_MODULE} ]]; then
240     gst_conf="${gst_conf} $(use_enable nls)"
241     fi
242    
243     einfo "Configuring to build ${GST_PLUGINS_BUILD} plugin(s) ..."
244     econf \
245     --with-package-name="Gentoo GStreamer ebuild" \
246     --with-package-origin="http://www.gentoo.org" \
247     ${gst_conf} $@
248 zaheerm 1.1 }
249 eva 1.8
250     # @FUNCTION: gst-plugins10_src_compile
251     gst-plugins10_src_compile() {
252     has ${EAPI:-0} 0 1 && gst-plugins10_src_configure "$@"
253    
254     gst-plugins10_find_plugin_dir
255    
256     if has "${EAPI:-0}" 0 1 2 3 ; then
257     emake || die
258     else
259     default
260     fi
261     }
262    
263     # @FUNCTION: gst-plugins10_src_install
264     gst-plugins10_src_install() {
265     gst-plugins10_find_plugin_dir
266    
267     if has "${EAPI:-0}" 0 1 2 3 ; then
268     emake install DESTDIR="${D}" || die
269     [[ -e README ]] && dodoc README
270     else
271     default
272     fi
273    
274     [[ ${GST_LA_PUNT} = "yes" ]] && prune_libtool_files --modules
275     }

  ViewVC Help
Powered by ViewVC 1.1.20