build in SOURCE_PATH

This commit is contained in:
henderkes
2026-05-19 20:44:47 +07:00
parent 7bb4a09a3c
commit efa7946c14
5 changed files with 59 additions and 159 deletions

View File

@@ -317,7 +317,10 @@ class ArtifactDownloader
if (!is_dir(DOWNLOAD_PATH)) {
FileSystem::createDir(DOWNLOAD_PATH);
}
logger()->info('Downloading' . implode(', ', array_map(fn ($x) => " '{$x->getName()}'", $this->artifacts)) . " with concurrency {$this->parallel} ...");
$pending = array_values(array_filter($this->artifacts, fn ($a) => $this->generateQueue($a) !== []));
if ($pending !== []) {
logger()->info('Downloading' . implode(', ', array_map(fn ($x) => " '{$x->getName()}'", $pending)) . " with concurrency {$this->parallel} ...");
}
// Download artifacts parallelly
if ($this->parallel > 1) {
$this->downloadWithConcurrency();

View File

@@ -10,6 +10,7 @@ use StaticPHP\DI\ApplicationContext;
use StaticPHP\Registry\ArtifactLoader;
use StaticPHP\Registry\PackageLoader;
use StaticPHP\Util\DependencyResolver;
use StaticPHP\Util\GlobalEnvManager;
use StaticPHP\Util\InteractiveTerm;
use Symfony\Component\Console\Attribute\AsCommand;
use Symfony\Component\Console\Input\InputArgument;
@@ -34,6 +35,7 @@ class ExtractCommand extends BaseCommand
public function handle(): int
{
GlobalEnvManager::afterInit();
$cache = ApplicationContext::get(ArtifactCache::class);
$extractor = new ArtifactExtractor($cache);
$force_source = (bool) $this->getOption('source-only');

View File

@@ -10,7 +10,6 @@ use StaticPHP\Attribute\Doctor\OptionalCheck;
use StaticPHP\DI\ApplicationContext;
use StaticPHP\Doctor\CheckResult;
use StaticPHP\Package\PackageInstaller;
use StaticPHP\Runtime\SystemTarget;
use StaticPHP\Toolchain\Interface\ToolchainInterface;
use StaticPHP\Toolchain\ZigToolchain;
@@ -40,35 +39,4 @@ class ZigCheck
$installer->run(true);
return $installer->isPackageInstalled('zig');
}
/** @noinspection PhpUnused */
#[CheckItem('if llvm compiler-rt bits are built', limit_os: 'Linux', level: 799)]
public function checkCompilerRtBits(): ?CheckResult
{
// Skip if zig is not installed yet (zig check runs at level 800)
if (!new PackageInstaller()->addInstallPackage('zig')->isPackageInstalled('zig')) {
return null;
}
$libDir = PKG_ROOT_PATH . '/zig/lib/' . SystemTarget::getCanonicalTriple();
if (file_exists("{$libDir}/libclang_rt.profile.a")
&& file_exists("{$libDir}/clang_rt.crtbegin.o")
&& file_exists("{$libDir}/clang_rt.crtend.o")
) {
return CheckResult::ok("{$libDir}/libclang_rt.profile.a");
}
return CheckResult::fail('llvm compiler-rt bits are not built for ' . SystemTarget::getCanonicalTriple(), 'build-llvm-compiler-rt');
}
#[FixItem('build-llvm-compiler-rt')]
public function fixCompilerRtBits(): bool
{
$installer = new PackageInstaller(interactive: false);
$installer->addInstallPackage('llvm-compiler-rt');
$installer->run(true);
new \Package\Artifact\llvm_compiler_rt()->buildForCurrentTarget();
$libDir = PKG_ROOT_PATH . '/zig/lib/' . SystemTarget::getCanonicalTriple();
return file_exists("{$libDir}/libclang_rt.profile.a")
&& file_exists("{$libDir}/clang_rt.crtbegin.o")
&& file_exists("{$libDir}/clang_rt.crtend.o");
}
}