add some tests and iconv support

This commit is contained in:
crazywhalecc
2023-04-03 21:27:50 +08:00
parent 1731cc1202
commit 29e0269588
6 changed files with 70 additions and 7 deletions

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);