#!/usr/local/php70/bin/php true,55=>true,54=>true]; break; case 'all': $build = [7=>true, 56=>true,55=>true,54=>true]; break; case 'world': $build = [7=>true, 56=>true,55=>true,54=>true]; $world=true; break; } $conf[7] = [ '--with-apxs2=/usr/bin/apxs2', '--enable-zend-signals', '--with-gd', '--without-pear', '--with-jpeg-dir=/usr', '--with-png-dir=/usr', '--with-vpx-dir=/usr', '--with-freetype-dir=/usr', '--with-t1lib=/usr', '--enable-gd-native-ttf', '--enable-exif', '--with-config-file-path=/etc/php7', '--with-config-file-scan-dir=/etc/php7/conf.d', '--with-mysql-sock=/var/run/mysqld/mysqld.sock', '--with-zlib', '--enable-phpdbg', '--with-gmp', '--with-zlib-dir=/usr', '--with-gettext', '--with-kerberos', '--with-imap-ssl', '--with-mcrypt=/usr/local', '--with-iconv', '--enable-sockets', '--with-openssl', '--with-pspell', '--with-pdo-mysql=mysqlnd', '--with-pdo-sqlite', '--enable-soap', '--enable-xmlreader', '--enable-phar=shared', '--with-xsl', '--enable-ftp', '--enable-cgi', '--with-curl=/usr', '--with-tidy', '--with-xmlrpc', '--enable-mbstring', '--enable-sysvsem', '--enable-sysvshm', '--enable-shmop', '--with-readline', '--enable-pcntl', '--enable-fpm', '--enable-intl', '--enable-zip', '--with-imap', '--with-mysqli=mysqlnd', '--enable-calendar' ]; $conf[56] = [ '--with-apxs2=/usr/bin/apxs2', '--enable-zend-signals', '--with-gd', '--without-pear', '--with-jpeg-dir=/usr', '--with-png-dir=/usr', '--with-vpx-dir=/usr', '--with-freetype-dir=/usr', '--with-t1lib=/usr', '--enable-gd-native-ttf', '--enable-exif', '--with-config-file-path=/etc/php56', '--with-config-file-scan-dir=/etc/php56/conf.d', '--with-mysql=/usr', '--with-mysql-sock=/var/run/mysqld/mysqld.sock', '--with-zlib', '--with-gmp', '--with-zlib-dir=/usr', '--with-gettext', '--with-kerberos', '--with-imap-ssl', '--with-mcrypt=/usr/local', '--with-iconv', '--enable-sockets', '--with-openssl', '--with-pspell', '--with-pdo-mysql=mysqlnd', '--with-pdo-sqlite', '--enable-soap', '--enable-zip', '--enable-xmlreader', '--enable-phar=shared', '--with-xsl', '--enable-ftp', '--enable-cgi', '--with-curl=/usr', '--with-tidy', '--with-xmlrpc', '--enable-mbstring', '--enable-sysvsem', '--enable-sysvshm', '--enable-shmop', '--with-readline', '--enable-pcntl', '--enable-fpm', '--enable-intl', '--with-imap', '--with-mysqli=mysqlnd', '--enable-calendar' ]; $conf[55] = [ '--with-apxs2=/usr/bin/apxs2', '--enable-zend-signals', '--with-gd', '--without-pear', '--with-jpeg-dir=/usr', '--with-png-dir=/usr', '--with-vpx-dir=/usr', '--with-freetype-dir=/usr', '--with-t1lib=/usr', '--enable-gd-native-ttf', '--enable-exif', '--with-config-file-path=/etc/php55', '--with-config-file-scan-dir=/etc/php55/conf.d', '--with-mysql=/usr', '--with-mysql-sock=/var/run/mysqld/mysqld.sock', '--with-zlib', '--with-gmp', '--with-zlib-dir=/usr', '--with-gettext', '--with-kerberos', '--with-imap-ssl', '--with-mcrypt=/usr/local', '--with-iconv', '--enable-sockets', '--with-openssl', '--with-pspell', '--with-pdo-mysql=mysqlnd', '--with-pdo-sqlite', '--enable-soap', '--enable-xmlreader', '--enable-phar=shared', '--enable-opcache', '--with-xsl', '--enable-ftp', '--enable-cgi', '--with-curl=/usr', '--with-tidy', '--with-xmlrpc', '--enable-mbstring', '--enable-sysvsem', '--enable-sysvshm', '--enable-shmop', '--with-readline', '--enable-pcntl', '--enable-fpm', '--enable-intl', '--with-imap', '--with-mysqli=mysqlnd', '--enable-calendar' ]; $conf[54] = [ '--with-apxs2=/usr/bin/apxs2', '--enable-zend-signals', '--with-gd', '--without-pear', '--with-jpeg-dir=/usr', '--with-png-dir=/usr', '--with-vpx-dir=/usr', '--with-freetype-dir=/usr', '--with-t1lib=/usr', '--enable-gd-native-ttf', '--enable-exif', '--with-mysql=/usr', '--with-mysql-sock=/var/run/mysqld/mysqld.sock', '--with-zlib', '--with-gmp', '--with-zlib-dir=/usr', '--with-gettext', '--with-kerberos', '--with-imap-ssl', '--with-mcrypt', '--with-iconv', '--enable-sockets', '--with-openssl', '--with-pspell', '--with-pdo-mysql=mysqlnd', '--with-pdo-sqlite', '--enable-soap', '--enable-xmlreader', '--enable-phar=shared', '--with-xsl', '--enable-ftp', '--enable-cgi', '--with-curl=/usr', '--with-tidy', '--with-xmlrpc', '--enable-mbstring', '--enable-sysvsem', '--enable-sysvshm', '--enable-shmop', '--with-readline', '--enable-pcntl', '--enable-fpm', '--enable-intl', '--with-imap', '--with-mysqli=mysqlnd', '--enable-calendar' ]; function build_it($branch, $conf_flags) { $cmds = [ "git checkout $branch", "git fetch --all 2>&1 1> /dev/null", "git reset --hard origin/$branch 2>&1 1> /dev/null", "git pull -r", "./vcsclean 2>&1 1> /dev/null", "./buildconf -f", "=configuring...", "./configure $conf_flags 2>&1 1>> /tmp/build.log", "=\ncompiling...", "make -j2 2>&1 1>> /tmp/build.log", "=\ninstalling...", "sudo make install 2>&1 1>> /tmp/build.log", "=\ndone\n" ]; foreach($cmds as $cmd) { if($cmd[0]=='=') echo substr($cmd,1); else shell_exec($cmd); } } $dir = getcwd(); chdir("/home/vagrant/php-src"); shell_exec("truncate --size 0 /tmp/build.log"); echo "Build log in /tmp/build.log\n"; foreach($build as $v=>$b) { switch($v) { case 7: if(!$zts || $world) { echo "Building PHP 7.0\n"; $conf_flags = implode(' ', $conf[$v]) . ' --disable-debug --prefix=/usr/local/php70'; build_it('master', $conf_flags); echo "Building PHP 7.0-debug\n"; $conf_flags = implode(' ', $conf[$v]) . ' --enable-debug --prefix=/usr/local/php70-debug'; build_it('master', $conf_flags); } if($zts || $world) { echo "Building PHP 7.0-zts\n"; $conf_flags = implode(' ', $conf[$v]) . ' --disable-debug --enable-maintainer-zts --prefix=/usr/local/php70-zts'; build_it('master', $conf_flags); echo "Building PHP 7.0-debug-zts\n"; $conf_flags = implode(' ', $conf[$v]) . ' --enable-debug --enable-maintainer-zts --prefix=/usr/local/php70-debug-zts'; build_it('master', $conf_flags); } break; case 56: if(!$zts || $world) { echo "Building PHP 5.6\n"; $conf_flags = implode(' ', $conf[$v]) . ' --disable-debug --prefix=/usr/local/php56'; build_it('PHP-5.6', $conf_flags); echo "Building PHP 5.6-debug\n"; $conf_flags = implode(' ', $conf[$v]) . ' --enable-debug --prefix=/usr/local/php56-debug'; build_it('PHP-5.6', $conf_flags); } if($zts || $world) { echo "Building PHP 5.6-zts\n"; $conf_flags = implode(' ', $conf[$v]) . ' --disable-debug --enable-maintainer-zts --prefix=/usr/local/php56-zts'; build_it('PHP-5.6', $conf_flags); echo "Building PHP 5.6-debug-zts\n"; $conf_flags = implode(' ', $conf[$v]) . ' --enable-debug --enable-maintainer-zts --prefix=/usr/local/php56-debug-zts'; build_it('PHP-5.6', $conf_flags); } break; case 55: if(!$zts || $world) { echo "Building PHP 5.5\n"; $conf_flags = implode(' ', $conf[$v]) . ' --disable-debug --prefix=/usr/local/php55'; build_it('PHP-5.5', $conf_flags); echo "Building PHP 5.5-debug\n"; $conf_flags = implode(' ', $conf[$v]) . ' --enable-debug --prefix=/usr/local/php55-debug'; build_it('PHP-5.5', $conf_flags); } if($zts || $world) { echo "Building PHP 5.5-zts\n"; $conf_flags = implode(' ', $conf[$v]) . ' --disable-debug --enable-maintainer-zts --prefix=/usr/local/php55-zts'; build_it('PHP-5.5', $conf_flags); echo "Building PHP 5.5-debug-zts\n"; $conf_flags = implode(' ', $conf[$v]) . ' --enable-debug --enable-maintainer-zts --prefix=/usr/local/php55-debug-zts'; build_it('PHP-5.5', $conf_flags); } break; case 54: if(!$zts || $world) { echo "Building PHP 5.4\n"; $conf_flags = implode(' ', $conf[$v]) . ' --disable-debug --prefix=/usr/local/php54 --with-config-file-path=/etc/php54 --with-config-file-scan-dir=/etc/php54/conf.d'; build_it('PHP-5.4', $conf_flags); echo "Building PHP 5.4-debug\n"; $conf_flags = implode(' ', $conf[$v]) . ' --enable-debug --prefix=/usr/local/php54-debug --with-config-file-path=/etc/php54-debug --with-config-file-scan-dir=/etc/php54-debug/conf.d'; build_it('PHP-5.4', $conf_flags); } if($zts || $world) { echo "Building PHP 5.4-zts\n"; $conf_flags = implode(' ', $conf[$v]) . ' --disable-debug --enable-maintainer-zts --prefix=/usr/local/php54-zts --with-config-file-path=/etc/php54-zts --with-config-file-scan-dir=/etc/php54-zts/conf.d'; build_it('PHP-5.4', $conf_flags); echo "Building PHP 5.4-debug-zts\n"; $conf_flags = implode(' ', $conf[$v]) . ' --enable-debug --enable-maintainer-zts --prefix=/usr/local/php54-debug-zts --with-config-file-path=/etc/php54-debug-zts --with-config-file-scan-dir=/etc/php54-debug-zts/conf.d'; build_it('PHP-5.4', $conf_flags); } break; } }