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.7 2012/10/31 01:51:52 tetromino 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 |
|
|
6 | # @MAINTAINER: |
|
|
7 | # gstreamer@gentoo.org |
|
|
8 | # @AUTHOR: |
|
|
9 | # Gilles Dartiguelongue <eva@gentoo.org> |
|
|
10 | # Saleem Abdulrasool <compnerd@gentoo.org> |
5 | # Author : foser <foser@gentoo.org> |
11 | # foser <foser@gentoo.org> |
6 | |
12 | # zaheerm <zaheerm@gentoo.org> |
7 | # gst-plugins eclass |
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. |
8 | # |
18 | # |
9 | # eclass to make external gst-plugins emergable on a per-plugin basis |
19 | # GStreamer consuming applications should depend on the specific plugins they |
10 | # to solve the problem with gst-plugins generating far too much unneeded deps |
20 | # need as defined in their source code. |
11 | # |
21 | # |
12 | # 3rd party applications using gstreamer now should depend on a set of plugins as |
|
|
13 | # defined in the source, in case of spider usage obtain recommended plugins to use from |
22 | # In case of spider usage, obtain recommended plugins to use from Gentoo |
14 | # Gentoo developers responsible for gstreamer <gstreamer@gentoo.org> or the application |
23 | # developers responsible for gstreamer <gstreamer@gentoo.org> or the application |
15 | # developer. |
24 | # developer. |
16 | |
25 | |
17 | inherit eutils versionator |
26 | inherit eutils multilib toolchain-funcs versionator |
18 | |
27 | |
|
|
28 | 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} |
19 | |
44 | |
20 | ### |
45 | # @ECLASS-VARIABLE: GST_LA_PUNT |
21 | # variable declarations |
46 | # @DESCRIPTION: |
22 | ### |
47 | # Should we delete all the .la files? |
|
|
48 | # NOT to be used without due consideration. |
|
|
49 | # Defaults to no for EAPI < 5. |
|
|
50 | if has "${EAPI:-0}" 0 1 2 3; then |
|
|
51 | : ${GST_LA_PUNT:="no"} |
|
|
52 | else |
|
|
53 | : ${GST_LA_PUNT:="yes"} |
|
|
54 | fi |
23 | |
55 | |
24 | # Create a major/minor combo for our SLOT and executables suffix |
56 | # @ECLASS-VARIABLE: GST_PLUGINS_BUILD |
25 | PVP=(${PV//[-\._]/ }) |
57 | # @DESCRIPTION: |
26 | #PV_MAJ_MIN=${PVP[0]}.${PVP[1]} |
58 | # Defines the plugins to be built. |
27 | PV_MAJ_MIN=$(get_version_component_range '1-2') |
|
|
28 | |
|
|
29 | # Extract the plugin to build from the ebuild name |
|
|
30 | # May be set by an ebuild and contain more than one indentifier, space seperated |
59 | # May be set by an ebuild and contain more than one indentifier, space |
31 | # (only src_configure can handle mutiple plugins at this time) |
60 | # seperated (only src_configure can handle mutiple plugins at this time). |
32 | GST_PLUGINS_BUILD=${PN/gst-plugins-/} |
61 | : ${GST_PLUGINS_BUILD:=${PN/gst-plugins-/}} |
33 | |
62 | |
34 | # Actual build dir, is the same as the configure switch name most of the time |
63 | # @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. |
35 | GST_PLUGINS_BUILD_DIR=${PN/gst-plugins-/} |
67 | : ${GST_PLUGINS_BUILD_DIR:=${PN/gst-plugins-/}} |
36 | |
68 | |
37 | # general common gst-plugins ebuild entries |
69 | # @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 | |
|
|
99 | |
38 | DESCRIPTION="${BUILD_GST_PLUGINS} plugin for gstreamer" |
100 | DESCRIPTION="${BUILD_GST_PLUGINS} plugin for gstreamer" |
39 | HOMEPAGE="http://gstreamer.freedesktop.org/" |
101 | HOMEPAGE="http://gstreamer.freedesktop.org/" |
|
|
102 | SRC_URI="http://gstreamer.freedesktop.org/src/${GST_ORG_MODULE}/${GST_ORG_MODULE}-${PV}.tar.${GST_TARBALL_SUFFIX}" |
|
|
103 | |
40 | LICENSE="GPL-2" |
104 | LICENSE="GPL-2" |
|
|
105 | SLOT="${GST_ORG_PVP}" |
41 | |
106 | |
42 | #SRC_URI="mirror://gnome/sources/gst-plugins/${PV_MAJ_MIN}/${MY_P}.tar.bz2" |
107 | S="${WORKDIR}/${GST_ORG_MODULE}-${PV}" |
43 | SLOT=${PV_MAJ_MIN} |
|
|
44 | ### |
|
|
45 | # internal functions |
|
|
46 | ### |
|
|
47 | |
108 | |
|
|
109 | 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 | |
|
|
144 | # @FUNCTION: gst-plugins10_find_plugin_dir |
|
|
145 | # @USAGE: gst-plugins10_find_plugin_dir [<build_dir>] |
|
|
146 | # @INTERNAL |
|
|
147 | # @DESCRIPTION: |
|
|
148 | # Finds plugin build directory and cd to it. |
|
|
149 | # Defaults to ${GST_PLUGINS_BUILD_DIR} if argument is not provided |
48 | gst-plugins10_find_plugin_dir() { |
150 | gst-plugins10_find_plugin_dir() { |
|
|
151 | local build_dir=${1:-${GST_PLUGINS_BUILD_DIR}} |
49 | |
152 | |
50 | if [[ ! -d ${S}/ext/${GST_PLUGINS_BUILD_DIR} ]]; then |
153 | if [[ ! -d ${S}/ext/${build_dir} ]]; then |
51 | if [[ ! -d ${S}/sys/${GST_PLUGINS_BUILD_DIR} ]]; then |
154 | if [[ ! -d ${S}/sys/${build_dir} ]]; then |
52 | ewarn "No such plugin directory" |
155 | ewarn "No such plugin directory" |
53 | die |
156 | die |
54 | fi |
157 | fi |
55 | einfo "Building system plugin ${GST_PLUGINS_BUILD_DIR} ..." |
158 | einfo "Building system plugin in ${build_dir}..." |
56 | cd "${S}"/sys/${GST_PLUGINS_BUILD_DIR} |
159 | cd "${S}"/sys/${build_dir} |
57 | else |
160 | else |
58 | einfo "Building external plugin ${GST_PLUGINS_BUILD_DIR} ..." |
161 | einfo "Building external plugin in ${build_dir}..." |
59 | cd "${S}"/ext/${GST_PLUGINS_BUILD_DIR} |
162 | cd "${S}"/ext/${build_dir} |
60 | fi |
163 | fi |
61 | |
|
|
62 | } |
164 | } |
63 | |
165 | |
64 | ### |
166 | # @FUNCTION: gst-plugins10_system_link |
65 | # public functions |
167 | # @USAGE: gst-plugins10_system_link gst-libs/gst/audio:gstreamer-audio [...] |
66 | ### |
168 | # @DESCRIPTION: |
|
|
169 | # Walks through makefiles in order to make sure build will link against system |
|
|
170 | # librairies. |
|
|
171 | # Takes a list of path fragments and corresponding pkgconfig libraries |
|
|
172 | # separated by colon (:). Will replace the path fragment by the output of |
|
|
173 | # pkgconfig. |
|
|
174 | gst-plugins10_system_link() { |
|
|
175 | local directory libs pkgconfig pc tuple |
|
|
176 | pkgconfig=$(tc-getPKG_CONFIG) |
67 | |
177 | |
|
|
178 | for plugin_dir in ${GST_PLUGINS_BUILD_DIR} ; do |
|
|
179 | gst-plugins10_find_plugin_dir ${plugin_dir} |
|
|
180 | |
|
|
181 | for tuple in $@ ; do |
|
|
182 | directory="$(echo ${tuple} | cut -f1 -d':')" |
|
|
183 | pc="$(echo ${tuple} | cut -f2 -d':')-${SLOT}" |
|
|
184 | libs="$(${pkgconfig} --libs-only-l ${pc})" |
|
|
185 | sed -e "s:\$(top_builddir)/${directory}/.*\.la:${libs}:" \ |
|
|
186 | -i Makefile.am Makefile.in || die |
|
|
187 | done |
|
|
188 | done |
|
|
189 | } |
|
|
190 | |
|
|
191 | # @FUNCTION: gst-plugins10_remove_unversioned_binaries |
|
|
192 | # @INTERNAL |
|
|
193 | # @DESCRIPTION: |
|
|
194 | # Remove the unversioned binaries gstreamer provides to prevent file collision |
|
|
195 | # with other slots. DEPRECATED |
68 | gst-plugins10_remove_unversioned_binaries() { |
196 | gst-plugins10_remove_unversioned_binaries() { |
69 | |
|
|
70 | # remove the unversioned binaries gstreamer provide |
|
|
71 | # this is to prevent these binaries to be owned by several SLOTs |
|
|
72 | |
|
|
73 | cd "${D}"/usr/bin |
197 | cd "${D}"/usr/bin |
74 | local gst_bins |
198 | local gst_bins |
75 | for gst_bins in *-${PV_MAJ_MIN}; do |
199 | for gst_bins in *-${SLOT} ; do |
76 | [[ -e ${gst_bins} ]] || continue |
200 | [[ -e ${gst_bins} ]] || continue |
77 | rm ${gst_bins/-${PV_MAJ_MIN}/} |
201 | rm ${gst_bins/-${SLOT}/} |
78 | einfo "Removed ${gst_bins/-${PV_MAJ_MIN}/}" |
202 | einfo "Removed ${gst_bins/-${SLOT}/}" |
79 | done |
203 | done |
80 | |
|
|
81 | } |
204 | } |
|
|
205 | |
|
|
206 | # @FUNCTION: gst-plugins10_src_configure |
|
|
207 | # @DESCRIPTION: |
|
|
208 | # Handles logic common to configuring gstreamer plugins |
|
|
209 | gst-plugins10_src_configure() { |
|
|
210 | local plugin gst_conf |
|
|
211 | |
|
|
212 | if has ${EAPI:-0} 0 1 2 3 ; then |
|
|
213 | gst_conf="${gst_conf} --disable-dependency-tracking" |
|
|
214 | fi |
|
|
215 | |
|
|
216 | if has ${EAPI:-0} 0 1 2 3 4 ; then |
|
|
217 | gst_conf="${gst_conf} --disable-silent-rules" |
|
|
218 | fi |
|
|
219 | |
|
|
220 | gst-plugins10_get_plugins |
|
|
221 | |
|
|
222 | for plugin in ${GST_PLUGINS_LIST} ; do |
|
|
223 | if has ${plugin} ${GST_PLUGINS_BUILD} ; then |
|
|
224 | gst_conf="${gst_conf} --enable-${plugin}" |
|
|
225 | else |
|
|
226 | gst_conf="${gst_conf} --disable-${plugin}" |
|
|
227 | fi |
|
|
228 | done |
|
|
229 | |
|
|
230 | if grep -q "ORC_CHECK" configure.* ; then |
|
|
231 | if in_iuse orc ; then |
|
|
232 | gst_conf="${gst_conf} $(use_enable orc)" |
|
|
233 | else |
|
|
234 | gst_conf="${gst_conf} --disable-orc" |
|
|
235 | fi |
|
|
236 | fi |
|
|
237 | |
|
|
238 | if grep -q "AM_MAINTAINER_MODE" configure.* ; then |
|
|
239 | gst_conf="${gst_conf} --disable-maintainer-mode" |
|
|
240 | fi |
|
|
241 | |
|
|
242 | if grep -q "disable-schemas-compile" configure ; then |
|
|
243 | gst_conf="${gst_conf} --disable-schemas-compile" |
|
|
244 | fi |
|
|
245 | |
|
|
246 | if [[ ${PN} == ${GST_ORG_MODULE} ]]; then |
|
|
247 | gst_conf="${gst_conf} $(use_enable nls)" |
|
|
248 | fi |
|
|
249 | |
|
|
250 | einfo "Configuring to build ${GST_PLUGINS_BUILD} plugin(s) ..." |
|
|
251 | econf \ |
|
|
252 | --with-package-name="Gentoo GStreamer ebuild" \ |
|
|
253 | --with-package-origin="http://www.gentoo.org" \ |
|
|
254 | ${gst_conf} $@ |
|
|
255 | } |
|
|
256 | |
|
|
257 | # @FUNCTION: gst-plugins10_src_compile |
|
|
258 | # @DESCRIPTION: |
|
|
259 | # Compiles requested gstreamer plugin. |
|
|
260 | gst-plugins10_src_compile() { |
|
|
261 | local plugin_dir |
|
|
262 | |
|
|
263 | has ${EAPI:-0} 0 1 && gst-plugins10_src_configure "$@" |
|
|
264 | |
|
|
265 | for plugin_dir in ${GST_PLUGINS_BUILD_DIR} ; do |
|
|
266 | gst-plugins10_find_plugin_dir ${plugin_dir} |
|
|
267 | |
|
|
268 | if has "${EAPI:-0}" 0 1 2 3 ; then |
|
|
269 | emake || die |
|
|
270 | else |
|
|
271 | default |
|
|
272 | fi |
|
|
273 | done |
|
|
274 | } |
|
|
275 | |
|
|
276 | # @FUNCTION: gst-plugins10_src_install |
|
|
277 | # @DESCRIPTION: |
|
|
278 | # Installs requested gstreamer plugin. |
|
|
279 | gst-plugins10_src_install() { |
|
|
280 | local plugin_dir |
|
|
281 | |
|
|
282 | for plugin_dir in ${GST_PLUGINS_BUILD_DIR} ; do |
|
|
283 | gst-plugins10_find_plugin_dir ${plugin_dir} |
|
|
284 | |
|
|
285 | if has "${EAPI:-0}" 0 1 2 3 ; then |
|
|
286 | emake install DESTDIR="${D}" || die |
|
|
287 | [[ -e README ]] && dodoc README |
|
|
288 | else |
|
|
289 | default |
|
|
290 | fi |
|
|
291 | done |
|
|
292 | |
|
|
293 | [[ ${GST_LA_PUNT} = "yes" ]] && prune_libtool_files --modules |
|
|
294 | } |
|
|
295 | |