Skip to content

Commit c1c31a7

Browse files
V3 feat/win (#999)
Co-authored-by: Copilot <[email protected]>
2 parents 66d3af5 + 910f10a commit c1c31a7

37 files changed

+1564
-690
lines changed

captainhook.json

Lines changed: 44 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,44 @@
1-
{
2-
"pre-push": {
3-
"enabled": true,
4-
"actions": [
5-
{
6-
"action": "composer analyse"
7-
}
8-
]
9-
},
10-
"pre-commit": {
11-
"enabled": true,
12-
"actions": [
13-
{
14-
"action": "composer cs-fix -- --config=.php-cs-fixer.php --dry-run --diff {$STAGED_FILES|of-type:php}",
15-
"conditions": [
16-
{
17-
"exec": "\\CaptainHook\\App\\Hook\\Condition\\FileStaged\\OfType",
18-
"args": ["php"]
19-
}
20-
]
21-
}
22-
]
23-
},
24-
"post-change": {
25-
"enabled": true,
26-
"actions": [
27-
{
28-
"action": "composer install",
29-
"options": [],
30-
"conditions": [
31-
{
32-
"exec": "\\CaptainHook\\App\\Hook\\Condition\\FileChanged\\Any",
33-
"args": [
34-
[
35-
"composer.json",
36-
"composer.lock"
37-
]
38-
]
39-
}
40-
]
41-
}
42-
]
43-
}
44-
}
1+
{
2+
"pre-push": {
3+
"enabled": true,
4+
"actions": [
5+
{
6+
"action": "php vendor/bin/phpstan analyse --memory-limit 300M"
7+
}
8+
]
9+
},
10+
"pre-commit": {
11+
"enabled": true,
12+
"actions": [
13+
{
14+
"action": "php vendor/bin/php-cs-fixer fix --config=.php-cs-fixer.php --dry-run --diff {$STAGED_FILES|of-type:php} --sequential",
15+
"conditions": [
16+
{
17+
"exec": "\\CaptainHook\\App\\Hook\\Condition\\FileStaged\\OfType",
18+
"args": ["php"]
19+
}
20+
]
21+
}
22+
]
23+
},
24+
"post-change": {
25+
"enabled": true,
26+
"actions": [
27+
{
28+
"action": "composer install",
29+
"options": [],
30+
"conditions": [
31+
{
32+
"exec": "\\CaptainHook\\App\\Hook\\Condition\\FileChanged\\Any",
33+
"args": [
34+
[
35+
"composer.json",
36+
"composer.lock"
37+
]
38+
]
39+
}
40+
]
41+
}
42+
]
43+
}
44+
}

config/artifact.json

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,11 @@
8080
},
8181
"strawberry-perl": {
8282
"binary": {
83-
"windows-x86_64": "https://github.com/StrawberryPerl/Perl-Dist-Strawberry/releases/download/SP_5380_5361/strawberry-perl-5.38.0.1-64bit-portable.zip"
83+
"windows-x86_64": {
84+
"type": "url",
85+
"url": "https://github.com/StrawberryPerl/Perl-Dist-Strawberry/releases/download/SP_5380_5361/strawberry-perl-5.38.0.1-64bit-portable.zip",
86+
"extract": "{pkg_root_path}/strawberry-perl"
87+
}
8488
}
8589
},
8690
"upx": {
@@ -395,7 +399,7 @@
395399
"binary": "hosted",
396400
"source": {
397401
"type": "git",
398-
"rev": "v1.75.x",
402+
"regex": "v(?<version>1.\\d+).x",
399403
"url": "https://github.com/grpc/grpc.git"
400404
}
401405
},

config/pkg.target.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,10 @@
11
{
22
"vswhere": {
33
"type": "target",
4-
"artifact": "vswhere"
4+
"artifact": "vswhere",
5+
"static-bins@windows": [
6+
"vswhere.exe"
7+
]
58
},
69
"pkg-config": {
710
"type": "target",

src/Package/Library/imap.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
#[Library('imap')]
1515
class imap
1616
{
17-
#[AfterStage('php', [php::class, 'patchEmbedScripts'], 'imap')]
17+
#[AfterStage('php', [php::class, 'patchUnixEmbedScripts'], 'imap')]
1818
#[PatchDescription('Fix missing -lcrypt in php-config libs on glibc systems')]
1919
public function afterPatchScripts(): void
2020
{

src/Package/Library/onig.php

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Package\Library;
6+
7+
use StaticPHP\Attribute\Package\BuildFor;
8+
use StaticPHP\Attribute\Package\Library;
9+
use StaticPHP\Package\LibraryPackage;
10+
use StaticPHP\Runtime\Executor\WindowsCMakeExecutor;
11+
use StaticPHP\Util\FileSystem;
12+
13+
#[Library('onig')]
14+
class onig
15+
{
16+
#[BuildFor('Windows')]
17+
public function buildWin(LibraryPackage $package): void
18+
{
19+
WindowsCMakeExecutor::create($package)
20+
->addConfigureArgs('-DMSVC_STATIC_RUNTIME=ON')
21+
->build();
22+
FileSystem::copy("{$package->getLibDir()}\\onig.lib", "{$package->getLibDir()}\\onig_a.lib");
23+
}
24+
}

0 commit comments

Comments
 (0)