| 1 | # Copyright 1999-2012 Gentoo Foundation |
1 | # Copyright 1999-2013 Gentoo Foundation |
| 2 | # Distributed under the terms of the GNU General Public License v2 |
2 | # Distributed under the terms of the GNU General Public License v2 |
| 3 | # $Header: /var/cvsroot/gentoo-x86/eclass/gst-plugins10.eclass,v 1.8 2012/12/02 17:16:20 eva Exp $ |
3 | # $Header: /var/cvsroot/gentoo-x86/eclass/gst-plugins10.eclass,v 1.10 2013/01/31 19:59:54 eva Exp $ |
| 4 | |
4 | |
| 5 | # @ECLASS: gst-plugins10.eclass |
5 | # @ECLASS: gst-plugins10.eclass |
| 6 | # @MAINTAINER: |
6 | # @MAINTAINER: |
| 7 | # gstreamer@gentoo.org |
7 | # gstreamer@gentoo.org |
| 8 | # @AUTHOR: |
8 | # @AUTHOR: |
| … | |
… | |
| 44 | |
44 | |
| 45 | # @ECLASS-VARIABLE: GST_LA_PUNT |
45 | # @ECLASS-VARIABLE: GST_LA_PUNT |
| 46 | # @DESCRIPTION: |
46 | # @DESCRIPTION: |
| 47 | # Should we delete all the .la files? |
47 | # Should we delete all the .la files? |
| 48 | # NOT to be used without due consideration. |
48 | # NOT to be used without due consideration. |
|
|
49 | # Defaults to no for EAPI < 5. |
| 49 | if has "${EAPI:-0}" 0 1 2 3; then |
50 | if has "${EAPI:-0}" 0 1 2 3; then |
| 50 | : ${GST_LA_PUNT:="no"} |
51 | : ${GST_LA_PUNT:="no"} |
| 51 | else |
52 | else |
| 52 | : ${GST_LA_PUNT:="yes"} |
53 | : ${GST_LA_PUNT:="yes"} |
| 53 | fi |
54 | fi |
| … | |
… | |
| 55 | # @ECLASS-VARIABLE: GST_PLUGINS_BUILD |
56 | # @ECLASS-VARIABLE: GST_PLUGINS_BUILD |
| 56 | # @DESCRIPTION: |
57 | # @DESCRIPTION: |
| 57 | # Defines the plugins to be built. |
58 | # Defines the plugins to be built. |
| 58 | # May be set by an ebuild and contain more than one indentifier, space |
59 | # 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 | # seperated (only src_configure can handle mutiple plugins at this time). |
| 60 | GST_PLUGINS_BUILD=${PN/gst-plugins-/} |
61 | : ${GST_PLUGINS_BUILD:=${PN/gst-plugins-/}} |
| 61 | |
62 | |
| 62 | # @ECLASS-VARIABLE: GST_PLUGINS_BUILD_DIR |
63 | # @ECLASS-VARIABLE: GST_PLUGINS_BUILD_DIR |
| 63 | # @DESCRIPTION: |
64 | # @DESCRIPTION: |
| 64 | # Actual build directory of the plugin. |
65 | # Actual build directory of the plugin. |
| 65 | # Most often the same as the configure switch name. |
66 | # Most often the same as the configure switch name. |
| 66 | GST_PLUGINS_BUILD_DIR=${PN/gst-plugins-/} |
67 | : ${GST_PLUGINS_BUILD_DIR:=${PN/gst-plugins-/}} |
| 67 | |
68 | |
| 68 | # @ECLASS-VARIABLE: GST_TARBALL_SUFFIX |
69 | # @ECLASS-VARIABLE: GST_TARBALL_SUFFIX |
| 69 | # @DESCRIPTION: |
70 | # @DESCRIPTION: |
| 70 | # Most projects hosted on gstreamer.freedesktop.org mirrors provide tarballs as |
71 | # 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 | # tar.bz2 or tar.xz. This eclass defaults to bz2 for EAPI 0, 1, 2, 3 and |
| … | |
… | |
| 139 | GST_PLUGINS_LIST=$(sed -rn 's/^AG_GST_CHECK_FEATURE\((\w+),.*/ \1 /p' \ |
140 | GST_PLUGINS_LIST=$(sed -rn 's/^AG_GST_CHECK_FEATURE\((\w+),.*/ \1 /p' \ |
| 140 | "${S}"/configure.* | tr '[:upper:]' '[:lower:]') |
141 | "${S}"/configure.* | tr '[:upper:]' '[:lower:]') |
| 141 | } |
142 | } |
| 142 | |
143 | |
| 143 | # @FUNCTION: gst-plugins10_find_plugin_dir |
144 | # @FUNCTION: gst-plugins10_find_plugin_dir |
|
|
145 | # @USAGE: gst-plugins10_find_plugin_dir [<build_dir>] |
| 144 | # @INTERNAL |
146 | # @INTERNAL |
| 145 | # @DESCRIPTION: |
147 | # @DESCRIPTION: |
| 146 | # Finds plugin build directory and cd to it. |
148 | # Finds plugin build directory and cd to it. |
|
|
149 | # Defaults to ${GST_PLUGINS_BUILD_DIR} if argument is not provided |
| 147 | gst-plugins10_find_plugin_dir() { |
150 | gst-plugins10_find_plugin_dir() { |
| 148 | if [[ ! -d ${S}/ext/${GST_PLUGINS_BUILD_DIR} ]]; then |
151 | local build_dir=${1:-${GST_PLUGINS_BUILD_DIR}} |
| 149 | if [[ ! -d ${S}/sys/${GST_PLUGINS_BUILD_DIR} ]]; then |
152 | |
|
|
153 | if [[ ! -d ${S}/ext/${build_dir} ]]; then |
|
|
154 | if [[ ! -d ${S}/sys/${build_dir} ]]; then |
| 150 | ewarn "No such plugin directory" |
155 | ewarn "No such plugin directory" |
| 151 | die |
156 | die |
| 152 | fi |
157 | fi |
| 153 | einfo "Building system plugin ${GST_PLUGINS_BUILD_DIR} ..." |
158 | einfo "Building system plugin in ${build_dir}..." |
| 154 | cd "${S}"/sys/${GST_PLUGINS_BUILD_DIR} |
159 | cd "${S}"/sys/${build_dir} |
| 155 | else |
160 | else |
| 156 | einfo "Building external plugin ${GST_PLUGINS_BUILD_DIR} ..." |
161 | einfo "Building external plugin in ${build_dir}..." |
| 157 | cd "${S}"/ext/${GST_PLUGINS_BUILD_DIR} |
162 | cd "${S}"/ext/${build_dir} |
| 158 | fi |
163 | fi |
| 159 | } |
164 | } |
| 160 | |
165 | |
| 161 | # @FUNCTION: gst-plugins10_system_link |
166 | # @FUNCTION: gst-plugins10_system_link |
| 162 | # @USAGE: gst-plugins10_system_link gst-libs/gst/audio:gstreamer-audio [...] |
167 | # @USAGE: gst-plugins10_system_link gst-libs/gst/audio:gstreamer-audio [...] |
| … | |
… | |
| 168 | # pkgconfig. |
173 | # pkgconfig. |
| 169 | gst-plugins10_system_link() { |
174 | gst-plugins10_system_link() { |
| 170 | local directory libs pkgconfig pc tuple |
175 | local directory libs pkgconfig pc tuple |
| 171 | pkgconfig=$(tc-getPKG_CONFIG) |
176 | pkgconfig=$(tc-getPKG_CONFIG) |
| 172 | |
177 | |
|
|
178 | for plugin_dir in ${GST_PLUGINS_BUILD_DIR} ; do |
| 173 | gst-plugins10_find_plugin_dir |
179 | gst-plugins10_find_plugin_dir ${plugin_dir} |
| 174 | |
180 | |
| 175 | for tuple in $@ ; do |
181 | for tuple in $@ ; do |
| 176 | directory="$(echo ${tuple} | cut -f1 -d':')" |
182 | directory="$(echo ${tuple} | cut -f1 -d':')" |
| 177 | pc="$(echo ${tuple} | cut -f2 -d':')-${SLOT}" |
183 | pc="$(echo ${tuple} | cut -f2 -d':')-${SLOT}" |
| 178 | libs="$(${pkgconfig} --libs-only-l ${pc})" |
184 | libs="$(${pkgconfig} --libs-only-l ${pc})" |
| 179 | |
|
|
| 180 | sed -e "s:\$(top_builddir)/${directory}/.*\.la:${libs}:" \ |
185 | sed -e "s:\$(top_builddir)/${directory}/.*\.la:${libs}:" \ |
| 181 | -i Makefile.am Makefile.in || die |
186 | -i Makefile.am Makefile.in || die |
|
|
187 | done |
| 182 | done |
188 | done |
| 183 | } |
189 | } |
| 184 | |
190 | |
| 185 | # @FUNCTION: gst-plugins10_remove_unversioned_binaries |
191 | # @FUNCTION: gst-plugins10_remove_unversioned_binaries |
| 186 | # @INTERNAL |
192 | # @INTERNAL |
| 187 | # @DEPRECATED |
|
|
| 188 | # @DESCRIPTION: |
193 | # @DESCRIPTION: |
| 189 | # Remove the unversioned binaries gstreamer provides to prevent file collision |
194 | # Remove the unversioned binaries gstreamer provides to prevent file collision |
| 190 | # with other slots. |
195 | # with other slots. DEPRECATED |
| 191 | gst-plugins10_remove_unversioned_binaries() { |
196 | gst-plugins10_remove_unversioned_binaries() { |
| 192 | cd "${D}"/usr/bin |
197 | cd "${D}"/usr/bin |
| 193 | local gst_bins |
198 | local gst_bins |
| 194 | for gst_bins in *-${SLOT} ; do |
199 | for gst_bins in *-${SLOT} ; do |
| 195 | [[ -e ${gst_bins} ]] || continue |
200 | [[ -e ${gst_bins} ]] || continue |
| … | |
… | |
| 197 | einfo "Removed ${gst_bins/-${SLOT}/}" |
202 | einfo "Removed ${gst_bins/-${SLOT}/}" |
| 198 | done |
203 | done |
| 199 | } |
204 | } |
| 200 | |
205 | |
| 201 | # @FUNCTION: gst-plugins10_src_configure |
206 | # @FUNCTION: gst-plugins10_src_configure |
|
|
207 | # @DESCRIPTION: |
|
|
208 | # Handles logic common to configuring gstreamer plugins |
| 202 | gst-plugins10_src_configure() { |
209 | gst-plugins10_src_configure() { |
| 203 | local plugin gst_conf |
210 | local plugin gst_conf |
| 204 | |
211 | |
| 205 | if has ${EAPI:-0} 0 1 2 3 ; then |
212 | if has ${EAPI:-0} 0 1 2 3 ; then |
| 206 | gst_conf="${gst_conf} --disable-dependency-tracking" |
213 | gst_conf="${gst_conf} --disable-dependency-tracking" |
| … | |
… | |
| 246 | --with-package-origin="http://www.gentoo.org" \ |
253 | --with-package-origin="http://www.gentoo.org" \ |
| 247 | ${gst_conf} $@ |
254 | ${gst_conf} $@ |
| 248 | } |
255 | } |
| 249 | |
256 | |
| 250 | # @FUNCTION: gst-plugins10_src_compile |
257 | # @FUNCTION: gst-plugins10_src_compile |
|
|
258 | # @DESCRIPTION: |
|
|
259 | # Compiles requested gstreamer plugin. |
| 251 | gst-plugins10_src_compile() { |
260 | gst-plugins10_src_compile() { |
|
|
261 | local plugin_dir |
|
|
262 | |
| 252 | has ${EAPI:-0} 0 1 && gst-plugins10_src_configure "$@" |
263 | has ${EAPI:-0} 0 1 && gst-plugins10_src_configure "$@" |
| 253 | |
264 | |
|
|
265 | for plugin_dir in ${GST_PLUGINS_BUILD_DIR} ; do |
| 254 | gst-plugins10_find_plugin_dir |
266 | gst-plugins10_find_plugin_dir ${plugin_dir} |
| 255 | |
267 | |
| 256 | if has "${EAPI:-0}" 0 1 2 3 ; then |
268 | if has "${EAPI:-0}" 0 1 2 3 ; then |
| 257 | emake || die |
269 | emake || die |
| 258 | else |
270 | else |
| 259 | default |
271 | default |
| 260 | fi |
272 | fi |
|
|
273 | done |
| 261 | } |
274 | } |
| 262 | |
275 | |
| 263 | # @FUNCTION: gst-plugins10_src_install |
276 | # @FUNCTION: gst-plugins10_src_install |
|
|
277 | # @DESCRIPTION: |
|
|
278 | # Installs requested gstreamer plugin. |
| 264 | gst-plugins10_src_install() { |
279 | gst-plugins10_src_install() { |
|
|
280 | local plugin_dir |
|
|
281 | |
|
|
282 | for plugin_dir in ${GST_PLUGINS_BUILD_DIR} ; do |
| 265 | gst-plugins10_find_plugin_dir |
283 | gst-plugins10_find_plugin_dir ${plugin_dir} |
| 266 | |
284 | |
| 267 | if has "${EAPI:-0}" 0 1 2 3 ; then |
285 | if has "${EAPI:-0}" 0 1 2 3 ; then |
| 268 | emake install DESTDIR="${D}" || die |
286 | emake install DESTDIR="${D}" || die |
| 269 | [[ -e README ]] && dodoc README |
287 | [[ -e README ]] && dodoc README |
| 270 | else |
288 | else |
| 271 | default |
289 | default |
| 272 | fi |
290 | fi |
|
|
291 | done |
| 273 | |
292 | |
| 274 | [[ ${GST_LA_PUNT} = "yes" ]] && prune_libtool_files --modules |
293 | [[ ${GST_LA_PUNT} = "yes" ]] && prune_libtool_files --modules |
| 275 | } |
294 | } |
| 276 | |
295 | |