2023-04-30 15:04:50 +08:00
|
|
|
<?php
|
|
|
|
|
|
|
|
|
|
declare(strict_types=1);
|
|
|
|
|
|
|
|
|
|
namespace SPC\builder\unix\library;
|
|
|
|
|
|
2024-07-09 15:05:53 +08:00
|
|
|
use SPC\store\FileSystem;
|
2025-06-09 19:32:31 +08:00
|
|
|
use SPC\util\executor\UnixAutoconfExecutor;
|
2024-07-09 15:05:53 +08:00
|
|
|
|
2023-04-30 15:04:50 +08:00
|
|
|
trait ncurses
|
|
|
|
|
{
|
2023-08-20 19:51:45 +08:00
|
|
|
protected function build(): void
|
2023-04-30 15:04:50 +08:00
|
|
|
{
|
2024-07-09 15:05:53 +08:00
|
|
|
$filelist = FileSystem::scanDirFiles(BUILD_BIN_PATH, relative: true);
|
|
|
|
|
|
2025-06-09 19:32:31 +08:00
|
|
|
UnixAutoconfExecutor::create($this)
|
2025-06-27 18:21:22 +07:00
|
|
|
->appendEnv([
|
2025-06-27 19:27:02 +07:00
|
|
|
'LDFLAGS' => getenv('SPC_LIBC') === 'musl' ? '-static' : '',
|
2025-06-27 18:21:22 +07:00
|
|
|
])
|
2025-06-09 19:32:31 +08:00
|
|
|
->configure(
|
|
|
|
|
'--enable-overwrite',
|
|
|
|
|
'--with-curses-h',
|
2025-06-09 22:54:44 +08:00
|
|
|
'--enable-pc-files',
|
2025-06-09 19:32:31 +08:00
|
|
|
'--enable-echo',
|
|
|
|
|
'--disable-widec',
|
|
|
|
|
'--with-normal',
|
|
|
|
|
'--with-ticlib',
|
|
|
|
|
'--without-tests',
|
|
|
|
|
'--without-dlsym',
|
|
|
|
|
'--without-debug',
|
|
|
|
|
'-enable-symlinks',
|
|
|
|
|
"--bindir={$this->getBinDir()}",
|
|
|
|
|
"--includedir={$this->getIncludeDir()}",
|
|
|
|
|
"--libdir={$this->getLibDir()}",
|
|
|
|
|
"--prefix={$this->getBuildRootPath()}",
|
|
|
|
|
)
|
|
|
|
|
->make();
|
2024-07-09 15:05:53 +08:00
|
|
|
$final = FileSystem::scanDirFiles(BUILD_BIN_PATH, relative: true);
|
|
|
|
|
// Remove the new files
|
|
|
|
|
$new_files = array_diff($final, $filelist);
|
|
|
|
|
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');
|
|
|
|
|
|
|
|
|
|
$pkgconf_list = ['form.pc', 'menu.pc', 'ncurses++.pc', 'ncurses.pc', 'panel.pc', 'tic.pc'];
|
|
|
|
|
$this->patchPkgconfPrefix($pkgconf_list);
|
|
|
|
|
|
|
|
|
|
foreach ($pkgconf_list as $pkgconf) {
|
|
|
|
|
FileSystem::replaceFileStr(BUILD_LIB_PATH . '/pkgconfig/' . $pkgconf, '-L' . BUILD_LIB_PATH, '-L${libdir}');
|
|
|
|
|
}
|
2023-04-30 15:04:50 +08:00
|
|
|
}
|
|
|
|
|
}
|