libs as $lib) { foreach ($lib->getDependencies() as $dep) { $libs[] = $dep; } $libs[] = $lib; } $libFiles = []; $libNames = []; // merge libs foreach ($libs as $lib) { if (!in_array($lib::NAME, $libNames, true)) { $libNames[] = $lib::NAME; array_unshift($libFiles, ...$lib->getStaticLibs()); } } return array_map(fn ($x) => realpath(BUILD_LIB_PATH . "/{$x}"), $libFiles); } /** * @throws RuntimeException */ public function sanityCheck(int $build_micro_rule): void { logger()->info('running sanity check'); if ($build_micro_rule !== BUILD_MICRO_ONLY) { f_exec( $this->set_x . ' && ' . SOURCE_PATH . '/php-src/sapi/cli/php -r "echo \"hello\";"', $output, $ret ); if ($ret !== 0 || trim(implode('', $output)) !== 'hello') { throw new RuntimeException('cli failed sanity check'); } foreach ($this->exts as $ext) { logger()->debug('checking ext: ' . $ext->getName()); if (file_exists(ROOT_DIR . '/src/globals/tests/' . $ext->getName() . '.php')) { f_exec( $this->set_x . ' && ' . SOURCE_PATH . '/php-src/sapi/cli/php ' . ROOT_DIR . '/src/globals/tests/' . $ext->getName() . '.php', $output, $ret ); if ($ret !== 0) { throw new RuntimeException('extension ' . $ext->getName() . ' failed sanity check'); } } } } if ($build_micro_rule !== BUILD_MICRO_NONE) { if (file_exists(SOURCE_PATH . '/hello.exe')) { @unlink(SOURCE_PATH . '/hello.exe'); } file_put_contents( SOURCE_PATH . '/hello.exe', file_get_contents(SOURCE_PATH . '/php-src/sapi/micro/micro.sfx') . '