FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
php-sdk-binary-tools/bin/phpsdk_libmap.php at master · php/php-sdk-binary-tools · GitHub
php
php-sdk-binary-tools
Repository navigation
Code
Issues
4
(4)
Pull requests
4
(4)
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
php-sdk-binary-tools
/
bin
/
phpsdk_libmap.php
Copy path
More file actions
More file actions
Latest commit
History
History
History
117 lines (89 loc) · 1.9 KB
Breadcrumbs
php-sdk-binary-tools
/
bin
/
phpsdk_libmap.php
Copy path
File metadata and controls
117 lines (89 loc) · 1.9 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
<?php
/*
- go through all zip files in the given dirs non recursively
- read all the lib filenames from those zips
- create mappings between lib filename and zip filename
Usage:
php libmap.php [--pretty] path0 [ path1 ... ] > libmapping.json
*/
/*$dirs = array(
"C:\\tmp\\core_deps\\vc9\\x86",
"C:\\tmp\\core_deps\\vc11\\x86",
"C:\\tmp\\core_deps\\vc11\\x64",
);*/
/*$dirs = array(
"C:\\tmp\\libs",
);*/
$
sopt
=
"
p
"
;
$
lopt
=
array
(
"
pretty
"
,
);
$
flags
=
0
;
$
opt
=
getopt
(
$
sopt
,
$
lopt
);
foreach
(
$
opt
as
$
name
=>
$
val
) {
switch
(
$
name
) {
case
"
p
"
:
case
"
pretty
"
:
$
flags
=
JSON_PRETTY_PRINT
;
break
;
}
}
$
dirs
=
array
();
foreach
(
array_slice
(
$
_SERVER
[
"
argv
"
], (
0
==
$
flags
?
1
:
2
))
as
$
item
) {
if
(
file_exists
(
$
item
) &&
is_dir
(
$
item
)) {
$
dirs
[] =
$
item
;
}
}
if
(
empty
(
$
dirs
)) {
echo
"
Nothing to do
\n"
;
die;
}
$
out
=
array
();
foreach
(
$
dirs
as
$
path
) {
$
dir
=
new
DirectoryIterator
(
$
path
);
foreach
(
$
dir
as
$
fileinfo
) {
if
(
$
fileinfo
->
isDot
() ||
$
fileinfo
->
isDir
()) {
continue
;
}
$
pathname
=
$
fileinfo
->
getPathname
();
$
filename
=
$
fileinfo
->
getFilename
();
if
(
substr
(
$
filename
, -
3
) !=
"
zip
"
) {
continue
;
}
if
(!
preg_match
(
"
,.*-(v[c|s]\d+)-(x\d\d)\.zip,
"
,
$
filename
,
$
m
)) {
continue
;
}
$
crt
=
$
m
[
1
];
$
arch
=
$
m
[
2
];
if
(!
isset
(
$
out
[
$
crt
])) {
$
out
[
$
crt
] =
array
();
}
if
(!
isset
(
$
out
[
$
crt
][
$
arch
])) {
$
out
[
$
crt
][
$
arch
] =
array
();
}
$
zip
=
new
ZipArchive
();
$
zip
->
open
(
$
pathname
);
$
libs
=
array
();
for
(
$
i
=
0
;
$
i
<
$
zip
->
numFiles
;
$
i
++) {
$
stat
=
$
zip
->
statIndex
(
$
i
);
if
(
substr
(
$
stat
[
'
name
'
], -
3
) !=
"
lib
"
) {
continue
;
}
$
libs
[] =
basename
(
$
stat
[
'
name
'
]);
}
$
zip
->
close
();
unset(
$
zip
);
if
(!
empty
(
$
libs
)) {
$
out
[
$
crt
][
$
arch
][
$
filename
] =
$
libs
;
}
}
}
echo
json_encode
(
$
out
,
$
flags
);
/*
* Local variables:
* tab-width: 4
* c-basic-offset: 4
* End:
* vim600: sw=4 ts=4 fdm=marker
* vim<600: sw=4 ts=4
*/
Back
|
FazBrowse Home
|
New Git URL