This repository was archived by the owner on Feb 11, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun.php
More file actions
85 lines (70 loc) · 2.55 KB
/
run.php
File metadata and controls
85 lines (70 loc) · 2.55 KB
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
<?php
/**
* PhpVersionBuilder run script
*
* @author Philip Olson <philip@roshambo.org>
* @license MIT license
* @link http://github.com/philip/PhpVersionBuilder
*/
require './inc/config.php';
require './inc/pvb-functions.php';
// Creates directories and checks prerequisites
initialize_environment();
// Get filenames, locations, and dates for each PHP version
$version_info = get_php_version_info($php_versions);
// Download PHP sources from php.net
download_php_sources($version_info, DIR_DOWNLOADS);
// Download latest snapshots from snaps.php.net
download_snap_sources($snap_versions, DIR_DOWNLOADS);
// Extract all tarballs from previous downloads
extract_php_sources(DIR_EXTRACTIONS, DIR_DOWNLOADS);
// Optionally build PHP
if (DO_PHP_BUILD) {
$it = new FilesystemIterator(DIR_EXTRACTIONS);
foreach ($it as $fileinfo) {
$version = str_replace('php-', '', $fileinfo->getFileName());
if (!isset($version_info[$version])) {
echo "Found extractions directory for '$version' but skipping, it is not set within config php_versions", PHP_EOL;
continue;
}
// Example prefix result: /path/to/phpbuilds/php-5.3.0
$prefix = realpath(DIR_BUILD_PREFIX) . '/' . $fileinfo->getFileName();
// Rudimentary cache check
if (file_exists($prefix . '/bin/php')) {
if (VERBOSE) {
echo 'INFO: Already successfully built from: ', $fileinfo->getBaseName(), PHP_EOL;
}
continue;
}
// Optional version specific options, see inc/config.php
if ($more_options = get_version_configs($config_options_versions, $fileinfo->getFileName())) {
$config_options_run = array_merge($config_options_all, array($more_options));
} else {
$config_options_run = $config_options_all;
}
// Rudimentary build system
build_php($fileinfo->getPathName(), $prefix, realpath(DIR_LOGS), $config_options_run);
if (file_exists($prefix . '/bin/php')) {
if (copy($prefix . '/bin/php', DIR_PHP_BINARIES . DIRECTORY_SEPARATOR . $fileinfo->getBaseName())) {
chmod(DIR_PHP_BINARIES . DIRECTORY_SEPARATOR . $fileinfo->getBaseName(), 0755);
}
}
}
if (VERBOSE) {
echo PHP_EOL;
$status = get_status_binaries(DIR_BUILD_PREFIX);
if ($status['bad']) {
echo 'INFO: These PHP versions failed to build:', PHP_EOL;
echo 'INFO: Check the logs for reasons why, as found in: ', DIR_LOGS, PHP_EOL;
foreach ($status['bad'] as $version => $it) {
echo "\t", $version, PHP_EOL;
}
}
if ($status['good']) {
echo 'INFO: These PHP versions built with success:', PHP_EOL;
foreach ($status['good'] as $version => $it) {
echo "\t", $version, PHP_EOL;
}
}
}
}