Add ncursesw

This commit is contained in:
crazywhalecc 2026-03-18 15:00:44 +08:00
parent c1f2fd49a6
commit c81146bf18
No known key found for this signature in database
GPG Key ID: 1F4BDD59391F2680
3 changed files with 49 additions and 30 deletions

View File

@ -0,0 +1,9 @@
ncurses:
binary: hosted
metadata:
license-files:
- COPYING
source:
type: filelist
url: 'https://ftp.gnu.org/pub/gnu/ncurses/'
regex: '/href="(?<file>ncurses-(?<version>[^"]+)\.tar\.gz)"/'

View File

@ -1,12 +1,10 @@
ncurses:
type: library
artifact:
source:
type: filelist
url: 'https://ftp.gnu.org/pub/gnu/ncurses/'
regex: '/href="(?<file>ncurses-(?<version>[^"]+)\.tar\.gz)"/'
binary: hosted
metadata:
license-files: [COPYING]
artifact: ncurses
static-libs@unix:
- libncurses.a
ncursesw:
type: library
artifact: ncurses
static-libs@unix:
- libncursesw.a

View File

@ -13,6 +13,7 @@ use StaticPHP\Util\DirDiff;
use StaticPHP\Util\FileSystem;
#[Library('ncurses')]
#[Library('ncursesw')]
class ncurses
{
#[BuildFor('Darwin')]
@ -21,37 +22,48 @@ class ncurses
{
$dirdiff = new DirDiff(BUILD_BIN_PATH);
UnixAutoconfExecutor::create($package)
$ac = UnixAutoconfExecutor::create($package)
->appendEnv([
'LDFLAGS' => $toolchain->isStatic() ? '-static' : '',
])
->configure(
'--enable-overwrite',
'--with-curses-h',
'--enable-pc-files',
'--enable-echo',
'--disable-widec',
'--with-normal',
'--with-ticlib',
'--without-tests',
'--without-dlsym',
'--without-debug',
'--enable-symlinks',
"--bindir={$package->getBinDir()}",
"--includedir={$package->getIncludeDir()}",
"--libdir={$package->getLibDir()}",
"--prefix={$package->getBuildRootPath()}",
)
]);
$wide = $package->getName() === 'ncurses' ? ['--disable-widec'] : [];
// Include standard system terminfo paths as fallback so binaries linking this ncurses
// (e.g. htop) can find terminfo on any target system without needing TERMINFO_DIRS set.
$terminfo_dirs = implode(':', [
"{$package->getBuildRootPath()}/share/terminfo",
'/etc/terminfo',
'/lib/terminfo',
'/usr/share/terminfo',
]);
$ac->configure(
'--enable-overwrite',
'--with-curses-h',
'--enable-pc-files',
'--enable-echo',
'--with-normal',
'--with-ticlib',
'--without-tests',
'--without-dlsym',
'--without-debug',
'--enable-symlinks',
"--with-terminfo-dirs={$terminfo_dirs}",
"--bindir={$package->getBinDir()}",
"--includedir={$package->getIncludeDir()}",
"--libdir={$package->getLibDir()}",
"--prefix={$package->getBuildRootPath()}",
...$wide,
)
->make();
$new_files = $dirdiff->getIncrementFiles(true);
foreach ($new_files as $file) {
@unlink(BUILD_BIN_PATH . '/' . $file);
}
shell()->cd(BUILD_ROOT_PATH)->exec('rm -rf share/terminfo');
shell()->cd(BUILD_ROOT_PATH)->exec('rm -rf lib/terminfo');
// shell()->cd(BUILD_ROOT_PATH)->exec('rm -rf share/terminfo');
// shell()->cd(BUILD_ROOT_PATH)->exec('rm -rf lib/terminfo');
$pkgconf_list = ['form.pc', 'menu.pc', 'ncurses++.pc', 'ncurses.pc', 'panel.pc', 'tic.pc'];
$suffix = $package->getName() === 'ncursesw' ? 'w' : '';
$pkgconf_list = ["form{$suffix}.pc", "menu{$suffix}.pc", "ncurses++{$suffix}.pc", "ncurses{$suffix}.pc", "panel{$suffix}.pc", "tic{$suffix}.pc"];
$package->patchPkgconfPrefix($pkgconf_list);
foreach ($pkgconf_list as $pkgconf) {