summaryrefslogtreecommitdiff
path: root/makedist
blob: d5449f7e1790db87e5f01e1951c4475d6f5f4ba7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
#!/bin/sh
#
# Distribution generator for SVN based packages.
# To work, this script needs a consistent tagging of all releases.
# Each release of a package should have a tag of the form
#
#  <package>_<version>
#
# where <package> is the package name and the SVN module
# and <version> s the version number with underscores instead of dots.
#
# For example: svn cp $PHPROOT/php/php-src/trunk $PHPROOT/php/php-src/tags/php_5_0_1
#
# The distribution ends up in a .tar.gz file that contains the distribution
# in a directory called <package>-<version>.  The distribution contains all
# directories from the SVN module except the one called "nodist", but only
# the files INSTALL, README and config* are included.
# A .tar.bz2 file is also created.
#
# Usage: makedist <package> <version>
#
# Written by Stig Bakken <ssb@guardian.no> 1997-05-28.
#
# $Id$
#

if test "$#" != "2"; then
    echo "Usage: makedist <package> <version>" >&2
    exit 1
fi

PKG=$1 ; shift
VER=$1 ; shift

old_IFS="$IFS"
IFS=.
eval set `bison --version| grep 'GNU Bison' | cut -d ' ' -f 4 | sed -e 's/\./ /'`
if test "${1}" = "1" -a "${2}" -lt "28"; then
  echo "You will need bison 1.28 if you want to regenerate the Zend parser (found ${1}.${2}).)"
  exit 10
fi
IFS="$old_IFS"

PHPROOT=http://svn.php.net/repository
PHPMOD=php/php-src
LT_TARGETS='ltconfig ltmain.sh config.guess config.sub'

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

MY_OLDPWD=`pwd`

# the destination .tar.gz file
ARCHIVE=$MY_OLDPWD/$PKG-$VER.tar

# temporary directory used to check out files from SVN
DIR=$PKG-$VER
DIRPATH=$MY_OLDPWD/$DIR

if test -d "$DIRPATH"; then
    echo "The directory $DIR"
    echo "already exists, rename or remove it and run makedist again."
    exit 1
fi

# version part of the SVN release tag
SVNVER=`echo $VER | sed -e 's/[\.\-]/_/g'`

# SVN release tag
if test "$VER" != "HEAD" -a "$VER" != "trunk"; then
  SVNTAG=tags/${PKG}_$SVNVER
else
  SVNTAG=trunk
fi

#if test ! -d $DIRPATH; then
#    mkdir -p $DIRPATH || exit 2
#fi

# Export PHP
$ECHO_N "makedist: exporting tag '$SVNTAG' from '$PHPMOD'...$ECHO_C"
svn export $PHPROOT/$PHPMOD/$SVNTAG $DIRPATH || exit 4
echo ""

# remove SVN stuff...
cd $DIR || exit 5
find . \( -name .svn -type d \) -exec rm -rf {} \;

# The full ChangeLog is available separately from lxr.php.net
rm -f ChangeLog*

# 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

# generate some files so people don't need bison, flex and autoconf
# to install
set -x
./buildconf --copy --force

# remove buildmk.stamp. Otherwise, buildcheck.sh might not be run,
# when a user runs buildconf in the distribution.
rm -f buildmk.stamp

./genfiles

# now restore our versions of libtool-generated files
for i in $LT_TARGETS; do
  test -f "$i" && mv $i.bak $i
done

# download pear 
$ECHO_N "makedist: Attempting to download PEAR's phar archive"
if test ! -x wget; then
	wget http://pear.php.net/install-pear-nozlib.phar -nd -P pear/
else
	$ECHO_N "Missing wget binary needed for pear download";
	exit 0;
fi

cd $MY_OLDPWD
$ECHO_N "makedist: making gzipped tar archive...$ECHO_C"
rm -f $ARCHIVE.gz
tar cf $ARCHIVE $PKG-$VER || exit 8
gzip -9 $ARCHIVE || exit 9
echo ""

$ECHO_N "makedist: making bz2zipped tar archive...$ECHO_C"
rm -f $ARCHIVE.bz2
tar cf $ARCHIVE $PKG-$VER || exit 10
bzip2 -9 $ARCHIVE || exit 11
echo ""

$ECHO_N "makedist: cleaning up...$ECHO_C"
rm -rf $DIRPATH || exit 12
echo ""

exit 0