centos7 编译安装zsh ncurses

zsh 依赖ncurses

需要先去下载编译ncurses

这个编译时需要加一些开关来生成so啥的

../configure --prefix=/home/amazing/software/ncurses-6.5/install --enable-shared --enable-widec --with-shared --without-debug --enable-pc-files --with-pkg-config-libdir=/home/amazing/software/ncurses-6.5/install/lib/pkgconfig

编译好后在configure zsh前要设对应的编译flag

export CPPFLAGS="-I/home/amazing/software/ncurses-6.5/install/include"
export LDFLAGS="-L/home/amazing/software/ncurses-6.5/install/lib"
export PKG_CONFIG_PATH="/home/amazing/software/ncurses-6.5/install/lib/pkgconfig:$PKG_CONFIG_PATH"
export LD_LIBRARY_PATH="/home/amazing/software/ncurses-6.5/install/lib:$LD_LIBRARY_PATH"

这样才能configure成功,

编译前需要改zsh的代码 termcap.c terminfo.c

里面有几处字符串声明的和ncurse中的不一致,需要和其保持一致

在你编译好的ncurses中有一个term.h 其中这些字符串的声明都是

const char* const
#else

extern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) boolnames[];
extern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) boolcodes[];
extern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) boolfnames[];
extern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) numnames[];
extern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) numcodes[];
extern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) numfnames[];
extern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) strnames[];
extern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) strcodes[];
extern NCURSES_EXPORT_VAR(NCURSES_CONST char * const ) strfnames[];

#endif

去zsh的termcap.c terminfo.c把涉及到的几个给改成和term.h的一致即可

const char* const

接下来编译安装即可

文章目录