add some tests and iconv support

This commit is contained in:
crazywhalecc 2023-04-03 21:27:50 +08:00
parent 1731cc1202
commit 29e0269588
No known key found for this signature in database
GPG Key ID: 1F4BDD59391F2680
6 changed files with 70 additions and 7 deletions

View File

@ -111,7 +111,7 @@
},
"iconv": {
"type": "builtin",
"arg-type": "with",
"arg-type": "custom",
"lib-depends-windows": [
"libiconv"
]

View File

@ -8,20 +8,20 @@
| | Linux | macOS | Windows |
|------------|--------------------------------------------------------------------|--------------------------------------------------------------------|---------|
| bcmath | yes | yes | |
| bz2 | yes | untested | |
| bz2 | yes | yes | |
| calendar | yes | yes | |
| ctype | yes | yes | |
| curl | untested | yes | |
| date | yes | yes | |
| dba | yes | yes | |
| dom | untested | untested | |
| dom | yes | yes | |
| enchant | | | |
| event | | | |
| exif | yes | yes | |
| filter | yes | yes | |
| fileinfo | yes | | |
| ftp | yes | yes | |
| gd | untested | untested | |
| gd | untested | yes | |
| gettext | | | |
| gmp | untested | untested | |
| hash | yes | yes | |
@ -33,7 +33,7 @@
| mysqli | | | |
| mysqlnd | yes | yes | |
| openssl | untested | yes | |
| pcntl | untested | untested | |
| pcntl | untested | yes | |
| pdo | yes | yes | |
| pdo_mysql | yes | yes | |
| pdo_sqlite | yes | yes | |
@ -47,7 +47,7 @@
| shmop | untested | | |
| simplexml | untested | untested | |
| soap | untested | | |
| sockets | untested | | |
| sockets | untested | yes | |
| sqlite3 | untested | untested | |
| swow | | | |
| swoole | [faulty](https://github.com/crazywhalecc/static-php-cli/issues/32) | [faulty](https://github.com/crazywhalecc/static-php-cli/issues/32) | |

View File

@ -183,6 +183,9 @@ class Extension
$arg .= ' --with-event-openssl --with-openssl-dir="' . BUILD_ROOT_PATH . '"';
}
break;*/
case 'iconv':
$arg = ' --with-iconv="' . BUILD_ROOT_PATH . '"';
break;
case 'mbstring':
$arg = ' --disable-mbregex ONIG_CFLAGS=-I"' . BUILD_ROOT_PATH . '" ' .
'ONIG_LIBS="' . $this->getLibFilesString() . '" ';

View File

@ -0,0 +1,47 @@
<?php
/**
* Copyright (c) 2022 Yun Dou <dixyes@gmail.com>
*
* lwmbs is licensed under Mulan PSL v2. You can use this
* software according to the terms and conditions of the
* Mulan PSL v2. You may obtain a copy of Mulan PSL v2 at:
*
* http://license.coscl.org.cn/MulanPSL2
*
* THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS,
* WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED,
* INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT,
* MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE.
*
* See the Mulan PSL v2 for more details.
*/
declare(strict_types=1);
namespace SPC\builder\macos\library;
use SPC\exception\RuntimeException;
class libiconv extends MacOSLibraryBase
{
public const NAME = 'libiconv';
/**
* @throws RuntimeException
*/
public function build()
{
[,,$destdir] = SEPARATED_PATH;
shell()->cd($this->source_dir)
->exec(
"{$this->builder->configure_env} ./configure " .
'--enable-static ' .
'--disable-shared ' .
'--prefix='
)
->exec('make clean')
->exec("make -j{$this->builder->concurrency}")
->exec('make install DESTDIR=' . $destdir);
}
}

View File

@ -2,4 +2,9 @@
declare(strict_types=1);
exit(class_exists('\\DOMDocument') ? 0 : 1);
if (!class_exists('\\DOMDocument')) {
exit(1);
}
$doc = new DOMDocument();
$doc->loadHtml("<html><head><meta charset=\"UTF-8\"><meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\"></head><body id='app'>Hello</body></html>");
exit($doc->getElementById('app')->nodeValue === 'Hello' ? 0 : 1);

8
src/globals/tests/gd.php Normal file
View File

@ -0,0 +1,8 @@
<?php
declare(strict_types=1);
$info = gd_info();
$true = $info['JPEG Support'] ?? false;
$true = $true ? ($info['PNG Support'] ?? false) : false;
exit($true ? 0 : 1);