gstreamer-plugins-bad-free/gst-p-bad-cleanup.sh

190 lines
3.2 KiB
Bash
Raw Normal View History

2010-02-01 10:20:52 +00:00
#!/bin/sh
# Process a gst-plugins-bad tarball to remove
# unwanted GStreamer plugins.
#
# See https://bugzilla.redhat.com/show_bug.cgi?id=532470
# for details
#
# Bastien Nocera <bnocera@redhat.com> - 2010
#
2010-05-14 22:07:27 +00:00
SOURCE="$1"
2010-02-01 10:20:52 +00:00
NEW_SOURCE=`echo $SOURCE | sed 's/bad-/bad-free-/'`
2012-02-28 19:21:17 +00:00
DIRECTORY=`echo $SOURCE | sed 's/\.tar\.xz//'`
2010-02-01 10:20:52 +00:00
ALLOWED="
aacparse
adpcmdec
2010-02-25 08:17:27 +00:00
adpcmenc
2010-02-01 10:20:52 +00:00
aiff
aiffparse
amrparse
asfmux
2010-02-25 08:17:27 +00:00
audioparsers
2012-02-28 19:21:17 +00:00
audiovisualizers
2010-02-01 10:20:52 +00:00
autoconvert
bayer
camerabin
2011-01-12 10:59:45 +00:00
camerabin2
2010-02-01 10:20:52 +00:00
cdxaparse
2010-09-06 11:15:54 +00:00
coloreffects
2011-01-12 10:59:45 +00:00
colorspace
2010-02-25 08:17:27 +00:00
dataurisrc
2010-02-01 10:20:52 +00:00
dccp
debugutils
dtmf
2012-02-28 19:21:17 +00:00
faceoverlay
2010-02-01 10:20:52 +00:00
festival
2011-04-19 19:47:12 +00:00
fieldanalysis
2012-02-28 19:21:17 +00:00
freeverb
2010-02-01 10:20:52 +00:00
freeze
frei0r
2010-09-06 11:15:54 +00:00
gaudieffects
geometrictransform
2010-02-01 10:20:52 +00:00
h264parse
hdvparse
2011-04-19 19:47:12 +00:00
hls
2010-02-01 10:20:52 +00:00
id3tag
2012-02-28 19:21:17 +00:00
inter
2011-01-12 10:59:45 +00:00
interlace
2010-05-14 22:07:27 +00:00
invtelecine
2010-09-06 11:15:54 +00:00
ivfparse
2010-02-25 08:17:27 +00:00
jpegformat
2011-01-12 10:59:45 +00:00
jp2kdecimator
2010-02-01 10:20:52 +00:00
legacyresample
librfb
liveadder
mve
mpegdemux
mpeg4videoparse
mpegpsmux
2011-04-19 19:47:12 +00:00
mpegtsdemux
mpegtsmux
2010-02-01 10:20:52 +00:00
mpegvideoparse
mxf
nsf
nuvdemux
2011-04-19 19:47:12 +00:00
patchdetect
2010-02-01 10:20:52 +00:00
pcapparse
pnm
qtmux
2010-02-01 10:20:52 +00:00
rawparse
2012-02-28 19:21:17 +00:00
removesilence
2010-02-01 10:20:52 +00:00
rtpmux
2011-04-19 19:47:12 +00:00
rtpvp8
2010-02-01 10:20:52 +00:00
scaletempo
2011-04-19 19:47:12 +00:00
sdi
2010-02-01 10:20:52 +00:00
sdp
2010-05-14 22:07:27 +00:00
segmentclip
2010-02-01 10:20:52 +00:00
selector
2012-02-28 19:21:17 +00:00
smooth
2010-02-01 10:20:52 +00:00
speed
stereo
subenc
tta
valve
2011-04-19 19:47:12 +00:00
videofilters
2010-09-06 11:15:54 +00:00
videomaxrate
2010-02-01 10:20:52 +00:00
videomeasure
2011-04-19 19:47:12 +00:00
videoparsers
2010-02-01 10:20:52 +00:00
videosignal
vmnc
2011-01-12 10:59:45 +00:00
y4m
2010-02-01 10:20:52 +00:00
"
NOT_ALLOWED="
2011-01-12 10:59:45 +00:00
dvbsuboverlay
2010-02-01 10:20:52 +00:00
dvdspu
real
siren
"
error()
{
MESSAGE=$1
echo $MESSAGE
exit 1
}
check_allowed()
{
MODULE=$1
for i in $ALLOWED ; do
if test x$MODULE = x$i ; then
return 0;
fi
done
# Ignore errors coming from ext/ directory
# they require external libraries so are ineffective anyway
return 1;
}
check_not_allowed()
{
MODULE=$1
for i in $NOT_ALLOWED ; do
if test x$MODULE = x$i ; then
return 0;
fi
done
return 1;
}
rm -rf $DIRECTORY
2012-02-28 19:21:17 +00:00
tar xJf $SOURCE || error "Cannot unpack $SOURCE"
2010-02-01 10:20:52 +00:00
pushd $DIRECTORY > /dev/null || error "Cannot open directory \"$DIRECTORY\""
unknown=""
2010-02-01 10:20:52 +00:00
for subdir in gst ext sys; do
for dir in $subdir/* ; do
# Don't touch non-directories
if ! [ -d $dir ] ; then
continue;
fi
MODULE=`basename $dir`
if ( check_not_allowed $MODULE ) ; then
echo "**** Removing $MODULE ****"
echo "Removing directory $dir"
rm -r $dir || error "Cannot remove $dir"
if grep -q "AG_GST_CHECK_PLUGIN($MODULE)" configure.ac ; then
echo "Removing element check for $MODULE"
grep -v "AG_GST_CHECK_PLUGIN($MODULE)" configure.ac > configure.ac.new && mv configure.ac.new configure.ac
fi
echo "Removing Makefile generation for $MODULE"
grep -v "$dir/Makefile" configure.ac > configure.ac.new && mv configure.ac.new configure.ac
# Urgh
if test $MODULE = real ; then
grep -v "AG_GST_DISABLE_PLUGIN(real)" configure.ac > configure.ac.new && mv configure.ac.new configure.ac
fi
echo "Removing documentation for $MODULE"
if grep -q "$MODULE" docs/plugins/Makefile.am ; then
grep -v $dir docs/plugins/Makefile.am > docs/plugins/Makefile.am.new && mv docs/plugins/Makefile.am.new docs/plugins/Makefile.am
fi
echo
elif test $subdir = ext || test $subdir = sys; then
# Ignore library or system non-blacklisted plugins
continue;
elif ! ( check_allowed $MODULE ) ; then
echo "Unknown module in $dir"
unknown="$unknown $dir"
2010-02-01 10:20:52 +00:00
fi
done
done
echo
if test "x$unknown" != "x"; then
echo -n "Aborting due to unkown modules: "
echo "$unknown" | sed "s/ /\n /g"
exit 1
fi
2010-02-01 10:20:52 +00:00
autoreconf
popd > /dev/null
2012-02-28 19:21:17 +00:00
tar cJf $NEW_SOURCE $DIRECTORY
2010-02-01 10:20:52 +00:00
echo "$NEW_SOURCE is ready to use"