4a8f1f
#!/bin/bash
4a8f1f
set -e
4a8f1f
4a8f1f
name=antlr
4a8f1f
version="$(sed -n 's/Version:\s*//p' *.spec)"
4a8f1f
4a8f1f
# RETRIEVE
4a8f1f
wget "http://www.antlr2.org/download/antlr-${version}.tar.gz" -O "${name}-${version}.orig.tar.gz"
4a8f1f
4a8f1f
rm -rf tarball-tmp
4a8f1f
mkdir tarball-tmp
4a8f1f
cd tarball-tmp
4a8f1f
tar -xf "../${name}-${version}.orig.tar.gz"
4a8f1f
4a8f1f
# CLEAN TARBALL
4a8f1f
# contain questionable things, such as csflex.exe
4a8f1f
find -name '*.jar' -delete
4a8f1f
find -name '*.class' -delete
4a8f1f
find -name '*.exe' -delete
4a8f1f
find -name '*.dll' -delete
4a8f1f
find -name '*.so' -delete
4a8f1f
4a8f1f
# rhbz#1986062
4a8f1f
rm "antlr-${version}/examples/java/unicode.IDENTs/StreamConverter.java"
4a8f1f
rm "antlr-${version}/examples/java/unicode.IDENTs/ShowString.java"
4a8f1f
4a8f1f
tar -czf "../${name}-${version}.tar.gz" *
4a8f1f
cd ..
4a8f1f
rm -r tarball-tmp "${name}-${version}.orig.tar.gz"