| 1 |
#!/bin/sh
|
| 2 |
|
| 3 |
set -ex
|
| 4 |
|
| 5 |
UPSTREAM_VERSION=$2
|
| 6 |
ORIG_TARBALL=$3
|
| 7 |
|
| 8 |
REAL_TARBALL=`readlink -f ${ORIG_TARBALL}`
|
| 9 |
|
| 10 |
WORKING_DIR=`dirname ${ORIG_TARBALL}`
|
| 11 |
|
| 12 |
ORIG_TARBALL_DFSG=`echo ${ORIG_TARBALL} | sed -e "s/\(${UPSTREAM_VERSION}\)\(\.orig\)/\1+dfsg\2/g"`
|
| 13 |
ORIG_TARBALL_DIR=`echo ${ORIG_TARBALL_DFSG} | sed -e "s/_\(${UPSTREAM_VERSION}\)/-\1/g" -e "s/\.tar\.gz//g"`
|
| 14 |
ORIG_TARBALL_DIR_STRIP=`basename ${ORIG_TARBALL_DIR}`
|
| 15 |
|
| 16 |
mkdir -p ${ORIG_TARBALL_DIR}
|
| 17 |
tar --directory=${ORIG_TARBALL_DIR} --strip 1 -xzf ${REAL_TARBALL} || exit 1
|
| 18 |
rm -f ${ORIG_TARBALL} ${REAL_TARBALL}
|
| 19 |
# delete pre-built and shipped DLLs
|
| 20 |
find ${ORIG_TARBALL_DIR} -name "*.dll" | xargs rm
|
| 21 |
# delete internal copies for windows build
|
| 22 |
rm -rf ${ORIG_TARBALL_DIR}/windows*/
|
| 23 |
GZIP=-9 tar --remove-files --directory ${WORKING_DIR} -czf ${ORIG_TARBALL_DFSG} ${ORIG_TARBALL_DIR_STRIP} || exit 1
|
| 24 |
|
| 25 |
exit 0
|