From 6adbe967aa97fef891f28239fb68cf60904031dd Mon Sep 17 00:00:00 2001 From: "Edward Z. Yang" Date: Mon, 16 Feb 2009 03:22:58 -0500 Subject: [PATCH] Initial commit. Signed-off-by: Edward Z. Yang --- .gitignore | 2 ++ bin/phpv | 9 +++++++++ fix-cgi.sh | 7 +++++++ get-url.php | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ install.sh | 14 ++++++++++++++ update-all-dev.sh | 4 ++++ update-dev.sh | 7 +++++++ 7 files changed, 91 insertions(+) create mode 100644 .gitignore create mode 100755 bin/phpv create mode 100755 fix-cgi.sh create mode 100644 get-url.php create mode 100755 install.sh create mode 100755 update-all-dev.sh create mode 100755 update-dev.sh diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..5eaab81 --- /dev/null +++ b/.gitignore @@ -0,0 +1,2 @@ +versions +working diff --git a/bin/phpv b/bin/phpv new file mode 100755 index 0000000..fa8cf42 --- /dev/null +++ b/bin/phpv @@ -0,0 +1,9 @@ +#!/bin/bash +VERSION="$1" +if [ "$VERSION" = "" ] +then + echo "Usage: phpv version ..." + exit +fi +shift 1 +"/home/ezyang/Dev/php/versions/$VERSION/bin/php" $@ diff --git a/fix-cgi.sh b/fix-cgi.sh new file mode 100755 index 0000000..ac0620c --- /dev/null +++ b/fix-cgi.sh @@ -0,0 +1,7 @@ +#!/bin/bash +set -e +VERSION="$1" +BIN="versions/$VERSION/bin" +mv "$BIN/php" "$BIN/php-cgi" +mv "working/php-$VERSION/sapi/cli/php" "$BIN/php" +versions/$VERSION/bin/php --version diff --git a/get-url.php b/get-url.php new file mode 100644 index 0000000..a4ef335 --- /dev/null +++ b/get-url.php @@ -0,0 +1,48 @@ +#!/usr/bin/env php +loadHTMLFile($url); + $xpath = new DOMXPath($doc); + return $xpath->query('//a'); +} + +if (!isset($_SERVER['argv'][1])) { + echo <<getAttribute('href'); + if (!$url) continue; + $result = preg_match('#/php-([^-]+?)\.tar\.gz#', $url, $matches); + if (!$result) continue; + list($full, $version) = $matches; + $url = str_replace('/from/a/mirror', '/from/this/mirror', $url); // make download ready + if ($url[0] == '/') $url = $url_mirror . $url; // heuristic assumes absolute paths are used + $index[$version] = $url; + } +} + +// maybe add qa support + +if (!isset($index[$install_version])) { + fwrite(STDERR, "Could not find $install_version\n"); + exit(1); +} + +echo $index[$install_version]; + diff --git a/install.sh b/install.sh new file mode 100755 index 0000000..42dfd5e --- /dev/null +++ b/install.sh @@ -0,0 +1,14 @@ +#!/bin/bash +set -e +VERSION="$1" +URL=$(php get-url.php "$VERSION") +mkdir "versions/$VERSION" +cd working +wget $URL -O "php-$VERSION.tar.gz" +tar xzf "php-$VERSION.tar.gz" +cd "php-$VERSION" +./configure --prefix=/home/ezyang/Dev/php/versions/$VERSION +make +make install +../../versions/$VERSION/bin/php --version + diff --git a/update-all-dev.sh b/update-all-dev.sh new file mode 100755 index 0000000..df2eaa3 --- /dev/null +++ b/update-all-dev.sh @@ -0,0 +1,4 @@ +#!/bin/bash +./update-dev.sh 5.2 +./update-dev.sh 5.3 +./update-dev.sh 6.0 diff --git a/update-dev.sh b/update-dev.sh new file mode 100755 index 0000000..a2b5276 --- /dev/null +++ b/update-dev.sh @@ -0,0 +1,7 @@ +#!/bin/bash +set -e +cd "working/$1" +cvs up +./config.nice +make +make install -- 2.11.4.GIT