mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-07-02 14:25:41 +08:00
feat(gmssl): add patch for pbkdf2_hmac_sm3_genkey rename and update build process
This commit is contained in:
@@ -27,6 +27,18 @@ class gmssl extends PhpExtensionPackage
|
||||
);
|
||||
}
|
||||
|
||||
#[BeforeStage('php', [php::class, 'buildconfForUnix'], 'ext-gmssl')]
|
||||
#[BeforeStage('php', [php::class, 'buildconfForWindows'], 'ext-gmssl')]
|
||||
#[PatchDescription('Fix ext-gmssl v1.1.1: pbkdf2_hmac_sm3_genkey was renamed to sm3_pbkdf2 in GmSSL >= 3.2.0')]
|
||||
public function patchPbkdf2Rename(): void
|
||||
{
|
||||
FileSystem::replaceFileStr(
|
||||
"{$this->getSourceDir()}/gmssl.c",
|
||||
'pbkdf2_hmac_sm3_genkey',
|
||||
'sm3_pbkdf2'
|
||||
);
|
||||
}
|
||||
|
||||
#[BeforeStage('php', [php::class, 'buildconfForWindows'], 'ext-gmssl')]
|
||||
#[PatchDescription('Add CHECK_LIB to config.w32 for static Windows builds')]
|
||||
public function patchBeforeBuildconfWin(): bool
|
||||
|
||||
@@ -45,13 +45,13 @@ class gmssl
|
||||
->toStep(1)
|
||||
->build();
|
||||
|
||||
// fix cmake_install.cmake install prefix (GmSSL overrides it internally)
|
||||
$installCmake = "{$buildDir}\\cmake_install.cmake";
|
||||
FileSystem::writeFile(
|
||||
$installCmake,
|
||||
'set(CMAKE_INSTALL_PREFIX "' . str_replace('\\', '/', $lib->getBuildRootPath()) . '")' . PHP_EOL . FileSystem::readFile($installCmake)
|
||||
);
|
||||
cmd()->cd($buildDir)->exec('nmake gmssl XCFLAGS=/MT');
|
||||
|
||||
cmd()->cd($buildDir)->exec('nmake install XCFLAGS=/MT');
|
||||
$libPath = "{$lib->getBuildRootPath()}/lib";
|
||||
$incPath = "{$lib->getBuildRootPath()}/include/gmssl";
|
||||
FileSystem::createDir($libPath);
|
||||
FileSystem::createDir($incPath);
|
||||
FileSystem::copy("{$buildDir}\\bin\\gmssl.lib", "{$libPath}/gmssl.lib");
|
||||
FileSystem::copyDir("{$lib->getSourceDir()}\\include\\gmssl", $incPath);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user