mirror of
https://github.com/crazywhalecc/static-php-cli.git
synced 2026-07-03 23:05:41 +08:00
Add pthreads4w
This commit is contained in:
12
config/pkg/lib/pthreads4w.yml
Normal file
12
config/pkg/lib/pthreads4w.yml
Normal file
@@ -0,0 +1,12 @@
|
||||
pthreads4w:
|
||||
type: library
|
||||
artifact:
|
||||
source:
|
||||
type: git
|
||||
rev: master
|
||||
url: 'https://git.code.sf.net/p/pthreads4w/code'
|
||||
metadata:
|
||||
license-files: [LICENSE]
|
||||
license: Apache-2.0
|
||||
static-libs@windows:
|
||||
- libpthreadVC3.lib
|
||||
34
src/Package/Library/pthreads4w.php
Normal file
34
src/Package/Library/pthreads4w.php
Normal file
@@ -0,0 +1,34 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Package\Library;
|
||||
|
||||
use StaticPHP\Attribute\Package\BuildFor;
|
||||
use StaticPHP\Attribute\Package\Library;
|
||||
use StaticPHP\Package\LibraryPackage;
|
||||
use StaticPHP\Util\FileSystem;
|
||||
|
||||
#[Library('pthreads4w')]
|
||||
class pthreads4w
|
||||
{
|
||||
#[BuildFor('Windows')]
|
||||
public function buildWin(LibraryPackage $lib): void
|
||||
{
|
||||
cmd()->cd($lib->getSourceDir())
|
||||
->exec(
|
||||
'nmake /E /nologo /f Makefile ' .
|
||||
'DESTROOT=' . $lib->getBuildRootPath() . ' ' .
|
||||
'XCFLAGS="/MT" ' . // no dll
|
||||
'EHFLAGS="/I. /DHAVE_CONFIG_H /Os /Ob2 /D__PTW32_STATIC_LIB /D__PTW32_BUILD_INLINED" ' .
|
||||
'pthreadVC3.inlined_static_stamp'
|
||||
);
|
||||
FileSystem::createDir($lib->getLibDir());
|
||||
FileSystem::createDir($lib->getIncludeDir());
|
||||
FileSystem::copy("{$lib->getSourceDir()}\\libpthreadVC3.lib", "{$lib->getLibDir()}\\libpthreadVC3.lib");
|
||||
FileSystem::copy("{$lib->getSourceDir()}\\_ptw32.h", "{$lib->getIncludeDir()}\\_ptw32.h");
|
||||
FileSystem::copy("{$lib->getSourceDir()}\\pthread.h", "{$lib->getIncludeDir()}\\pthread.h");
|
||||
FileSystem::copy("{$lib->getSourceDir()}\\sched.h", "{$lib->getIncludeDir()}\\sched.h");
|
||||
FileSystem::copy("{$lib->getSourceDir()}\\semaphore.h", "{$lib->getIncludeDir()}\\semaphore.h");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user