File:  [ELWIX - Embedded LightWeight unIX -] / embedaddon / php / makedist
Revision 1.1: download - view: text, annotated - select for diffs - revision graph
Tue Feb 21 23:47:52 2012 UTC (12 years, 4 months ago) by misho
CVS tags: MAIN, HEAD
Initial revision

    1: #!/bin/sh
    2: #
    3: # Distribution generator for SVN based packages.
    4: # To work, this script needs a consistent tagging of all releases.
    5: # Each release of a package should have a tag of the form
    6: #
    7: #  <package>_<version>
    8: #
    9: # where <package> is the package name and the SVN module
   10: # and <version> s the version number with underscores instead of dots.
   11: #
   12: # For example: svn cp $PHPROOT/php/php-src/trunk $PHPROOT/php/php-src/tags/php_5_0_1
   13: #
   14: # The distribution ends up in a .tar.gz file that contains the distribution
   15: # in a directory called <package>-<version>.  The distribution contains all
   16: # directories from the SVN module except the one called "nodist", but only
   17: # the files INSTALL, README and config* are included.
   18: # A .tar.bz2 file is also created.
   19: #
   20: # Usage: makedist <package> <version>
   21: #
   22: # Written by Stig Bakken <ssb@guardian.no> 1997-05-28.
   23: #
   24: # $Id: makedist,v 1.1 2012/02/21 23:47:52 misho Exp $
   25: #
   26: 
   27: if test "$#" != "2"; then
   28:     echo "Usage: makedist <package> <version>" >&2
   29:     exit 1
   30: fi
   31: 
   32: PKG=$1 ; shift
   33: VER=$1 ; shift
   34: 
   35: old_IFS="$IFS"
   36: IFS=.
   37: eval set `bison --version| grep 'GNU Bison' | cut -d ' ' -f 4 | sed -e 's/\./ /'`
   38: if test "${1}" = "1" -a "${2}" -lt "28"; then
   39:   echo "You will need bison 1.28 if you want to regenerate the Zend parser (found ${1}.${2}).)"
   40:   exit 10
   41: fi
   42: IFS="$old_IFS"
   43: 
   44: PHPROOT=http://svn.php.net/repository
   45: PHPMOD=php/php-src
   46: LT_TARGETS='ltconfig ltmain.sh config.guess config.sub'
   47: 
   48: if echo '\c' | grep -s c >/dev/null 2>&1
   49: then
   50:     ECHO_N="echo -n"
   51:     ECHO_C=""
   52: else
   53:     ECHO_N="echo"
   54:     ECHO_C='\c'
   55: fi
   56: 
   57: MY_OLDPWD=`pwd`
   58: 
   59: # the destination .tar.gz file
   60: ARCHIVE=$MY_OLDPWD/$PKG-$VER.tar
   61: 
   62: # temporary directory used to check out files from SVN
   63: DIR=$PKG-$VER
   64: DIRPATH=$MY_OLDPWD/$DIR
   65: 
   66: if test -d "$DIRPATH"; then
   67:     echo "The directory $DIR"
   68:     echo "already exists, rename or remove it and run makedist again."
   69:     exit 1
   70: fi
   71: 
   72: # version part of the SVN release tag
   73: SVNVER=`echo $VER | sed -e 's/[\.\-]/_/g'`
   74: 
   75: # SVN release tag
   76: if test "$VER" != "HEAD" -a "$VER" != "trunk"; then
   77:   SVNTAG=tags/${PKG}_$SVNVER
   78: else
   79:   SVNTAG=trunk
   80: fi
   81: 
   82: #if test ! -d $DIRPATH; then
   83: #    mkdir -p $DIRPATH || exit 2
   84: #fi
   85: 
   86: # Export PHP
   87: $ECHO_N "makedist: exporting tag '$SVNTAG' from '$PHPMOD'...$ECHO_C"
   88: svn export $PHPROOT/$PHPMOD/$SVNTAG $DIRPATH || exit 4
   89: echo ""
   90: 
   91: # remove SVN stuff...
   92: cd $DIR || exit 5
   93: find . \( -name .svn -type d \) -exec rm -rf {} \;
   94: 
   95: # The full ChangeLog is available separately from lxr.php.net
   96: rm -f ChangeLog*
   97: 
   98: # hide away our own versions of libtool-generated files
   99: for i in $LT_TARGETS; do
  100:   if test -f "$i"; then
  101:     mv $i $i.bak
  102:     cp $i.bak $i
  103:   fi
  104: done
  105: 
  106: # generate some files so people don't need bison, flex and autoconf
  107: # to install
  108: set -x
  109: ./buildconf --copy --force
  110: 
  111: # remove buildmk.stamp. Otherwise, buildcheck.sh might not be run,
  112: # when a user runs buildconf in the distribution.
  113: rm -f buildmk.stamp
  114: 
  115: ./genfiles
  116: 
  117: # now restore our versions of libtool-generated files
  118: for i in $LT_TARGETS; do
  119:   test -f "$i" && mv $i.bak $i
  120: done
  121: 
  122: # download pear 
  123: $ECHO_N "makedist: Attempting to download PEAR's phar archive"
  124: if test ! -x wget; then
  125: 	wget http://pear.php.net/install-pear-nozlib.phar -nd -P pear/
  126: else
  127: 	$ECHO_N "Missing wget binary needed for pear download";
  128: 	exit 0;
  129: fi
  130: 
  131: cd $MY_OLDPWD
  132: $ECHO_N "makedist: making gzipped tar archive...$ECHO_C"
  133: rm -f $ARCHIVE.gz
  134: tar cf $ARCHIVE $PKG-$VER || exit 8
  135: gzip -9 $ARCHIVE || exit 9
  136: echo ""
  137: 
  138: $ECHO_N "makedist: making bz2zipped tar archive...$ECHO_C"
  139: rm -f $ARCHIVE.bz2
  140: tar cf $ARCHIVE $PKG-$VER || exit 10
  141: bzip2 -9 $ARCHIVE || exit 11
  142: echo ""
  143: 
  144: $ECHO_N "makedist: cleaning up...$ECHO_C"
  145: rm -rf $DIRPATH || exit 12
  146: echo ""
  147: 
  148: exit 0

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>