1999-04-08 05:05:13 +08:00
|
|
|
#!/bin/sh
|
|
|
|
#
|
2012-03-20 13:28:16 +08:00
|
|
|
# Distribution generator for git
|
1999-04-08 05:05:13 +08:00
|
|
|
#
|
2012-03-20 13:28:16 +08:00
|
|
|
# Usage: makedist version
|
|
|
|
# Example: makedist 5.4.1
|
2012-03-30 15:01:29 +08:00
|
|
|
# Example: makedist 5.3.5RC1
|
1999-04-08 05:05:13 +08:00
|
|
|
#
|
2012-03-20 13:28:16 +08:00
|
|
|
# To work, this script needs a consistent tagging of all releases.
|
|
|
|
# Each release of a package should have a tag of the form
|
1999-04-08 05:05:13 +08:00
|
|
|
#
|
2012-03-30 15:01:29 +08:00
|
|
|
# php-X.Y.Z[sub]
|
1999-04-08 05:05:13 +08:00
|
|
|
#
|
|
|
|
# The distribution ends up in a .tar.gz file that contains the distribution
|
2012-03-20 13:28:16 +08:00
|
|
|
# in a directory called php-<version>.
|
2009-07-15 05:49:44 +08:00
|
|
|
# A .tar.bz2 file is also created.
|
2012-03-20 13:28:16 +08:00
|
|
|
#
|
1999-04-08 05:05:13 +08:00
|
|
|
# Written by Stig Bakken <ssb@guardian.no> 1997-05-28.
|
2012-03-20 13:28:16 +08:00
|
|
|
# Adapted to git by Stanislav Malyshev <stas@php.net>
|
1999-04-08 05:05:13 +08:00
|
|
|
|
2012-03-20 13:28:16 +08:00
|
|
|
|
|
|
|
if test "$#" != "1"; then
|
|
|
|
echo "Usage: makedist <version>" >&2
|
2000-06-26 06:48:02 +08:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
VER=$1 ; shift
|
|
|
|
|
|
|
|
old_IFS="$IFS"
|
|
|
|
IFS=.
|
2015-08-10 16:34:26 +08:00
|
|
|
eval set `bison --version| grep 'GNU Bison' | cut -d ' ' -f 4 | sed -e 's/\./ /g'`
|
2015-08-10 16:40:14 +08:00
|
|
|
if test "${1}" -lt "3" -o "${1}" = "3" -a "${2}" -eq "0" -a "${3}" -lt "2"; then
|
2015-08-10 16:42:10 +08:00
|
|
|
echo "You will need bison >= 3.0.2 if you want to regenerate the Zend parser (found ${1}.${2}.${3})."
|
2012-03-20 13:28:16 +08:00
|
|
|
exit 2
|
2000-06-26 06:48:02 +08:00
|
|
|
fi
|
2015-08-10 16:40:14 +08:00
|
|
|
eval set `re2c --version| grep 're2c' | cut -d ' ' -f 2 | sed -e 's/\./ /g'`
|
|
|
|
if test "${2}" -lt "13" -o "${2}" -eq "13" -a "${3}" -lt "5"; then
|
2015-08-10 16:43:53 +08:00
|
|
|
echo "You will need re2c >= 0.13.5 if you want to regenerate the Zend scanner (found ${1}.${2}.${3})."
|
2015-08-10 16:40:14 +08:00
|
|
|
exit 2
|
|
|
|
fi
|
2000-06-26 06:48:02 +08:00
|
|
|
IFS="$old_IFS"
|
2000-05-24 04:32:27 +08:00
|
|
|
|
2017-12-17 05:31:10 +08:00
|
|
|
if test "x$PHPROOT" = "x"; then
|
2013-03-20 22:16:24 +08:00
|
|
|
PHPROOT=git@git.php.net:php-src.git;
|
|
|
|
fi
|
|
|
|
|
1999-11-10 23:26:39 +08:00
|
|
|
LT_TARGETS='ltconfig ltmain.sh config.guess config.sub'
|
1999-04-08 05:05:13 +08:00
|
|
|
|
|
|
|
if echo '\c' | grep -s c >/dev/null 2>&1
|
|
|
|
then
|
|
|
|
ECHO_N="echo -n"
|
|
|
|
ECHO_C=""
|
|
|
|
else
|
|
|
|
ECHO_N="echo"
|
|
|
|
ECHO_C='\c'
|
|
|
|
fi
|
|
|
|
|
1999-07-17 19:59:37 +08:00
|
|
|
MY_OLDPWD=`pwd`
|
1999-04-08 05:05:13 +08:00
|
|
|
|
|
|
|
# the destination .tar.gz file
|
2012-03-20 13:28:16 +08:00
|
|
|
ARCHIVE=$MY_OLDPWD/php-$VER.tar
|
1999-04-08 05:05:13 +08:00
|
|
|
|
2009-07-15 05:49:44 +08:00
|
|
|
# temporary directory used to check out files from SVN
|
2012-03-20 13:28:16 +08:00
|
|
|
DIR=php-$VER
|
1999-11-09 00:17:53 +08:00
|
|
|
DIRPATH=$MY_OLDPWD/$DIR
|
1999-04-08 05:05:13 +08:00
|
|
|
|
1999-11-09 00:17:53 +08:00
|
|
|
if test -d "$DIRPATH"; then
|
|
|
|
echo "The directory $DIR"
|
1999-11-04 17:52:44 +08:00
|
|
|
echo "already exists, rename or remove it and run makedist again."
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
1999-11-09 19:56:27 +08:00
|
|
|
# Export PHP
|
2012-03-30 15:01:29 +08:00
|
|
|
$ECHO_N "makedist: exporting tag 'php-$VER' from '$PHPROOT'...$ECHO_C"
|
|
|
|
git archive --format=tar --remote=$PHPROOT refs/tags/php-$VER --prefix=php-$VER/ | (cd $MY_OLDPWD; tar xvf -) || exit 4
|
1999-04-08 05:05:13 +08:00
|
|
|
echo ""
|
|
|
|
|
2003-01-28 10:49:35 +08:00
|
|
|
cd $DIR || exit 5
|
1999-04-08 05:05:13 +08:00
|
|
|
|
1999-11-10 23:26:39 +08:00
|
|
|
# hide away our own versions of libtool-generated files
|
|
|
|
for i in $LT_TARGETS; do
|
|
|
|
if test -f "$i"; then
|
|
|
|
mv $i $i.bak
|
|
|
|
cp $i.bak $i
|
|
|
|
fi
|
|
|
|
done
|
1999-11-10 00:57:26 +08:00
|
|
|
|
1999-04-08 05:05:13 +08:00
|
|
|
# generate some files so people don't need bison, flex and autoconf
|
|
|
|
# to install
|
|
|
|
set -x
|
2003-05-22 08:31:31 +08:00
|
|
|
./buildconf --copy --force
|
1999-10-05 22:12:43 +08:00
|
|
|
|
2000-08-25 03:23:11 +08:00
|
|
|
# remove buildmk.stamp. Otherwise, buildcheck.sh might not be run,
|
|
|
|
# when a user runs buildconf in the distribution.
|
|
|
|
rm -f buildmk.stamp
|
|
|
|
|
1999-10-05 22:12:43 +08:00
|
|
|
./genfiles
|
|
|
|
|
1999-11-10 23:26:39 +08:00
|
|
|
# now restore our versions of libtool-generated files
|
|
|
|
for i in $LT_TARGETS; do
|
|
|
|
test -f "$i" && mv $i.bak $i
|
|
|
|
done
|
1999-11-10 00:57:26 +08:00
|
|
|
|
2012-03-20 13:28:16 +08:00
|
|
|
# removing junk files
|
|
|
|
find . -name \*.orig -print0 | xargs -0 rm
|
|
|
|
rm -fr autom4te.cache/
|
|
|
|
|
2015-06-28 04:06:15 +08:00
|
|
|
# touching everything to be packaged
|
2015-06-28 05:38:48 +08:00
|
|
|
find $MY_OLDPWD/php-$VER -exec touch -c {} \;
|
2015-06-28 04:06:15 +08:00
|
|
|
|
2015-06-28 06:10:41 +08:00
|
|
|
# tweak zendparse to be exported through ZEND_API
|
|
|
|
# NOTE this has to be revisited once bison supports foreign skeletons
|
|
|
|
# and that bison version is used. Read /usr/share/bison/README for more
|
|
|
|
sed -i 's,^int zendparse\(.*\),ZEND_API int zendparse\1,g' $MY_OLDPWD/php-$VER/Zend/zend_language_parser.c
|
|
|
|
sed -i 's,^int zendparse\(.*\),ZEND_API int zendparse\1,g' $MY_OLDPWD/php-$VER/Zend/zend_language_parser.h
|
|
|
|
sed -i 's,^#ifndef YYTOKENTYPE,#include "zend.h"\n#ifndef YYTOKENTYPE,g' $MY_OLDPWD/php-$VER/Zend/zend_language_parser.h
|
|
|
|
|
2006-05-12 22:54:10 +08:00
|
|
|
# download pear
|
|
|
|
$ECHO_N "makedist: Attempting to download PEAR's phar archive"
|
|
|
|
if test ! -x wget; then
|
2015-10-07 19:56:47 +08:00
|
|
|
wget https://pear.php.net/install-pear-nozlib.phar -nd -P pear/
|
2015-11-16 01:57:10 +08:00
|
|
|
if [ "x$?" != "x0" ]
|
|
|
|
then
|
|
|
|
$ECHO_N "Pear download failed";
|
|
|
|
exit 7
|
|
|
|
fi
|
2006-05-12 22:54:10 +08:00
|
|
|
else
|
|
|
|
$ECHO_N "Missing wget binary needed for pear download";
|
2012-03-20 13:28:16 +08:00
|
|
|
exit 7
|
2006-05-12 22:54:10 +08:00
|
|
|
fi
|
|
|
|
|
1999-11-09 00:17:53 +08:00
|
|
|
cd $MY_OLDPWD
|
1999-04-08 05:05:13 +08:00
|
|
|
$ECHO_N "makedist: making gzipped tar archive...$ECHO_C"
|
2002-10-11 03:01:34 +08:00
|
|
|
rm -f $ARCHIVE.gz
|
2012-03-20 13:28:16 +08:00
|
|
|
tar cf $ARCHIVE php-$VER || exit 8
|
2000-05-07 08:18:06 +08:00
|
|
|
gzip -9 $ARCHIVE || exit 9
|
1999-04-08 05:05:13 +08:00
|
|
|
echo ""
|
|
|
|
|
2002-08-24 17:56:51 +08:00
|
|
|
$ECHO_N "makedist: making bz2zipped tar archive...$ECHO_C"
|
2002-10-11 03:01:34 +08:00
|
|
|
rm -f $ARCHIVE.bz2
|
2012-03-20 13:28:16 +08:00
|
|
|
tar cf $ARCHIVE php-$VER || exit 10
|
2002-08-24 17:56:51 +08:00
|
|
|
bzip2 -9 $ARCHIVE || exit 11
|
|
|
|
echo ""
|
|
|
|
|
2012-11-13 00:47:15 +08:00
|
|
|
$ECHO_N "makedist: making xz2zipped tar archive...$ECHO_C"
|
|
|
|
rm -f $ARCHIVE.xz
|
|
|
|
tar cf $ARCHIVE php-$VER || exit 10
|
|
|
|
xz -9 $ARCHIVE || exit 12
|
|
|
|
echo ""
|
|
|
|
|
1999-04-08 05:05:13 +08:00
|
|
|
$ECHO_N "makedist: cleaning up...$ECHO_C"
|
2012-11-13 00:47:15 +08:00
|
|
|
rm -rf $DIRPATH || exit 13
|
1999-04-08 05:05:13 +08:00
|
|
|
echo ""
|
|
|
|
|
|
|
|
exit 0
|