blob: 5b14de672080bf1aae572510d864652dd4bf0023 [file] [log] [blame]
kenton@google.com2f3d8de2008-12-05 18:05:46 +00001#! /bin/sh
2
3# This script takes the result of "make dist" and:
4# 1) Unpacks it.
5# 2) Ensures all contents are user-writable. Some version control systems
6# keep code read-only until you explicitly ask to edit it, and the normal
7# "make dist" process does not correct for this, so the result is that
8# the entire dist is still marked read-only when unpacked, which is
9# annoying. So, we fix it.
10# 3) Convert MSVC project files to MSVC 2005, so that anyone who has version
11# 2005 *or* 2008 can open them. (In version control, we keep things in
12# MSVC 2008 format since that's what we use in development.)
13# 4) Uses the result to create .tar.gz, .tar.bz2, and .zip versions and
14# deposites them in the "dist" directory. In the .zip version, all
15# non-testdata .txt files are converted to Windows-style line endings.
16# 5) Cleans up after itself.
17
Feng Xiao6936f172014-12-03 17:37:42 -080018if [ "$1" == "" ]; then
19 echo "USAGE: $0 DISTFILE" >&2
kenton@google.com2f3d8de2008-12-05 18:05:46 +000020 exit 1
21fi
22
23if [ ! -e $1 ]; then
24 echo $1": File not found." >&2
25 exit 1
26fi
27
28set -ex
29
Adam Cozzette9b77e9e2018-06-01 16:33:15 -070030LANGUAGES="cpp csharp java js objectivec python ruby php all"
kenton@google.com2f3d8de2008-12-05 18:05:46 +000031BASENAME=`basename $1 .tar.gz`
Feng Xiao6936f172014-12-03 17:37:42 -080032VERSION=${BASENAME:9}
kenton@google.com2f3d8de2008-12-05 18:05:46 +000033
34# Create a directory called "dist", copy the tarball there and unpack it.
35mkdir dist
36cp $1 dist
37cd dist
38tar zxvf $BASENAME.tar.gz
39rm $BASENAME.tar.gz
40
41# Set the entire contents to be user-writable.
42chmod -R u+w $BASENAME
Feng Xiaofecc3d52015-08-26 15:33:22 -070043cd $BASENAME
kenton@google.com2f3d8de2008-12-05 18:05:46 +000044
Feng Xiao6936f172014-12-03 17:37:42 -080045for LANG in $LANGUAGES; do
46 # Build the dist again in .tar.gz
47 ./configure DIST_LANG=$LANG
48 make dist-gzip
49 mv $BASENAME.tar.gz ../protobuf-$LANG-$VERSION.tar.gz
50done
kenton@google.com2f3d8de2008-12-05 18:05:46 +000051
52# Convert all text files to use DOS-style line endings, then build a .zip
53# distribution.
54todos *.txt */*.txt
kenton@google.com2f3d8de2008-12-05 18:05:46 +000055
Feng Xiao6936f172014-12-03 17:37:42 -080056for LANG in $LANGUAGES; do
57 # Build the dist again in .zip
58 ./configure DIST_LANG=$LANG
59 make dist-zip
60 mv $BASENAME.zip ../protobuf-$LANG-$VERSION.zip
61done
62
kenton@google.com2f3d8de2008-12-05 18:05:46 +000063cd ..
64rm -rf $BASENAME