Skip to content
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion src/SPC/builder/Extension.php
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,16 @@ public function patchBeforeSharedConfigure(): bool
return false;
}

/**
* Patch code before shared extension make
* If you need to patch some code, overwrite this
* return true if you patched something, false if not
*/
public function patchBeforeSharedMake(): bool
{
return false;
}

/**
* @return string
* returns a command line string with all required shared extensions to load
Expand Down Expand Up @@ -390,7 +400,7 @@ public function buildUnixShared(): void
->exec(BUILD_BIN_PATH . '/phpize');

if ($this->patchBeforeSharedConfigure()) {
logger()->info('ext [ . ' . $this->getName() . '] patching before shared configure');
logger()->info('ext [' . $this->getName() . '] patching before shared configure');
}

shell()->cd($this->source_dir)
Expand All @@ -408,6 +418,10 @@ public function buildUnixShared(): void
'$1 ' . $staticLibString
);

if ($this->patchBeforeSharedMake()) {
logger()->info('ext [' . $this->getName() . '] patching before shared make');
}

shell()->cd($this->source_dir)
->setEnv($env)
->exec('make clean')
Expand Down
10 changes: 10 additions & 0 deletions src/SPC/builder/extension/uv.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
namespace SPC\builder\extension;

use SPC\builder\Extension;
use SPC\store\FileSystem;
use SPC\util\CustomExt;

#[CustomExt('uv')]
Expand All @@ -16,4 +17,13 @@ public function validate(): void
throw new \RuntimeException('The latest uv extension requires PHP 8.0 or later');
}
}

public function patchBeforeSharedMake(): bool
{
if (PHP_OS_FAMILY !== 'Linux' || arch2gnu(php_uname('m')) !== 'aarch64') {
return false;
}
FileSystem::replaceFileRegex($this->source_dir . '/Makefile', '/^(LDFLAGS =.*)$/m', '$1 -luv -ldl -lrt -pthread');
return true;
}
}
3 changes: 1 addition & 2 deletions src/SPC/doctor/item/LinuxToolCheckList.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,7 @@ public function checkCliTools(): ?CheckResult

$required = match ($distro['dist']) {
'alpine' => self::TOOLS_ALPINE,
'redhat' => self::TOOLS_RHEL,
'centos' => array_merge(self::TOOLS_RHEL, ['perl-IPC-Cmd']),
'redhat', 'centos' => self::TOOLS_RHEL,
'arch' => self::TOOLS_ARCH,
default => self::TOOLS_DEBIAN,
};
Expand Down