forked from rlerdorf/php7dev
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmakeext
executable file
·98 lines (90 loc) · 2.22 KB
/
makeext
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
#!/usr/local/php70/bin/php
<?php
if ($argc < 2) {
usage();
}
$zts = $world = false;
$build = [];
$conf = [];
$version = preg_replace('/[\.\-]+/', '', $argv[1]);
function usage()
{
$cmd = basename(__FILE__);
echo "Usage: $cmd 73|72|71|70|7X|56|all|world [zts]\n";
echo "To rebuild ext for PHP 7.2 and 7.2-debug: $cmd 72\n";
echo "To rebuild ext for PHP 7.2 and 7.2-debug threadsafe: $cmd 72 zts\n";
echo "To rebuild ext for all PHP 7 versions: $cmd 7X\n";
exit;
}
if (!empty($argv[2]) && $argv[2] == 'zts') {
$zts = true;
}
switch ($argv[1]) {
case '73':
$build[73] = true;
break;
case '7':
case '72':
$build[72] = true;
break;
case '71':
$build[71] = true;
break;
case '70':
$build[7] = true;
break;
case '7X':
$build = [73 => true, 72 => true, 71 => true, 7 => true];
break;
case '5':
case '56':
$build[56] = true;
break;
case 'all':
$build = [73 => true, 72 => true, 71 => true, 7 => true, 56 => true];
break;
case 'world':
$build = [73 => true, 72 => true, 71 => true, 7 => true, 56 => true];
$world = true;
break;
}
function build_it()
{
$cmds = [
"=configuring...",
"sudo make distclean 2>&1 1>> /dev/null",
"phpize",
"./configure 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();
shell_exec("truncate --size 0 /tmp/build.log");
echo "Build log in /tmp/build.log\n";
foreach ($build as $v => $b) {
if (!$zts || $world) {
echo "Building extension for PHP $v\n";
shell_exec("newphp $v");
build_it();
echo "Building PHP $v-debug\n";
shell_exec("newphp $v debug");
build_it();
}
if ($zts || $world) {
echo "Building PHP $v-zts\n";
build_it();
echo "Building PHP $v-debug-zts\n";
build_it();
}
}