Skip to content

Commit

Permalink
Merge pull request #692 from jingjingxyk/experiment-feature
Browse files Browse the repository at this point in the history
Experiment feature
  • Loading branch information
jingjingxyk committed Jul 11, 2024
2 parents a6a90f5 + f537547 commit f9e4c7e
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 6 deletions.
8 changes: 7 additions & 1 deletion prepare.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@
$p = Preprocessor::getInstance();
$p->parseArguments($argc, $argv);

$buildType = $p->getBuildType();
if ($p->getInputOption('with-build-type')) {
$buildType = $p->getInputOption('with-build-type');
$p->setBuildType($buildType);
}

# clean
# clean old make.sh
Expand All @@ -26,7 +31,7 @@


// Sync code from php-src
$p->setPhpSrcDir($homeDir . '/.phpbrew/build/php-' . BUILD_PHP_VERSION);
$p->setPhpSrcDir($p->getWorkDir() . '/var/php-' . BUILD_PHP_VERSION);

// Compile directly on the host machine, not in the docker container
if ($p->getInputOption('without-docker') || ($p->isMacos())) {
Expand All @@ -39,6 +44,7 @@
$p->setExtEnabled([]);
}


if ($p->getInputOption('with-global-prefix')) {
$p->setGlobalPrefix($p->getInputOption('with-global-prefix'));
}
Expand Down
9 changes: 7 additions & 2 deletions sapi/src/Preprocessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,11 @@ public function getWorkDir(): string
return $this->workDir;
}

public function getWorkExtDir(): string
{
return $this->workDir . '/ext/';
}

public function setExtraLdflags(string $flags)
{
$this->extraLdflags = $flags;
Expand Down Expand Up @@ -453,7 +458,7 @@ public function donotInstallLibrary(): void
/**
* @param string $url
* @param string $file
* @param object|null $project
* @param object|null $project [ $lib or $ext ]
* @param string $httpProxyConfig
* @return void
*/
Expand Down Expand Up @@ -1182,7 +1187,7 @@ public function execute(): void
$this->setExtensionDependency();

if ($this->getInputOption('skip-download')) {
$this->generateLibraryDownloadLinks();
$this->generateDownloadLinks();
}

$this->generateFile(__DIR__ . '/template/make-install-deps.php', $this->rootDir . '/make-install-deps.sh');
Expand Down
2 changes: 1 addition & 1 deletion sapi/src/PreprocessorTrait/DownloadBoxTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ trait DownloadBoxTrait

EOF;

protected function generateLibraryDownloadLinks(): void
protected function generateDownloadLinks(): void
{
$this->mkdirIfNotExists($this->getRootDir() . '/var/download-box/', 0755, true);

Expand Down
5 changes: 3 additions & 2 deletions sapi/src/builder/extension/aaa_example.php
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,10 @@

// 扩展钩子 写法
$p->withBeforeConfigureScript('swoole', function (Preprocessor $p) {
$workdir = $p->getWorkDir();
$workDir = $p->getWorkDir();
$workExtDir = $p->getWorkExtDir();
$cmd = <<<EOF
cd {$workdir}
cd {$workDir}
# 构建之前对 swoole 源码做一些特别处理
# 比如加载一个补丁等
# 比如修改 swoole 源码的构建文件
Expand Down

0 comments on commit f9e4c7e

Please sign in to comment.