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

@@ -19,7 +19,7 @@ class ConfigValidator
foreach ($data as $name => $src) {
isset($src['type']) || throw new ValidationException("source {$name} must have prop: [type]");
is_string($src['type']) || throw new ValidationException("source {$name} type prop must be string");
in_array($src['type'], ['filelist', 'git', 'ghtagtar', 'ghtar', 'ghrel', 'url']) || throw new ValidationException("source {$name} type [{$src['type']}] is invalid");
in_array($src['type'], ['filelist', 'git', 'ghtagtar', 'ghtar', 'ghrel', 'url', 'custom']) || throw new ValidationException("source {$name} type [{$src['type']}] is invalid");
switch ($src['type']) {
case 'filelist':
isset($src['url'], $src['regex']) || throw new ValidationException("source {$name} needs [url] and [regex] props");

View File

@@ -204,9 +204,6 @@ class Patcher
}
}
/**
* @throws FileSystemException
*/
public static function patchUnixLibpng(): void
{
FileSystem::replaceFile(
@@ -217,6 +214,22 @@ class Patcher
);
}
public static function patchCurlMacOS(): void
{
FileSystem::replaceFile(
SOURCE_PATH . '/curl/CMakeLists.txt',
REPLACE_FILE_PREG,
'/NOT COREFOUNDATION_FRAMEWORK/m',
'FALSE'
);
FileSystem::replaceFile(
SOURCE_PATH . '/curl/CMakeLists.txt',
REPLACE_FILE_PREG,
'/NOT SYSTEMCONFIGURATION_FRAMEWORK/m',
'FALSE'
);
}
/**
* @throws FileSystemException
*/

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);
}
}