diff --git a/config/ext.json b/config/ext.json index 1e65910a..664dba9f 100644 --- a/config/ext.json +++ b/config/ext.json @@ -111,7 +111,7 @@ }, "iconv": { "type": "builtin", - "arg-type": "with", + "arg-type": "custom", "lib-depends-windows": [ "libiconv" ] diff --git a/ext-support.md b/ext-support.md index f54fc014..c84a3a33 100644 --- a/ext-support.md +++ b/ext-support.md @@ -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) | | diff --git a/src/SPC/builder/Extension.php b/src/SPC/builder/Extension.php index 8066447a..d6f999b0 100644 --- a/src/SPC/builder/Extension.php +++ b/src/SPC/builder/Extension.php @@ -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() . '" '; diff --git a/src/SPC/builder/macos/library/libiconv.php b/src/SPC/builder/macos/library/libiconv.php new file mode 100644 index 00000000..f8e603f3 --- /dev/null +++ b/src/SPC/builder/macos/library/libiconv.php @@ -0,0 +1,47 @@ + + * + * 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); + } +} diff --git a/src/globals/tests/dom.php b/src/globals/tests/dom.php index 6f18bdbf..cf16d573 100644 --- a/src/globals/tests/dom.php +++ b/src/globals/tests/dom.php @@ -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("Hello"); +exit($doc->getElementById('app')->nodeValue === 'Hello' ? 0 : 1); diff --git a/src/globals/tests/gd.php b/src/globals/tests/gd.php new file mode 100644 index 00000000..dc6b5176 --- /dev/null +++ b/src/globals/tests/gd.php @@ -0,0 +1,8 @@ +