refactor to pkg-config and add some add-on libs for gd

This commit is contained in:
crazywhalecc
2023-04-29 18:59:47 +08:00
parent ea055afd3c
commit 8df4ade754
83 changed files with 1001 additions and 1520 deletions

View File

@@ -13,6 +13,8 @@ class UnixShell
private bool $debug;
private array $env = [];
public function __construct(?bool $debug = null)
{
$this->debug = $debug ?? defined('DEBUG_MODE');
@@ -54,4 +56,24 @@ class UnixShell
exec($cmd, $out, $code);
return [$code, $out];
}
public function setEnv(array $env): UnixShell
{
$this->env = array_merge($this->env, $env);
return $this;
}
public function execWithEnv(string $cmd): UnixShell
{
return $this->exec($this->getEnvString() . ' ' . $cmd);
}
private function getEnvString(): string
{
$str = '';
foreach ($this->env as $k => $v) {
$str .= ' ' . $k . '="' . $v . '"';
}
return trim($str);
}
}