1ffe3c632Sopenharmony_ci#! /bin/sh 2ffe3c632Sopenharmony_ci 3ffe3c632Sopenharmony_ci# This script takes the result of "make dist" and: 4ffe3c632Sopenharmony_ci# 1) Unpacks it. 5ffe3c632Sopenharmony_ci# 2) Ensures all contents are user-writable. Some version control systems 6ffe3c632Sopenharmony_ci# keep code read-only until you explicitly ask to edit it, and the normal 7ffe3c632Sopenharmony_ci# "make dist" process does not correct for this, so the result is that 8ffe3c632Sopenharmony_ci# the entire dist is still marked read-only when unpacked, which is 9ffe3c632Sopenharmony_ci# annoying. So, we fix it. 10ffe3c632Sopenharmony_ci# 3) Convert MSVC project files to MSVC 2005, so that anyone who has version 11ffe3c632Sopenharmony_ci# 2005 *or* 2008 can open them. (In version control, we keep things in 12ffe3c632Sopenharmony_ci# MSVC 2008 format since that's what we use in development.) 13ffe3c632Sopenharmony_ci# 4) Uses the result to create .tar.gz, .tar.bz2, and .zip versions and 14ffe3c632Sopenharmony_ci# deposites them in the "dist" directory. In the .zip version, all 15ffe3c632Sopenharmony_ci# non-testdata .txt files are converted to Windows-style line endings. 16ffe3c632Sopenharmony_ci# 5) Cleans up after itself. 17ffe3c632Sopenharmony_ci 18ffe3c632Sopenharmony_ciif [ "$1" == "" ]; then 19ffe3c632Sopenharmony_ci echo "USAGE: $0 DISTFILE" >&2 20ffe3c632Sopenharmony_ci exit 1 21ffe3c632Sopenharmony_cifi 22ffe3c632Sopenharmony_ci 23ffe3c632Sopenharmony_ciif [ ! -e $1 ]; then 24ffe3c632Sopenharmony_ci echo $1": File not found." >&2 25ffe3c632Sopenharmony_ci exit 1 26ffe3c632Sopenharmony_cifi 27ffe3c632Sopenharmony_ci 28ffe3c632Sopenharmony_ciset -ex 29ffe3c632Sopenharmony_ci 30ffe3c632Sopenharmony_ciLANGUAGES="cpp csharp java js objectivec python ruby php all" 31ffe3c632Sopenharmony_ciBASENAME=`basename $1 .tar.gz` 32ffe3c632Sopenharmony_ciVERSION=${BASENAME:9} 33ffe3c632Sopenharmony_ci 34ffe3c632Sopenharmony_ci# Create a directory called "dist", copy the tarball there and unpack it. 35ffe3c632Sopenharmony_cimkdir dist 36ffe3c632Sopenharmony_cicp $1 dist 37ffe3c632Sopenharmony_cicd dist 38ffe3c632Sopenharmony_citar zxvf $BASENAME.tar.gz 39ffe3c632Sopenharmony_cirm $BASENAME.tar.gz 40ffe3c632Sopenharmony_ci 41ffe3c632Sopenharmony_ci# Set the entire contents to be user-writable. 42ffe3c632Sopenharmony_cichmod -R u+w $BASENAME 43ffe3c632Sopenharmony_cicd $BASENAME 44ffe3c632Sopenharmony_ci 45ffe3c632Sopenharmony_cifor LANG in $LANGUAGES; do 46ffe3c632Sopenharmony_ci # Build the dist again in .tar.gz 47ffe3c632Sopenharmony_ci ./configure DIST_LANG=$LANG 48ffe3c632Sopenharmony_ci make dist-gzip 49ffe3c632Sopenharmony_ci mv $BASENAME.tar.gz ../protobuf-$LANG-$VERSION.tar.gz 50ffe3c632Sopenharmony_cidone 51ffe3c632Sopenharmony_ci 52ffe3c632Sopenharmony_ci# Convert all text files to use DOS-style line endings, then build a .zip 53ffe3c632Sopenharmony_ci# distribution. 54ffe3c632Sopenharmony_citodos *.txt */*.txt 55ffe3c632Sopenharmony_ci 56ffe3c632Sopenharmony_cifor LANG in $LANGUAGES; do 57ffe3c632Sopenharmony_ci # Build the dist again in .zip 58ffe3c632Sopenharmony_ci ./configure DIST_LANG=$LANG 59ffe3c632Sopenharmony_ci make dist-zip 60ffe3c632Sopenharmony_ci mv $BASENAME.zip ../protobuf-$LANG-$VERSION.zip 61ffe3c632Sopenharmony_cidone 62ffe3c632Sopenharmony_ci 63ffe3c632Sopenharmony_cicd .. 64ffe3c632Sopenharmony_cirm -rf $BASENAME 65