post_process_dist.sh 1.9 KB

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