Skip to content

Commit d30ccb8

Browse files
committed
Merge remote-tracking branch 'origin/main' into zig
2 parents 8d75a85 + b04ffad commit d30ccb8

File tree

13 files changed

+145
-55
lines changed

13 files changed

+145
-55
lines changed

.github/workflows/tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ jobs:
190190
echo "UPX_CMD=$(php src/globals/test-extensions.php upx)" >> $GITHUB_ENV
191191
192192
- name: "Run Build Tests (download)"
193-
run: GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }} php src/globals/test-extensions.php download_cmd ${{ matrix.os }} ${{ matrix.php }}
193+
run: php src/globals/test-extensions.php download_cmd ${{ matrix.os }} ${{ matrix.php }}
194194

195195
- name: "Run Build Tests (build)"
196196
run: php src/globals/test-extensions.php build_cmd ${{ matrix.os }} ${{ matrix.php }}

config/ext.json

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -304,12 +304,14 @@
304304
},
305305
"intl": {
306306
"support": {
307-
"Windows": "no",
308307
"BSD": "wip"
309308
},
310309
"type": "builtin",
311-
"lib-depends": [
310+
"lib-depends-unix": [
312311
"icu"
312+
],
313+
"lib-depends-windows": [
314+
"icu-static-win"
313315
]
314316
},
315317
"ldap": {
@@ -336,6 +338,9 @@
336338
},
337339
"type": "builtin",
338340
"arg-type": "none",
341+
"ext-depends": [
342+
"xml"
343+
],
339344
"target": [
340345
"static"
341346
]

config/lib.json

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,18 @@
207207
"libicudata.a"
208208
]
209209
},
210+
"icu-static-win": {
211+
"source": "icu-static-win",
212+
"static-libs-windows": [
213+
"icudt.lib",
214+
"icuin.lib",
215+
"icuio.lib",
216+
"icuuc.lib"
217+
],
218+
"headers-windows": [
219+
"unicode"
220+
]
221+
},
210222
"imagemagick": {
211223
"source": "imagemagick",
212224
"static-libs-unix": [

config/source.json

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -342,6 +342,14 @@
342342
"path": "LICENSE"
343343
}
344344
},
345+
"icu-static-win": {
346+
"type": "url",
347+
"url": "https://dl.static-php.dev/static-php-cli/deps/icu-static-windows-x64/icu-static-windows-x64.zip",
348+
"license": {
349+
"type": "text",
350+
"text": "none"
351+
}
352+
},
345353
"igbinary": {
346354
"type": "url",
347355
"url": "https://pecl.php.net/get/igbinary",

src/SPC/builder/extension/intl.php

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

77
use SPC\builder\Extension;
8+
use SPC\builder\windows\WindowsBuilder;
89
use SPC\store\FileSystem;
910
use SPC\util\CustomExt;
1011

@@ -13,13 +14,15 @@ class intl extends Extension
1314
{
1415
public function patchBeforeBuildconf(): bool
1516
{
16-
// TODO: remove the following line when https://github.com/php/php-src/pull/14002 will be released
17-
FileSystem::replaceFileStr(SOURCE_PATH . '/php-src/ext/intl/config.m4', 'PHP_CXX_COMPILE_STDCXX(11', 'PHP_CXX_COMPILE_STDCXX(17');
18-
// Also need to use clang++ -std=c++17 to force override the default C++ standard
19-
if (is_string($env = getenv('CXX')) && !str_contains($env, 'std=c++17')) {
20-
f_putenv('CXX=' . $env . ' -std=c++17');
17+
if ($this->builder instanceof WindowsBuilder) {
18+
FileSystem::replaceFileStr(
19+
SOURCE_PATH . '/php-src/ext/intl/config.w32',
20+
'EXTENSION("intl", "php_intl.c intl_convert.c intl_convertcpp.cpp intl_error.c ", true,',
21+
'EXTENSION("intl", "php_intl.c intl_convert.c intl_convertcpp.cpp intl_error.c ", PHP_INTL_SHARED,'
22+
);
23+
return true;
2124
}
22-
return true;
25+
return false;
2326
}
2427

2528
public function patchBeforeSharedPhpize(): bool

src/SPC/builder/linux/LinuxBuilder.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public function __construct(array $options = [])
2828
// check musl-cross make installed if we use musl-cross-make
2929
$arch = arch2gnu(php_uname('m'));
3030

31-
GlobalEnvManager::init($this);
31+
GlobalEnvManager::init();
3232

3333
if (getenv('SPC_LIBC') === 'musl' && !SystemUtil::isMuslDist()) {
3434
$this->setOptionIfNotExist('library_path', "LIBRARY_PATH=\"/usr/local/musl/{$arch}-linux-musl/lib\"");

src/SPC/builder/macos/MacOSBuilder.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public function __construct(array $options = [])
2828
$this->options = $options;
2929

3030
// apply global environment variables
31-
GlobalEnvManager::init($this);
31+
GlobalEnvManager::init();
3232

3333
// ---------- set necessary compile vars ----------
3434
// concurrency

src/SPC/builder/windows/WindowsBuilder.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ public function __construct(array $options = [])
3333
{
3434
$this->options = $options;
3535

36-
GlobalEnvManager::init($this);
36+
GlobalEnvManager::init();
3737

3838
// ---------- set necessary options ----------
3939
// set sdk (require visual studio 16 or 17)
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace SPC\builder\windows\library;
6+
7+
use SPC\store\FileSystem;
8+
9+
class icu_static_win extends WindowsLibraryBase
10+
{
11+
public const NAME = 'icu-static-win';
12+
13+
protected function build(): void
14+
{
15+
copy("{$this->source_dir}\\x64-windows-static\\lib\\icudt.lib", "{$this->getLibDir()}\\icudt.lib");
16+
copy("{$this->source_dir}\\x64-windows-static\\lib\\icuin.lib", "{$this->getLibDir()}\\icuin.lib");
17+
copy("{$this->source_dir}\\x64-windows-static\\lib\\icuio.lib", "{$this->getLibDir()}\\icuio.lib");
18+
copy("{$this->source_dir}\\x64-windows-static\\lib\\icuuc.lib", "{$this->getLibDir()}\\icuuc.lib");
19+
20+
// create libpq folder in buildroot/includes/libpq
21+
if (!file_exists("{$this->getIncludeDir()}\\unicode")) {
22+
mkdir("{$this->getIncludeDir()}\\unicode");
23+
}
24+
25+
FileSystem::copyDir("{$this->source_dir}\\x64-windows-static\\include\\unicode", "{$this->getIncludeDir()}\\unicode");
26+
}
27+
}

src/SPC/command/DeleteDownloadCommand.php

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ public function configure(): void
2222
{
2323
$this->addArgument('sources', InputArgument::REQUIRED, 'The sources/packages will be deleted, comma separated');
2424
$this->addOption('all', 'A', null, 'Delete all downloaded and locked sources/packages');
25+
$this->addOption('pre-built-only', 'W', null, 'Delete only pre-built sources/packages, not the original ones');
26+
$this->addOption('source-only', 'S', null, 'Delete only sources, not the pre-built packages');
2527
}
2628

2729
public function initialize(InputInterface $input, OutputInterface $output): void
@@ -51,10 +53,11 @@ public function handle(): int
5153
$deleted_sources = [];
5254
foreach ($chosen_sources as $source) {
5355
$source = trim($source);
54-
foreach ([$source, Downloader::getPreBuiltLockName($source)] as $name) {
55-
if (LockFile::get($name)) {
56-
$deleted_sources[] = $name;
57-
}
56+
if (LockFile::get($source) && !$this->getOption('pre-built-only')) {
57+
$deleted_sources[] = $source;
58+
}
59+
if (LockFile::get(Downloader::getPreBuiltLockName($source)) && !$this->getOption('source-only')) {
60+
$deleted_sources[] = Downloader::getPreBuiltLockName($source);
5861
}
5962
}
6063

0 commit comments

Comments
 (0)