|
@@ -3,9 +3,35 @@ package runci.targets;
|
|
import runci.System.*;
|
|
import runci.System.*;
|
|
import runci.Config.*;
|
|
import runci.Config.*;
|
|
|
|
|
|
|
|
+using haxe.io.Path;
|
|
|
|
+
|
|
class Php {
|
|
class Php {
|
|
static final miscPhpDir = getMiscSubDir('php');
|
|
static final miscPhpDir = getMiscSubDir('php');
|
|
|
|
|
|
|
|
+ static final windowsPhpIni = cwd + 'PHP.ini';
|
|
|
|
+
|
|
|
|
+ static var windowsPhpExtPath(get, null) = null;
|
|
|
|
+ static function get_windowsPhpExtPath() {
|
|
|
|
+ if (windowsPhpExtPath != null)
|
|
|
|
+ return windowsPhpExtPath;
|
|
|
|
+
|
|
|
|
+ final phpPath = commandResult("where", ["php"]).stdout;
|
|
|
|
+ return windowsPhpExtPath = Path.join([phpPath.directory(), "ext"]);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ static function generateArgs(file:String) {
|
|
|
|
+ if (systemName != "Windows")
|
|
|
|
+ return [file];
|
|
|
|
+ return [
|
|
|
|
+ "-c",
|
|
|
|
+ windowsPhpIni,
|
|
|
|
+ "-d",
|
|
|
|
+ 'extension_dir=$windowsPhpExtPath',
|
|
|
|
+ file
|
|
|
|
+ ];
|
|
|
|
+ }
|
|
|
|
+
|
|
static public function getPhpDependencies() {
|
|
static public function getPhpDependencies() {
|
|
final phpCmd = commandResult("php", ["-v"]);
|
|
final phpCmd = commandResult("php", ["-v"]);
|
|
final phpVerReg = ~/PHP ([0-9]+\.[0-9]+)/i;
|
|
final phpVerReg = ~/PHP ([0-9]+\.[0-9]+)/i;
|
|
@@ -17,8 +43,8 @@ class Php {
|
|
if (phpCmd.exitCode == 0 && phpVer != null && phpVer >= 7.0) {
|
|
if (phpCmd.exitCode == 0 && phpVer != null && phpVer >= 7.0) {
|
|
switch systemName {
|
|
switch systemName {
|
|
case "Linux":
|
|
case "Linux":
|
|
- var phpInfo = commandResult("php", ["-i"]);
|
|
|
|
- if(phpInfo.stdout.indexOf("mbstring => enabled") < 0) {
|
|
|
|
|
|
+ var phpInfo = commandResult("php", ["-i"]).stdout;
|
|
|
|
+ if(phpInfo.indexOf("mbstring => enabled") < 0) {
|
|
Linux.requireAptPackages(["php-mbstring"]);
|
|
Linux.requireAptPackages(["php-mbstring"]);
|
|
}
|
|
}
|
|
case _:
|
|
case _:
|
|
@@ -28,8 +54,7 @@ class Php {
|
|
}
|
|
}
|
|
switch systemName {
|
|
switch systemName {
|
|
case "Linux":
|
|
case "Linux":
|
|
- // TODO: install php-sqlite3?
|
|
|
|
- Linux.requireAptPackages(["php-cli", "php-mbstring"]);
|
|
|
|
|
|
+ Linux.requireAptPackages(["php-cli", "php-mbstring", "php-sqlite3"]);
|
|
case "Mac":
|
|
case "Mac":
|
|
runNetworkCommand("brew", ["install", "php"]);
|
|
runNetworkCommand("brew", ["install", "php"]);
|
|
case "Windows":
|
|
case "Windows":
|
|
@@ -60,14 +85,14 @@ class Php {
|
|
deleteDirectoryRecursively(binDir);
|
|
deleteDirectoryRecursively(binDir);
|
|
|
|
|
|
runCommand("haxe", ["compile-php.hxml"].concat(prefix).concat(args));
|
|
runCommand("haxe", ["compile-php.hxml"].concat(prefix).concat(args));
|
|
- runCommand("php", [binDir + "/index.php"]);
|
|
|
|
|
|
+ runCommand("php", generateArgs(binDir + "/index.php"));
|
|
|
|
|
|
changeDirectory(sysDir);
|
|
changeDirectory(sysDir);
|
|
if(isCi())
|
|
if(isCi())
|
|
deleteDirectoryRecursively(binDir);
|
|
deleteDirectoryRecursively(binDir);
|
|
|
|
|
|
runCommand("haxe", ["compile-php.hxml"].concat(prefix).concat(args));
|
|
runCommand("haxe", ["compile-php.hxml"].concat(prefix).concat(args));
|
|
- runSysTest("php", ["bin/php/Main/index.php"]);
|
|
|
|
|
|
+ runSysTest("php", generateArgs(binDir + "/Main/index.php"));
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|