mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-03-19 05:14:52 +08:00
fix copy command with BUILD_MODULES_CONSTANT
This commit is contained in:
parent
22001792cd
commit
b402b735d6
@ -194,7 +194,7 @@ class Extension
|
|||||||
*/
|
*/
|
||||||
public function runSharedExtensionCheckUnix(): void
|
public function runSharedExtensionCheckUnix(): void
|
||||||
{
|
{
|
||||||
[$ret] = shell()->execWithResult(BUILD_BIN_PATH . '/php -n -d "extension=' . BUILD_LIB_PATH . '/' . $this->getName() . '.so" --ri ' . $this->getName());
|
[$ret] = shell()->execWithResult(BUILD_BIN_PATH . '/php -n -d "extension=' . BUILD_MODULES_PATH . '/' . $this->getName() . '.so" --ri ' . $this->getName());
|
||||||
if ($ret !== 0) {
|
if ($ret !== 0) {
|
||||||
throw new RuntimeException($this->getName() . '.so failed to load');
|
throw new RuntimeException($this->getName() . '.so failed to load');
|
||||||
}
|
}
|
||||||
@ -308,7 +308,16 @@ class Extension
|
|||||||
->execWithEnv('make -j' . $this->builder->concurrency);
|
->execWithEnv('make -j' . $this->builder->concurrency);
|
||||||
|
|
||||||
// copy shared library
|
// copy shared library
|
||||||
copy($this->source_dir . '/modules/' . $this->getDistName() . '.so', BUILD_LIB_PATH . '/' . $this->getDistName() . '.so');
|
FileSystem::createDir(BUILD_MODULES_PATH);
|
||||||
|
$extensionDirFile = (getenv('EXTENSION_DIR') ?: $this->source_dir . '/modules') . '/' . $this->getName() . '.so';
|
||||||
|
$sourceDirFile = $this->source_dir . '/modules/' . $this->getName() . '.so';
|
||||||
|
if (file_exists($extensionDirFile)) {
|
||||||
|
copy($extensionDirFile, BUILD_MODULES_PATH . '/' . $this->getName() . '.so');
|
||||||
|
} elseif (file_exists($sourceDirFile)) {
|
||||||
|
copy($sourceDirFile, BUILD_MODULES_PATH . '/' . $this->getName() . '.so');
|
||||||
|
} else {
|
||||||
|
throw new RuntimeException('extension ' . $this->getName() . ' built successfully, but into an unexpected location.');
|
||||||
|
}
|
||||||
// check shared extension with php-cli
|
// check shared extension with php-cli
|
||||||
if (file_exists(BUILD_BIN_PATH . '/php')) {
|
if (file_exists(BUILD_BIN_PATH . '/php')) {
|
||||||
$this->runSharedExtensionCheckUnix();
|
$this->runSharedExtensionCheckUnix();
|
||||||
|
|||||||
@ -24,6 +24,17 @@ class opcache extends Extension
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function runSharedExtensionCheckUnix(): void
|
||||||
|
{
|
||||||
|
[$ret, $out] = shell()->execWithResult(BUILD_BIN_PATH . '/php -v');
|
||||||
|
if ($ret !== 0) {
|
||||||
|
throw new RuntimeException('opcache.so failed to load.');
|
||||||
|
}
|
||||||
|
if (!str_contains(join($out), 'with Zend OPcache')) {
|
||||||
|
throw new RuntimeException('opcache.so failed to load.');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public function patchBeforeBuildconf(): bool
|
public function patchBeforeBuildconf(): bool
|
||||||
{
|
{
|
||||||
if (file_exists(SOURCE_PATH . '/php-src/.opcache_patched')) {
|
if (file_exists(SOURCE_PATH . '/php-src/.opcache_patched')) {
|
||||||
|
|||||||
@ -13,9 +13,12 @@ class xdebug extends Extension
|
|||||||
{
|
{
|
||||||
public function runSharedExtensionCheckUnix(): void
|
public function runSharedExtensionCheckUnix(): void
|
||||||
{
|
{
|
||||||
[$ret] = shell()->execWithResult(BUILD_BIN_PATH . '/php -n -d "zend_extension=' . BUILD_LIB_PATH . '/xdebug.so" --ri xdebug');
|
[$ret, $out] = shell()->execWithResult(BUILD_BIN_PATH . '/php -v');
|
||||||
if ($ret !== 0) {
|
if ($ret !== 0) {
|
||||||
throw new RuntimeException('xdebug.so failed to load.');
|
throw new RuntimeException('xdebug.so failed to load.');
|
||||||
}
|
}
|
||||||
|
if (!str_contains(join($out), 'with Xdebug')) {
|
||||||
|
throw new RuntimeException('xdebug.so failed to load.');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -223,8 +223,8 @@ abstract class UnixBuilderBase extends BuilderBase
|
|||||||
default => throw new RuntimeException('Deployment does not accept type ' . $type),
|
default => throw new RuntimeException('Deployment does not accept type ' . $type),
|
||||||
};
|
};
|
||||||
logger()->info('Deploying ' . $this->getBuildTypeName($type) . ' file');
|
logger()->info('Deploying ' . $this->getBuildTypeName($type) . ' file');
|
||||||
FileSystem::createDir(BUILD_ROOT_PATH . '/bin');
|
FileSystem::createDir(BUILD_BIN_PATH);
|
||||||
shell()->exec('cp ' . escapeshellarg($src) . ' ' . escapeshellarg(BUILD_ROOT_PATH . '/bin/'));
|
shell()->exec('cp ' . escapeshellarg($src) . ' ' . escapeshellarg(BUILD_BIN_PATH));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -9,10 +9,17 @@ use SPC\builder\windows\SystemUtil as WindowsSystemUtil;
|
|||||||
use SPC\store\FileSystem;
|
use SPC\store\FileSystem;
|
||||||
use SPC\util\GlobalEnvManager;
|
use SPC\util\GlobalEnvManager;
|
||||||
|
|
||||||
|
// output path for everything, other paths are defined relative to this by default
|
||||||
define('BUILD_ROOT_PATH', FileSystem::convertPath(is_string($a = getenv('BUILD_ROOT_PATH')) ? $a : (WORKING_DIR . '/buildroot')));
|
define('BUILD_ROOT_PATH', FileSystem::convertPath(is_string($a = getenv('BUILD_ROOT_PATH')) ? $a : (WORKING_DIR . '/buildroot')));
|
||||||
|
// output path for header files for development
|
||||||
define('BUILD_INCLUDE_PATH', FileSystem::convertPath(is_string($a = getenv('BUILD_INCLUDE_PATH')) ? $a : (BUILD_ROOT_PATH . '/include')));
|
define('BUILD_INCLUDE_PATH', FileSystem::convertPath(is_string($a = getenv('BUILD_INCLUDE_PATH')) ? $a : (BUILD_ROOT_PATH . '/include')));
|
||||||
|
// output path for libraries and for libphp.so, if building shared embed
|
||||||
define('BUILD_LIB_PATH', FileSystem::convertPath(is_string($a = getenv('BUILD_LIB_PATH')) ? $a : (BUILD_ROOT_PATH . '/lib')));
|
define('BUILD_LIB_PATH', FileSystem::convertPath(is_string($a = getenv('BUILD_LIB_PATH')) ? $a : (BUILD_ROOT_PATH . '/lib')));
|
||||||
|
// output path for binaries
|
||||||
define('BUILD_BIN_PATH', FileSystem::convertPath(is_string($a = getenv('BUILD_BIN_PATH')) ? $a : (BUILD_ROOT_PATH . '/bin')));
|
define('BUILD_BIN_PATH', FileSystem::convertPath(is_string($a = getenv('BUILD_BIN_PATH')) ? $a : (BUILD_ROOT_PATH . '/bin')));
|
||||||
|
// output path for shared extensions
|
||||||
|
define('BUILD_MODULES_PATH', FileSystem::convertPath(is_string($a = getenv('BUILD_MODULES_PATH')) ? $a : (BUILD_ROOT_PATH . '/modules')));
|
||||||
|
|
||||||
define('PKG_ROOT_PATH', FileSystem::convertPath(is_string($a = getenv('PKG_ROOT_PATH')) ? $a : (WORKING_DIR . '/pkgroot')));
|
define('PKG_ROOT_PATH', FileSystem::convertPath(is_string($a = getenv('PKG_ROOT_PATH')) ? $a : (WORKING_DIR . '/pkgroot')));
|
||||||
define('SOURCE_PATH', FileSystem::convertPath(is_string($a = getenv('SOURCE_PATH')) ? $a : (WORKING_DIR . '/source')));
|
define('SOURCE_PATH', FileSystem::convertPath(is_string($a = getenv('SOURCE_PATH')) ? $a : (WORKING_DIR . '/source')));
|
||||||
define('DOWNLOAD_PATH', FileSystem::convertPath(is_string($a = getenv('DOWNLOAD_PATH')) ? $a : (WORKING_DIR . '/downloads')));
|
define('DOWNLOAD_PATH', FileSystem::convertPath(is_string($a = getenv('DOWNLOAD_PATH')) ? $a : (WORKING_DIR . '/downloads')));
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user