Skip to content

Commit 7d45415

Browse files
committed
patch before make for uv
1 parent 625ee27 commit 7d45415

File tree

2 files changed

+22
-4
lines changed

2 files changed

+22
-4
lines changed

src/SPC/builder/Extension.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,6 +208,16 @@ public function patchBeforeSharedConfigure(): bool
208208
return false;
209209
}
210210

211+
/**
212+
* Patch code before shared extension make
213+
* If you need to patch some code, overwrite this
214+
* return true if you patched something, false if not
215+
*/
216+
public function patchBeforeSharedMake(): bool
217+
{
218+
return false;
219+
}
220+
211221
/**
212222
* @return string
213223
* returns a command line string with all required shared extensions to load
@@ -408,6 +418,10 @@ public function buildUnixShared(): void
408418
'$1 ' . $staticLibString
409419
);
410420

421+
if ($this->patchBeforeSharedMake()) {
422+
logger()->info('ext [ . ' . $this->getName() . '] patching before shared make');
423+
}
424+
411425
shell()->cd($this->source_dir)
412426
->setEnv($env)
413427
->exec('make clean')

src/SPC/builder/extension/uv.php

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
namespace SPC\builder\extension;
66

77
use SPC\builder\Extension;
8+
use SPC\builder\linux\SystemUtil;
9+
use SPC\store\FileSystem;
810
use SPC\util\CustomExt;
911

1012
#[CustomExt('uv')]
@@ -17,10 +19,12 @@ public function validate(): void
1719
}
1820
}
1921

20-
public function getStaticAndSharedLibs(): array
22+
public function patchBeforeSharedMake(): bool
2123
{
22-
[$static, $shared] = parent::getStaticAndSharedLibs();
23-
$shared .= ' -lpthread';
24-
return [$static, $shared];
24+
if (SystemUtil::getLibcVersionIfExists() >= '2.17') {
25+
return false;
26+
}
27+
FileSystem::replaceFileRegex($this->source_dir . '/Makefile', '/^(LDFLAGS =.*)$/', '$1 -luv -ldl -lrt -pthread');
28+
return true;
2529
}
2630
}

0 commit comments

Comments
 (0)