-
Notifications
You must be signed in to change notification settings - Fork 217
/
build.php
78 lines (70 loc) · 1.57 KB
/
build.php
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
<?php
//
// Copyright (c) ZeroC, Inc. All rights reserved.
//
$iceHome = getenv("ICE_HOME");
if($iceHome == NULL)
{
if(PHP_OS == "WINNT")
{
$iceVersion = Ice\stringVersion();
$iceHome = "C:\\Program Files\\ZeroC\\Ice-$iceVersion";
}
else if(PHP_OS == "Darwin")
{
$iceHome = "/usr/local";
}
else
{
$iceHome = "/usr";
}
}
if(file_exists("$iceHome/cpp"))
{
if(PHP_OS == "WINNT")
{
$cppPlatform = getenv("CPP_PLATFORM");
$cppConfiguration = getenv("CPP_CONFIGURATION");
$iceBinDir = "$iceHome/cpp/$cppPlatform/$cppConfiguration/bin";
}
else
{
$iceBinDir = "$iceHome/cpp/bin";
}
}
else
{
$iceBinDir = "$iceHome/bin";
}
$slice2php = PHP_OS == "WINNT" ? "$iceBinDir/slice2php.exe" : "$iceBinDir/slice2php";
$sliceDir = file_exists("$iceHome/share/ice/slice") ? "$iceHome/share/ice/slice" : "$iceHome/slice";
if(!file_exists($slice2php) || !is_dir($sliceDir))
{
echo("Ice Installation invalid or not detected\n");
exit(1);
}
$demos = array(
"Chat",
"Ice/hello",
"Ice/optional",
"IceDiscovery/hello",
"Glacier2/hello");
foreach($demos as $demo)
{
echo "Building $demo... ";
$inputFiles = "$demo/*.ice";
$command = "\"$slice2php\" ";
if(PHP_VERSION_ID < 70000)
{
$command .= "--php5 ";
}
$command .= "-I\"$sliceDir\" -I$demo --output-dir $demo $inputFiles";
system($command, $retval);
if($retval != 0)
{
echo "failed!\n";
echo "$command\n";
exit($retval);
}
echo "ok\n";
}