post_process_dist.sh 1.8 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
#! /bin/sh

# This script takes the result of "make dist" and:
# 1) Unpacks it.
# 2) Ensures all contents are user-writable.  Some version control systems
#    keep code read-only until you explicitly ask to edit it, and the normal
#    "make dist" process does not correct for this, so the result is that
#    the entire dist is still marked read-only when unpacked, which is
#    annoying.  So, we fix it.
# 3) Convert MSVC project files to MSVC 2005, so that anyone who has version
#    2005 *or* 2008 can open them.  (In version control, we keep things in
#    MSVC 2008 format since that's what we use in development.)
# 4) Uses the result to create .tar.gz, .tar.bz2, and .zip versions and
#    deposites them in the "dist" directory.  In the .zip version, all
#    non-testdata .txt files are converted to Windows-style line endings.
# 5) Cleans up after itself.

18 19
if [ "$1" == "" ]; then
  echo "USAGE:  $0 DISTFILE" >&2
20 21 22 23 24 25 26 27 28 29
  exit 1
fi

if [ ! -e $1 ]; then
  echo $1": File not found." >&2
  exit 1
fi

set -ex

Bo Yang's avatar
Bo Yang committed
30
LANGUAGES="cpp csharp java javanano js objectivec python ruby php"
31
BASENAME=`basename $1 .tar.gz`
32
VERSION=${BASENAME:9}
33 34 35 36 37 38 39 40 41 42

# Create a directory called "dist", copy the tarball there and unpack it.
mkdir dist
cp $1 dist
cd dist
tar zxvf $BASENAME.tar.gz
rm $BASENAME.tar.gz

# Set the entire contents to be user-writable.
chmod -R u+w $BASENAME
43
cd $BASENAME
44

45 46 47 48 49 50
for LANG in $LANGUAGES; do
  # Build the dist again in .tar.gz
  ./configure DIST_LANG=$LANG
  make dist-gzip
  mv $BASENAME.tar.gz ../protobuf-$LANG-$VERSION.tar.gz
done
51 52 53 54 55

# Convert all text files to use DOS-style line endings, then build a .zip
# distribution.
todos *.txt */*.txt

56 57 58 59 60 61 62
for LANG in $LANGUAGES; do
  # Build the dist again in .zip
  ./configure DIST_LANG=$LANG
  make dist-zip
  mv $BASENAME.zip ../protobuf-$LANG-$VERSION.zip
done

63 64
cd ..
rm -rf $BASENAME