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
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
|
--- go-pear.orig 2013-07-18 07:18:00 UTC
+++ go-pear
@@ -57,6 +57,8 @@
define('WIN32GUI', !WEBINSTALLER && WINDOWS && $sapi_name=='cli' && which('cscript'));
+$destdir = getenv('DESTDIR');
+
/*
* See bug #23069
*/
@@ -116,7 +118,7 @@
);
$installer_packages = array(
- 'PEAR',
+ 'PEAR-stable',
'Structures_Graph-stable',
'Archive_Tar-stable',
'Console_Getopt-stable',
@@ -250,7 +252,7 @@
}
// Anything past this step has something to do with the installation
}
-
+/*
if (!WEBINSTALLER) {
$tty = WINDOWS ? @fopen('\con', 'r') : @fopen('/dev/tty', 'r');
@@ -294,7 +296,7 @@
$http_proxy = $tmp;
}
}
-
+*/
$origpwd = getcwd();
$config_vars = array_keys($config_desc);
@@ -345,7 +347,7 @@
break;
}
}
-
+/*
while (!WEBINSTALLER) {
print "
Below is a suggested file layout for your new PEAR installation. To
@@ -428,7 +430,7 @@
}
}
}
-
+*/
####
# Installation stuff
####
@@ -488,7 +490,7 @@
continue;
}
- $dir = $$var;
+ $dir = ($destdir ? $destdir : '').$$var;
if (!@is_dir($dir)) {
if (!mkdir_p($dir)) {
if (!WEBINSTALLER) {
@@ -561,7 +563,7 @@
ob_start();
}
}
-
+/*
if (!WEBINSTALLER) {
$msg = "The following PEAR packages are bundled with PHP: " .
implode(', ', array_keys($pfc_packages));
@@ -571,17 +573,19 @@
$install_optional_packages = array();
print "\n";
}
-
+*/
####
# Download
####
+dl('xml.so');
+
if (function_exists('set_include_path')) {
- set_include_path($ptmp);
+ set_include_path($ptmp . PATH_SEPARATOR . "%%BUNDLEDIR%%");
} else {
- ini_set('include_path', $ptmp);
+ ini_set('include_path', $ptmp . PATH_SEPARATOR . "%%BUNDLEDIR%%");
}
-
+/*
if (!extension_loaded('zlib') && !WEBINSTALLER) { // In Web context we could be in multithread env which makes dl() end up with a fatal error.
if (WINDOWS) {
@dl('php_zlib.dll');
@@ -606,18 +610,19 @@
if (!$have_gzip) {
print "Downloading uncompressed packages\n";
};
-
+*/
if ($install_pfc) {
$to_install = array_merge($installer_packages, array_keys($pfc_packages));
} else {
$to_install = $installer_packages;
-
+/*
// webinstaller allows to choose pfc packages individually
foreach ($pfc_packages as $pkg => $desc) {
if (in_array($pkg, $install_optional_packages)) {
array_push($to_install, $pkg);
}
}
+*/
}
// gopear_bundle usage
@@ -645,19 +650,21 @@
// Bootstrap needed ?
$nobootstrap = false;
+/*
if (is_dir($php_dir)) {
$nobootstrap = true;
foreach ($bootstrap_files as $file => $url) {
$nobootstrap &= is_file($php_dir.'/'.$file);
}
}
+*/
if ($nobootstrap) {
print('Using previously install ... ');
if (function_exists('set_include_path')) {
- set_include_path($php_dir);
+ set_include_path($php_dir . PATH_SEPARATOR . "%%BUNDLEDIR%%");
} else {
- ini_set('include_path', $php_dir);
+ ini_set('include_path', $php_dir . PATH_SEPARATOR . "%%BUNDLEDIR%%");
}
include_once 'PEAR.php';
print "ok\n";
@@ -691,6 +698,7 @@
// Extract needed ?
$noextract = false;
+/*
if (is_dir($php_dir)) {
$noextract = @include_once 'PEAR/Registry.php';
@@ -701,6 +709,7 @@
}
}
}
+*/
if ($noextract) {
print('Using previously installed installer ... ');
@@ -722,7 +731,7 @@
displayHTMLProgress($progress += round(19 / count($bootstrap_pkgs)));
$fullpkg = substr($tarball, 0, strrpos($tarball, '.'));
- $tar = &new Archive_Tar($tarball, $have_gzip);
+ $tar = new Archive_Tar($tarball, $have_gzip);
if (!$tar->extractModify($ptmp, $fullpkg)) {
bail("Extraction for $fullpkg failed!\n");
}
@@ -747,12 +756,7 @@
include_once "PEAR/Command.php";
include_once "PEAR/Registry.php";
-if (WEBINSTALLER || isset($_SERVER['argv'][1]) && $_SERVER['argv'][1] == 'local') {
- $config = &PEAR_Config::singleton($prefix."/pear.conf", '');
-} else {
- $config = &PEAR_Config::singleton();
-}
-
+$config = &PEAR_Config::singleton(($destdir ? $destdir : '').$prefix."/etc/pear.conf.sample", '');
$config->set('preferred_state', 'stable');
foreach ($config_vars as $var) {
@@ -765,7 +769,7 @@
$config->set('http_proxy', $http_proxy);
$config->store();
-$registry = new PEAR_Registry($php_dir);
+$registry = new PEAR_Registry(($destdir ? $destdir : '').$php_dir);
PEAR_Command::setFrontendType('CLI');
PEAR::staticPushErrorHandling(PEAR_ERROR_DIE); //fail silently
@@ -787,6 +791,11 @@
} else {
$options = array('onlyreqdeps' => true);
}
+ if ($destdir) {
+ $options['packagingroot'] = $destdir;
+ $options['force'] = true;
+ $options['nodeps'] = true;
+ }
if ($registry->packageExists($pkg) || $registry->packageExists($pkg_basename)) {
print(str_pad("Package: $pkg", max(50,9+strlen($pkg)+4), '.').' already installed ... ok'."\n");
displayHTMLProgress($progress += round(50 / count($to_install)));
@@ -821,7 +830,7 @@
// Base installation finished
-
+/*
ini_restore("include_path");
if (!WEBINSTALLER) {
@@ -980,6 +989,7 @@
if (WINDOWS && !WEBINSTALLER) {
win32CreateRegEnv();
}
+*/
// Set of functions following
/**
* Parse the given dirname
@@ -1418,19 +1428,17 @@
}
} else {
if ($_prefix === null) {
- #$prefix = dirname(PHP_BINDIR);
- $prefix = dirname(__FILE__);
+ $prefix = '%%PREFIX%%';
} else {
$prefix = $_prefix;
}
$bin_dir = '$prefix/bin';
- #$php_dir = '$prefix/share/pear';
- $php_dir = '$prefix/PEAR';
- $doc_dir = '$php_dir/docs';
+ $php_dir = '$prefix/share/pear';
+ $doc_dir = '$prefix/share/doc/pear';
$data_dir = '$php_dir/data';
$test_dir = '$php_dir/tests';
- $temp_dir = '$prefix/temp';
-
+ $temp_dir = '%%TMPDIR%%';
+/*
// check if the user has installed PHP with PHP or GNU layout
if (@is_dir("$prefix/lib/php/.registry")) {
$php_dir = '$prefix/lib/php';
@@ -1442,6 +1450,7 @@
} elseif (@is_dir("$prefix/share/php/.registry")) {
$php_dir = '$prefix/share/php';
}
+*/
}
}
|