diff --git a/composer.json b/composer.json index e6c2354c..d006fbbf 100644 --- a/composer.json +++ b/composer.json @@ -49,7 +49,7 @@ "scripts": { "analyse": "phpstan analyse --memory-limit 300M", "cs-fix": "php-cs-fixer fix", - "lint-config": "bin/spc dev:lint-config", + "lint-config": "php bin/spc dev:lint-config", "test": "vendor/bin/phpunit tests/ --no-coverage", "build:phar": "vendor/bin/box compile" }, diff --git a/config/pkg/ext/builtin-extensions.yml b/config/pkg/ext/builtin-extensions.yml index e5a6d28a..c4a938d1 100644 --- a/config/pkg/ext/builtin-extensions.yml +++ b/config/pkg/ext/builtin-extensions.yml @@ -9,6 +9,14 @@ ext-bz2: arg-type@windows: with ext-calendar: type: php-extension +ext-com_dotnet: + type: php-extension + php-extension: + support: + Linux: 'no' + Darwin: 'no' + BSD: 'no' + arg-type@windows: '--enable-com-dotnet=yes' ext-ctype: type: php-extension ext-curl: @@ -30,17 +38,20 @@ ext-dba: ext-dom: type: php-extension depends: - - libxml2 - ext-xml php-extension: - arg-type: '--enable-dom@shared_suffix@ --with-libxml=@build_root_path@' + arg-type: enable arg-type@windows: with ext-exif: type: php-extension + depends@windows: + - ext-mbstring ext-ffi: type: php-extension depends@unix: - libffi + depends@windows: + - libffi-win php-extension: arg-type@unix: '--with-ffi=@shared_suffix@ --enable-zend-signals' arg-type@windows: with @@ -101,11 +112,12 @@ ext-ldap: ext-libxml: type: php-extension depends: - - ext-xml + - libxml2 php-extension: build-with-php: true build-shared: false - arg-type: none + arg-type@unix: with-path + arg-type@windows: with ext-mbregex: type: php-extension depends: @@ -239,7 +251,7 @@ ext-simplexml: depends: - ext-xml php-extension: - arg-type@unix: '--enable-simplexml@shared_suffix@ --with-libxml=@build_root_path@' + arg-type@unix: enable arg-type@windows: with build-with-php: true ext-snmp: @@ -254,7 +266,7 @@ ext-soap: - ext-xml - ext-session php-extension: - arg-type@unix: '--enable-soap@shared_suffix@ --with-libxml=@build_root_path@' + arg-type@unix: enable arg-type@windows: with build-with-php: true ext-sockets: @@ -306,27 +318,27 @@ ext-tokenizer: ext-xml: type: php-extension depends: - - libxml2 + - ext-libxml depends@windows: - - libxml2 - ext-iconv + - ext-libxml php-extension: - arg-type: '--enable-xml@shared_suffix@ --with-libxml=@build_root_path@' + arg-type@unix: enable arg-type@windows: with build-with-php: true ext-xmlreader: type: php-extension depends: - - libxml2 + - ext-xml php-extension: - arg-type: '--enable-xmlreader@shared_suffix@ --with-libxml=@build_root_path@' + arg-type: enable build-with-php: true ext-xmlwriter: type: php-extension depends: - - libxml2 + - ext-xml php-extension: - arg-type: '--enable-xmlwriter@shared_suffix@ --with-libxml=@build_root_path@' + arg-type: enable build-with-php: true ext-xsl: type: php-extension diff --git a/config/pkg/ext/ext-excimer.yml b/config/pkg/ext/ext-excimer.yml index 3d085888..a896fe0b 100644 --- a/config/pkg/ext/ext-excimer.yml +++ b/config/pkg/ext/ext-excimer.yml @@ -7,3 +7,7 @@ ext-excimer: metadata: license-files: [LICENSE] license: PHP-3.01 + php-extension: + os: + - Linux + - Darwin diff --git a/config/pkg/ext/ext-parallel.yml b/config/pkg/ext/ext-parallel.yml index a3e91efe..94103f57 100644 --- a/config/pkg/ext/ext-parallel.yml +++ b/config/pkg/ext/ext-parallel.yml @@ -7,3 +7,7 @@ ext-parallel: metadata: license-files: [LICENSE] license: PHP-3.01 + depends@windows: + - pthreads4w + php-extension: + arg-type@windows: with diff --git a/src/Package/Artifact/php_src.php b/src/Package/Artifact/php_src.php index 119f9056..b52ba728 100644 --- a/src/Package/Artifact/php_src.php +++ b/src/Package/Artifact/php_src.php @@ -45,7 +45,13 @@ class php_src FileSystem::replaceFileStr(SOURCE_PATH . '/php-src/ext/gd/libgd/gdft.c', '#ifndef MSWIN32', '#ifndef _WIN32'); } // custom config.w32, because official config.w32 is hard-coded many things - $origin = $ver_id >= 80100 ? file_get_contents(ROOT_DIR . '/src/globals/extra/gd_config_81.w32') : file_get_contents(ROOT_DIR . '/src/globals/extra/gd_config_80.w32'); + if ($ver_id >= 80500) { + $origin = file_get_contents(ROOT_DIR . '/src/globals/extra/gd_config_85.w32'); + } elseif ($ver_id >= 80100) { + $origin = file_get_contents(ROOT_DIR . '/src/globals/extra/gd_config_81.w32'); + } else { + $origin = file_get_contents(ROOT_DIR . '/src/globals/extra/gd_config_80.w32'); + } file_put_contents(SOURCE_PATH . '/php-src/ext/gd/config.w32.bak', file_get_contents(SOURCE_PATH . '/php-src/ext/gd/config.w32')); file_put_contents(SOURCE_PATH . '/php-src/ext/gd/config.w32', $origin); } diff --git a/src/Package/Extension/ev.php b/src/Package/Extension/ev.php new file mode 100644 index 00000000..b4b4b942 --- /dev/null +++ b/src/Package/Extension/ev.php @@ -0,0 +1,30 @@ +getSourceDir()}\\config.w32", + 'EXTENSION(\'ev\'', + " EXTENSION('ev', php_ev_sources, PHP_EV_SHARED, ' /DZEND_ENABLE_STATIC_TSRMLS_CACHE=1');" + ); + return true; + } +} diff --git a/src/Package/Extension/intl.php b/src/Package/Extension/intl.php new file mode 100644 index 00000000..f5e17c1f --- /dev/null +++ b/src/Package/Extension/intl.php @@ -0,0 +1,29 @@ +getTargetPackage('php')->getSourceDir(); + FileSystem::replaceFileStr( + "{$php_src}/ext/intl/config.w32", + 'EXTENSION("intl", "php_intl.c intl_convert.c intl_convertcpp.cpp intl_error.c ", true,', + 'EXTENSION("intl", "php_intl.c intl_convert.c intl_convertcpp.cpp intl_error.c ", PHP_INTL_SHARED,' + ); + } +} diff --git a/src/Package/Extension/mbregex.php b/src/Package/Extension/mbregex.php index f01c7c78..20b02546 100644 --- a/src/Package/Extension/mbregex.php +++ b/src/Package/Extension/mbregex.php @@ -12,6 +12,7 @@ class mbregex { #[CustomPhpConfigureArg('Linux')] #[CustomPhpConfigureArg('Darwin')] + #[CustomPhpConfigureArg('Windows')] public function getUnixConfigureArg(): string { return ''; diff --git a/src/Package/Extension/mbstring.php b/src/Package/Extension/mbstring.php index 5c3c31d1..b6d818f1 100644 --- a/src/Package/Extension/mbstring.php +++ b/src/Package/Extension/mbstring.php @@ -19,4 +19,10 @@ class mbstring $arg .= $installer->isPackageResolved('ext-mbregex') === false ? ' --disable-mbregex' : ' --enable-mbregex'; return $arg; } + + #[CustomPhpConfigureArg('Windows')] + public function getWinConfigureArg(PackageInstaller $installer): string + { + return '--enable-mbstring ' . ($installer->isPackageResolved('ext-mbregex') ? '--enable-mbregex' : ' --disable-mbregex'); + } } diff --git a/src/Package/Library/libjpeg.php b/src/Package/Library/libjpeg.php index 6e06bfb7..85b0f6d4 100644 --- a/src/Package/Library/libjpeg.php +++ b/src/Package/Library/libjpeg.php @@ -37,6 +37,7 @@ class libjpeg '-DENABLE_STATIC=ON', '-DBUILD_TESTING=OFF', '-DWITH_JAVA=OFF', + '-DWITH_SIMD=OFF', '-DWITH_CRT_DLL=OFF', ) ->optionalPackage('zlib', '-DENABLE_ZLIB_COMPRESSION=ON', '-DENABLE_ZLIB_COMPRESSION=OFF') diff --git a/src/StaticPHP/Command/ResetCommand.php b/src/StaticPHP/Command/ResetCommand.php index 4a55f792..207f6484 100644 --- a/src/StaticPHP/Command/ResetCommand.php +++ b/src/StaticPHP/Command/ResetCommand.php @@ -4,6 +4,7 @@ declare(strict_types=1); namespace StaticPHP\Command; +use StaticPHP\Runtime\Shell\Shell; use StaticPHP\Util\FileSystem; use StaticPHP\Util\InteractiveTerm; use Symfony\Component\Console\Attribute\AsCommand; @@ -87,20 +88,24 @@ class ResetCommand extends BaseCommand // Try using PowerShell for force deletion $escaped_path = escapeshellarg($path); + Shell::passthruCallback(fn () => InteractiveTerm::advance()); // Use PowerShell Remove-Item with -Force and -Recurse - $ps_cmd = "powershell -Command \"Remove-Item -Path {$escaped_path} -Recurse -Force -ErrorAction SilentlyContinue\""; - f_exec($ps_cmd, $output, $ret_code); - + $result = cmd()->execWithResult("powershell -Command \"Remove-Item -Path {$escaped_path} -Recurse -Force -ErrorAction SilentlyContinue\"", false); + $ret_code = $result[0]; // If PowerShell fails or directory still exists, try cmd rmdir if ($ret_code !== 0 || is_dir($path)) { $cmd_command = "rmdir /s /q {$escaped_path}"; - f_exec($cmd_command, $output, $ret_code); + $result = cmd()->execWithResult($cmd_command, false); + if ($result[0] === 0) { + return; + } } // Final fallback: use FileSystem::removeDir if (is_dir($path)) { FileSystem::removeDir($path); } + Shell::passthruCallback(null); } } diff --git a/src/StaticPHP/Config/ConfigValidator.php b/src/StaticPHP/Config/ConfigValidator.php index 919de86d..b66250cc 100644 --- a/src/StaticPHP/Config/ConfigValidator.php +++ b/src/StaticPHP/Config/ConfigValidator.php @@ -34,6 +34,7 @@ class ConfigValidator 'build-with-php' => ConfigType::BOOL, 'notes' => ConfigType::BOOL, 'display-name' => ConfigType::STRING, + 'os' => ConfigType::LIST_ARRAY, // library and target fields 'headers' => ConfigType::LIST_ARRAY, // @ @@ -88,6 +89,7 @@ class ConfigValidator 'build-with-php' => false, 'notes' => false, 'display-name' => false, + 'os' => false, ]; public const array ARTIFACT_TYPE_FIELDS = [ // [required_fields, optional_fields]