post_process_dist.sh 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  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: $1 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. BASENAME=`basename $1 .tar.gz`
  26. # Create a directory called "dist", copy the tarball there and unpack it.
  27. mkdir dist
  28. cp $1 dist
  29. cd dist
  30. tar zxvf $BASENAME.tar.gz
  31. rm $BASENAME.tar.gz
  32. # Set the entire contents to be user-writable.
  33. chmod -R u+w $BASENAME
  34. # Convert the MSVC projects to MSVC 2005 format.
  35. cd $BASENAME/vsprojects
  36. ./convert2008to2005.sh
  37. cd ..
  38. # Build the dist again in .tar.gz and .tar.bz2 formats.
  39. ./configure
  40. make dist-gzip
  41. make dist-bzip2
  42. # Convert all text files to use DOS-style line endings, then build a .zip
  43. # distribution.
  44. todos *.txt */*.txt
  45. make dist-zip
  46. # Clean up.
  47. mv $BASENAME.tar.gz $BASENAME.tar.bz2 $BASENAME.zip ..
  48. cd ..
  49. rm -rf $BASENAME