makedist 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. #!/bin/sh
  2. #
  3. # Distribution generator for git
  4. #
  5. # Usage: makedist version
  6. # Example: makedist 5.4.1
  7. # Example: makedist 5.3.5RC1
  8. #
  9. # To work, this script needs a consistent tagging of all releases.
  10. # Each release of a package should have a tag of the form
  11. #
  12. # php-X.Y.Z[sub]
  13. #
  14. # The distribution ends up in a .tar.gz file that contains the distribution
  15. # in a directory called php-<version>.
  16. # A .tar.bz2 file is also created.
  17. #
  18. # Written by Stig Bakken <ssb@guardian.no> 1997-05-28.
  19. # Adapted to git by Stanislav Malyshev <stas@php.net>
  20. if test "$#" != "1"; then
  21. echo "Usage: makedist <version>" >&2
  22. exit 1
  23. fi
  24. VER=$1 ; shift
  25. old_IFS="$IFS"
  26. IFS=.
  27. eval set `bison --version| grep 'GNU Bison' | cut -d ' ' -f 4 | sed -e 's/\./ /'`
  28. if test "${1}" = "1" -a "${2}" -lt "28"; then
  29. echo "You will need bison 1.28 if you want to regenerate the Zend parser (found ${1}.${2}).)"
  30. exit 2
  31. fi
  32. IFS="$old_IFS"
  33. if test "x$PHPROOT" == "x"; then
  34. PHPROOT=git@git.php.net:php-src.git;
  35. fi
  36. LT_TARGETS='ltconfig ltmain.sh config.guess config.sub'
  37. if echo '\c' | grep -s c >/dev/null 2>&1
  38. then
  39. ECHO_N="echo -n"
  40. ECHO_C=""
  41. else
  42. ECHO_N="echo"
  43. ECHO_C='\c'
  44. fi
  45. MY_OLDPWD=`pwd`
  46. # the destination .tar.gz file
  47. ARCHIVE=$MY_OLDPWD/php-$VER.tar
  48. # temporary directory used to check out files from SVN
  49. DIR=php-$VER
  50. DIRPATH=$MY_OLDPWD/$DIR
  51. if test -d "$DIRPATH"; then
  52. echo "The directory $DIR"
  53. echo "already exists, rename or remove it and run makedist again."
  54. exit 1
  55. fi
  56. # Export PHP
  57. $ECHO_N "makedist: exporting tag 'php-$VER' from '$PHPROOT'...$ECHO_C"
  58. git archive --format=tar --remote=$PHPROOT refs/tags/php-$VER --prefix=php-$VER/ | (cd $MY_OLDPWD; tar xvf -) || exit 4
  59. echo ""
  60. cd $DIR || exit 5
  61. # hide away our own versions of libtool-generated files
  62. for i in $LT_TARGETS; do
  63. if test -f "$i"; then
  64. mv $i $i.bak
  65. cp $i.bak $i
  66. fi
  67. done
  68. # generate some files so people don't need bison, flex and autoconf
  69. # to install
  70. set -x
  71. ./buildconf --copy --force
  72. # remove buildmk.stamp. Otherwise, buildcheck.sh might not be run,
  73. # when a user runs buildconf in the distribution.
  74. rm -f buildmk.stamp
  75. ./genfiles
  76. # now restore our versions of libtool-generated files
  77. for i in $LT_TARGETS; do
  78. test -f "$i" && mv $i.bak $i
  79. done
  80. # removing junk files
  81. find . -name \*.orig -print0 | xargs -0 rm
  82. rm -fr autom4te.cache/
  83. # download pear
  84. $ECHO_N "makedist: Attempting to download PEAR's phar archive"
  85. if test ! -x wget; then
  86. wget http://pear.php.net/install-pear-nozlib.phar -nd -P pear/
  87. else
  88. $ECHO_N "Missing wget binary needed for pear download";
  89. exit 7
  90. fi
  91. cd $MY_OLDPWD
  92. $ECHO_N "makedist: making gzipped tar archive...$ECHO_C"
  93. rm -f $ARCHIVE.gz
  94. tar cf $ARCHIVE php-$VER || exit 8
  95. gzip -9 $ARCHIVE || exit 9
  96. echo ""
  97. $ECHO_N "makedist: making bz2zipped tar archive...$ECHO_C"
  98. rm -f $ARCHIVE.bz2
  99. tar cf $ARCHIVE php-$VER || exit 10
  100. bzip2 -9 $ARCHIVE || exit 11
  101. echo ""
  102. $ECHO_N "makedist: making xz2zipped tar archive...$ECHO_C"
  103. rm -f $ARCHIVE.xz
  104. tar cf $ARCHIVE php-$VER || exit 10
  105. xz -9 $ARCHIVE || exit 12
  106. echo ""
  107. $ECHO_N "makedist: cleaning up...$ECHO_C"
  108. rm -rf $DIRPATH || exit 13
  109. echo ""
  110. exit 0