mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-07-09 01:45:36 +08:00
Provide libevent, libiconv-win, libsodium, libwebp, libyaml, ncurses, readline, unixodbc, xz pre-built libs
This commit is contained in:
@@ -10,12 +10,36 @@ use SPC\store\FileSystem;
|
||||
|
||||
trait libevent
|
||||
{
|
||||
public function beforePack(): void
|
||||
{
|
||||
if (file_exists(BUILD_LIB_PATH . '/cmake/libevent/LibeventTargets-static.cmake')) {
|
||||
FileSystem::replaceFileRegex(
|
||||
BUILD_LIB_PATH . '/cmake/libevent/LibeventTargets-static.cmake',
|
||||
'/set\(_IMPORT_PREFIX .*\)/m',
|
||||
'set(_IMPORT_PREFIX "{BUILD_ROOT_PATH}")'
|
||||
);
|
||||
|
||||
FileSystem::replaceFileRegex(
|
||||
BUILD_LIB_PATH . '/cmake/libevent/LibeventTargets-static.cmake',
|
||||
'/INTERFACE_INCLUDE_DIRECTORIES ".*"/m',
|
||||
'INTERFACE_INCLUDE_DIRECTORIES "${_IMPORT_PREFIX}/include"'
|
||||
);
|
||||
|
||||
FileSystem::replaceFileRegex(
|
||||
BUILD_LIB_PATH . '/cmake/libevent/LibeventTargets-static.cmake',
|
||||
'/INTERFACE_LINK_LIBRARIES "libevent::core;.*"/m',
|
||||
'INTERFACE_LINK_LIBRARIES "libevent::core;${_IMPORT_PREFIX}/lib/libssl.a;${_IMPORT_PREFIX}/lib/libcrypto.a"'
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @throws RuntimeException
|
||||
* @throws FileSystemException
|
||||
*/
|
||||
protected function build(): void
|
||||
{
|
||||
[$lib, $include, $destdir] = SEPARATED_PATH;
|
||||
// CMake needs a clean build directory
|
||||
FileSystem::resetDir($this->source_dir . '/build');
|
||||
// Start build
|
||||
@@ -36,5 +60,25 @@ trait libevent
|
||||
)
|
||||
->execWithEnv("cmake --build . -j {$this->builder->concurrency}")
|
||||
->exec('make install');
|
||||
|
||||
$this->patchPkgconfPrefix(['libevent.pc', 'libevent_core.pc', 'libevent_extra.pc', 'libevent_openssl.pc']);
|
||||
|
||||
$this->patchPkgconfPrefix(
|
||||
['libevent_openssl.pc'],
|
||||
PKGCONF_PATCH_CUSTOM,
|
||||
[
|
||||
'/Libs.private:.*/m',
|
||||
'Libs.private: -lssl -lcrypto',
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
protected function install(): void
|
||||
{
|
||||
FileSystem::replaceFileStr(
|
||||
BUILD_LIB_PATH . '/cmake/libevent/LibeventTargets-static.cmake',
|
||||
'{BUILD_ROOT_PATH}',
|
||||
BUILD_ROOT_PATH
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user