Remove SPC_NO_MUSL_PATH, remove --libc, use SPC_LIBC instead (#642)

* Remove SPC_NO_MUSL_PATH, remove --libc, use SPC_LIBC instead

* Fix tests

* Internally use GNU_ARCH for unified

* Update EXTENSION_DIR comments for env.ini

* Remove redundant -fPIC cflags in curl
This commit is contained in:
Jerry Ma
2025-03-14 18:22:50 +08:00
committed by GitHub
parent 91a3a01c39
commit b4f3657323
32 changed files with 80 additions and 117 deletions

View File

@@ -12,25 +12,12 @@ abstract class BuildCommand extends BaseCommand
{
parent::__construct($name);
switch (PHP_OS_FAMILY) {
case 'Windows':
$this->addOption('with-sdk-binary-dir', null, InputOption::VALUE_REQUIRED, 'path to binary sdk');
$this->addOption('vs-ver', null, InputOption::VALUE_REQUIRED, 'vs version, e.g. "17" for Visual Studio 2022');
$this->addOption('arch', null, InputOption::VALUE_REQUIRED, 'architecture, "x64" or "arm64"', 'x64');
break;
case 'Linux':
$this->addOption('libc', null, InputOption::VALUE_REQUIRED, 'glibc, musl or musl-wrapper', 'musl-wrapper');
// no break
case 'Darwin':
$this->addOption('cc', null, InputOption::VALUE_REQUIRED, 'C compiler');
$this->addOption('cxx', null, InputOption::VALUE_REQUIRED, 'C++ compiler');
$this->addOption('ar', null, InputOption::VALUE_REQUIRED, 'ar');
$this->addOption('ld', null, InputOption::VALUE_REQUIRED, 'ld');
$this->addOption('arch', null, InputOption::VALUE_REQUIRED, 'architecture', php_uname('m'));
break;
if (PHP_OS_FAMILY === 'Windows') {
$this->addOption('with-sdk-binary-dir', null, InputOption::VALUE_REQUIRED, 'path to binary sdk');
$this->addOption('vs-ver', null, InputOption::VALUE_REQUIRED, 'vs version, e.g. "17" for Visual Studio 2022');
}
$this->addOption('with-clean', null, null, 'fresh build, remove `source` dir before `make`');
$this->addOption('with-clean', null, null, 'fresh build, remove `source` and `buildroot` dir before build');
$this->addOption('bloat', null, null, 'add all libraries into binary');
$this->addOption('rebuild', 'r', null, 'Delete old build and rebuild');
$this->addOption('enable-zts', null, null, 'enable ZTS support');

View File

@@ -19,7 +19,7 @@ use Symfony\Component\Console\Input\InputOption;
use ZM\Logger\ConsoleColor;
#[AsCommand('build', 'build PHP', ['build:php'])]
class BuildCliCommand extends BuildCommand
class BuildPHPCommand extends BuildCommand
{
public function configure(): void
{
@@ -29,8 +29,8 @@ class BuildCliCommand extends BuildCommand
$this->addOption('with-libs', null, InputOption::VALUE_REQUIRED, 'add additional libraries, comma separated', '');
$this->addOption('build-micro', null, null, 'Build micro SAPI');
$this->addOption('build-cli', null, null, 'Build cli SAPI');
$this->addOption('build-fpm', null, null, 'Build fpm SAPI');
$this->addOption('build-embed', null, null, 'Build embed SAPI');
$this->addOption('build-fpm', null, null, 'Build fpm SAPI (not available on Windows)');
$this->addOption('build-embed', null, null, 'Build embed SAPI (not available on Windows)');
$this->addOption('build-all', null, null, 'Build all SAPI');
$this->addOption('no-strip', null, null, 'build without strip, in order to debug and load external extensions');
$this->addOption('disable-opcache-jit', null, null, 'disable opcache jit');
@@ -155,14 +155,17 @@ class BuildCliCommand extends BuildCommand
$builder->proveExts($extensions);
// validate libs and exts
$builder->validateLibsAndExts();
// clean builds and sources
if ($this->input->getOption('with-clean')) {
logger()->info('Cleaning source and previous build dir...');
FileSystem::removeDir(SOURCE_PATH);
FileSystem::removeDir(BUILD_ROOT_PATH);
}
// build or install libraries
$builder->setupLibs();
if ($this->input->getOption('with-clean')) {
logger()->info('Cleaning source dir...');
FileSystem::removeDir(SOURCE_PATH);
}
// Process -I option
$custom_ini = [];
foreach ($this->input->getOption('with-hardcoded-ini') as $value) {