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