add readline support

This commit is contained in:
crazywhalecc 2023-04-30 15:04:50 +08:00
parent d73cefc280
commit b3296842b7
No known key found for this signature in database
GPG Key ID: 1F4BDD59391F2680
8 changed files with 126 additions and 6 deletions

View File

@ -235,13 +235,9 @@
},
"readline": {
"type": "builtin",
"arg-type": "with",
"arg-type": "with-prefix",
"lib-depends": [
"readline"
],
"lib-suggests": [
"libedit",
"ncurses"
]
},
"redis": {

View File

@ -15,6 +15,21 @@
"brotli"
]
},
"ncurses": {
"source": "ncurses",
"static-libs-unix": [
"libncursesw.a"
]
},
"readline": {
"source": "readline",
"static-libs-unix": [
"libreadline.a"
],
"lib-depends": [
"ncurses"
]
},
"bzip2": {
"source": "bzip2",
"static-libs-unix": [

View File

@ -41,6 +41,24 @@
"path": "LICENSE"
}
},
"ncurses": {
"type": "filelist",
"url": "https://ftp.gnu.org/pub/gnu/ncurses/",
"regex": "/href=\"(?<file>ncurses-(?<version>[^\"]+)\\.tar\\.gz)\"/",
"license": {
"type": "file",
"path": "COPYING"
}
},
"readline": {
"type": "filelist",
"url": "https://ftp.gnu.org/pub/gnu/readline/",
"regex": "/href=\"(?<file>readline-(?<version>[^\"]+)\\.tar\\.gz)\"/",
"license": {
"type": "file",
"path": "COPYING"
}
},
"ext-zstd": {
"type": "git",
"path": "php-src/ext/zstd",

View File

@ -41,7 +41,7 @@
| phar | yes | yes | |
| posix | yes | yes | |
| protobuf | yes | yes | |
| readline | | | |
| readline | yes, untested | yes, untested | |
| redis | yes | yes | |
| session | yes | yes | |
| shmop | yes | yes | |

View File

@ -0,0 +1,15 @@
<?php
declare(strict_types=1);
namespace SPC\builder\macos\library;
/**
* gmp is a template library class for unix
*/
class ncurses extends MacOSLibraryBase
{
use \SPC\builder\unix\library\ncurses;
public const NAME = 'ncurses';
}

View File

@ -0,0 +1,15 @@
<?php
declare(strict_types=1);
namespace SPC\builder\macos\library;
/**
* gmp is a template library class for unix
*/
class readline extends MacOSLibraryBase
{
use \SPC\builder\unix\library\readline;
public const NAME = 'readline';
}

View File

@ -0,0 +1,36 @@
<?php
declare(strict_types=1);
namespace SPC\builder\unix\library;
trait ncurses
{
protected function build()
{
shell()->cd($this->source_dir)
->exec(
"{$this->builder->configure_env} ./configure " .
'--enable-static ' .
'--disable-shared ' .
'--enable-overwrite ' .
'--with-curses-h ' .
'--enable-pc-files ' .
'--enable-echo ' .
'--enable-widec ' .
'--with-normal ' .
'--with-ticlib ' .
'--without-tests ' .
'--without-dlsym ' .
'--without-debug ' .
'-enable-symlinks' .
'--bindir=' . BUILD_ROOT_PATH . '/bin ' .
'--includedir=' . BUILD_ROOT_PATH . '/include ' .
'--libdir=' . BUILD_ROOT_PATH . '/lib ' .
'--prefix=' . BUILD_ROOT_PATH
)
->exec('make clean')
->exec("make -j{$this->builder->concurrency}")
->exec('make install');
}
}

View File

@ -0,0 +1,25 @@
<?php
declare(strict_types=1);
namespace SPC\builder\unix\library;
trait readline
{
protected function build()
{
shell()->cd($this->source_dir)
->exec(
"{$this->builder->configure_env} ./configure " .
'--enable-static=yes ' .
'--enable-shared=no ' .
'--prefix= ' .
'--with-curses ' .
'--enable-multibyte=yes'
)
->exec('make clean')
->exec("make -j{$this->builder->concurrency}")
->exec('make install DESTDIR=' . BUILD_ROOT_PATH);
$this->patchPkgconfPrefix(['readline.pc']);
}
}