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;
|
|
|
|
|
|
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);
|
2023-04-30 15:04:50 +08:00
|
|
|
shell()->cd($this->source_dir)
|
2025-03-10 00:39:20 +08:00
|
|
|
->setEnv(['CFLAGS' => $this->getLibExtraCFlags(), 'LDFLAGS' => $this->getLibExtraLdFlags(), 'LIBS' => $this->getLibExtraLibs()])
|
|
|
|
|
->execWithEnv(
|
2023-10-23 00:37:28 +08:00
|
|
|
'./configure ' .
|
2023-04-30 15:04:50 +08:00
|
|
|
'--enable-static ' .
|
|
|
|
|
'--disable-shared ' .
|
|
|
|
|
'--enable-overwrite ' .
|
|
|
|
|
'--with-curses-h ' .
|
|
|
|
|
'--enable-pc-files ' .
|
|
|
|
|
'--enable-echo ' .
|
2024-05-06 14:11:50 +08:00
|
|
|
'--disable-widec ' .
|
2023-04-30 15:04:50 +08:00
|
|
|
'--with-normal ' .
|
|
|
|
|
'--with-ticlib ' .
|
|
|
|
|
'--without-tests ' .
|
|
|
|
|
'--without-dlsym ' .
|
|
|
|
|
'--without-debug ' .
|
2024-03-10 11:48:52 +08:00
|
|
|
'-enable-symlinks ' .
|
2023-04-30 15:04:50 +08:00
|
|
|
'--bindir=' . BUILD_ROOT_PATH . '/bin ' .
|
|
|
|
|
'--includedir=' . BUILD_ROOT_PATH . '/include ' .
|
|
|
|
|
'--libdir=' . BUILD_ROOT_PATH . '/lib ' .
|
|
|
|
|
'--prefix=' . BUILD_ROOT_PATH
|
|
|
|
|
)
|
2025-03-10 00:39:20 +08:00
|
|
|
->execWithEnv('make clean')
|
|
|
|
|
->execWithEnv("make -j{$this->builder->concurrency}")
|
|
|
|
|
->execWithEnv('make install');
|
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
|
|
|
}
|
|
|
|
|
}
|