#! /bin/sh
#
# The sources are provided for reference only.
# Binary packages are not built from these sources.
# - jw@suse.de

name=gst-fluendo-mp3
svn=https://core.fluendo.com/gstreamer/svn/trunk/$name
export today=`date +%Y%m%d`
export tarball=$name-$today.tar.bz2

rm -rf $name
svn co $svn
# Remove files with unclear proprietary licenses
rm $name/src/mp3-ipp.* $name/src/table-dewindow-ipp.h
# Remove the 10 last lines of COPYING which reference
# unclear proprietary licenses
head -n -10 $name/COPYING > $name/COPYING.new
mv $name/COPYING.new $name/COPYING

tar jcvf $tarball --exclude .svn $name
cp $name/ChangeLog .
rm -rf $name
echo "$tarball written."

if [ -f "$name.spec" ]; then
  mv $name.spec $name.spec.old
  sed -e "s@^Source:\s.*\$@Source:         $tarball@" $name.spec.old > $name.spec
  echo "$name.spec <-- $tarball"
fi
