-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.php
More file actions
42 lines (35 loc) · 795 Bytes
/
build.php
File metadata and controls
42 lines (35 loc) · 795 Bytes
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
<?php
function buildExe($tinput, $output) {
$compPath = "C:\Program Files (x86)\Phalanger 3.0\Bin\phpc.exe";
$in = "";
if (is_array($tinput)) {
$input = array();
$first = false;
foreach ($tinput as $i) {
$fn = basename($i, '.php');
if (strtolower($fn) == "main") {
$first = $i;
}
else {
$input[] = $i;
}
}
if ($first) {
array_unshift($input, $first);
}
//echo "\n INPUT FILES\n -----------\n";
foreach ($input as $i) {
//echo $i."\n";
$in .= $i . " ";
}
}
else {
$in = $tinput;
}
$exec = "\"".$compPath."\" /target:exe ".$in." /out:".$output;
exec($exec, $out);
return implode("\n", $out);
}
$input = glob(dirname(__FILE__)."\\src\\*.php");
$output = dirname(__FILE__)."\\bang.exe";
echo buildExe($input, $output)."\n";