File: php-build.sh

package info (click to toggle)
zendframework 1.12.9%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: jessie-kfreebsd
  • size: 133,584 kB
  • sloc: xml: 1,311,829; php: 570,173; sh: 170; makefile: 125; sql: 121
file content (90 lines) | stat: -rwxr-xr-x 2,414 bytes parent folder | download | duplicates (2)
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
#!/bin/bash

VERSION=$1

RESET=$2
POSTFIX=
EXTRA_FLAGS=

if [ -z "$VERSION" ]; then
    echo "Usage: php-build.sh {VERSION}"
    echo ""
    echo "e.g. php-build.sh 5.2.11"
    exit;
fi

if [ -z "$RESET" ]; then
    RESET=0
fi


SRC_DIR=/home/vagrant/src
PHP_DIR=${SRC_DIR}/php-${VERSION}

if [ ! -d "$SRC_DIR" ]; then 
    mkdir ${SRC_DIR}
fi
cd $SRC_DIR

# If we don't have the src file downloaded, then we're going to need it.
if [ ! -f "php-${VERSION}.tar.gz" ]; then
    RESET=1
fi;

# Retrieve source code 
if [ $RESET -eq 1 ] ; then
    echo "Downloading php-${VERSION}.tar.gz"
    RESPONSE=$(curl --write-out %{http_code} --silent  --head --output /dev/null http://museum.php.net/php5/php-${VERSION}.tar.gz)
    echo $RESPONSE
    if [ $RESPONSE -eq 404 ]; then
        wget -O php-${VERSION}.tar.gz http://uk3.php.net/get/php-${VERSION}.tar.gz/from/this/mirror
    else
        wget http://museum.php.net/php5/php-${VERSION}.tar.gz
    fi

    if [ ! -f php-${VERSION}.tar.gz ];
    then
        echo "Could not find php-${VERSION}.tar.gz"
        exit;
    fi
    
    rm -rf ${PHP_DIR}
    tar -zxf php-${VERSION}.tar.gz
fi

cd $PHP_DIR
echo "Configuring ${VERSION}${POSTFIX} in $PHP_DIR"

# Configure 
OPTIONS="--with-gd --with-jpeg-dir=/usr --with-xpm-dir=/usr --with-freetype-dir=/usr \
    --with-mysql=/usr --enable-bcmath --with-gmp --with-readline \
    --with-openssl --with-curl --without-esmtp \
    --with-mysqli --enable-pcntl \
    --enable-memory-limit --with-mcrypt --with-t1lib \
    --enable-debug --with-iconv --enable-wddx --with-pdo-pgsql \
    --enable-spl --enable-pdo --with-pdo-mysql --with-pdo-sqlite \
    --with-ctype --with-bz2 --enable-mbstring --with-mime-magic \
    --with-xmlrpc --with-zlib --disable-zend-memory-manager --with-esmtp \
    --with-xsl --enable-exif --enable-soap --enable-ftp"

./configure --prefix=/usr/local/php/${VERSION}${POSTFIX} ${EXTRA_FLAGS} ${OPTIONS}

# Build and install
echo "Building ${VERSION}${POSTFIX} in $PHP_DIR"
make -j 5

echo "Installing ${VERSION}${POSTFIX} in $PHP_DIR"
sudo make install

echo "Installing PHPUnit"
export PATH=/usr/local/php/${VERSION}/bin:/usr/local/bin:/usr/bin:/bin:/vagrant/puppet/scripts
sudo pear update-channels
sudo pear upgrade-all
sudo pear config-set auto_discover 1
sudo pear install pear.phpunit.de/PHPUnit-3.4.15


echo ""
echo "PHP version ${VERSION} is now installed. Type: pe ${VERSION}"
echo ""