一、從官網(http://pkgs.fedoraproject.org/repo/pkgs/man-pages-zh-CN)下載安裝包;或者從開源代碼(https://github.com/man-pages-zh/manpages-zh)網址下載
二、解壓安裝包,發現configure.ac,需要安裝autoconf和autoconf;
三、安裝autoconf和automake
1、安裝brew:如果已經安裝brew,跳過此步驟。
從brew官網(https://brew.sh)復制安裝命令,粘貼在終端中執行:
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
2、安裝autoconf、automake、python3、opencc四個依賴
brew install autoconf
brew install automake
brew install python3
brew install opencc
四、(1)生成manpages-zh安裝程序,並安裝
autoscan . //在當前文件夾中搜索
vi configure.ac //編輯文件
- 編輯configure.ac,加入下面一行:
- AM_INIT_AUTOMAKE(hello,1.0) //automake所必備的宏,必須添加
aclocal //執行aclocal生成aclocal.m4文件
autoconf //執行autoconf生成configure文件
autoheader
automake --add-missing
touch NEWS; touch README; touch AUTHORS; touch ChangeLog //創建NEWS等文件,如果沒有自動生成,手工創建
automake --add-missing //再運行一次
./configure //配置,生成Makefile文件
make //執行make命令
sudo make install
./configure --prefix=/usr/local/zhman --disable-zhtw //最后執行./configure加上一些參數,確保設置簡體中文成功
四、(2)
官網(https://github.com/man-pages-zh/manpages-zh)安裝方法(我未試過)
一、構建依賴包括:
autotools (autoconf, automake)
python3
opencc 1.x
二、“編譯”安裝
autoreconf --install --force ./configure make sudo make install # 需要超級用戶權限
五、修改/etc/man.conf,將幾處/usr/local/share/man全部改為/usr/local/share/man/zh_CN
六、解決亂碼
brew install groff
打開/etc/man.conf,在文件最后加上如下代碼:
NROFF preconv -e UTF8 | /usr/local/bin/nroff -Tutf8 -mandoc -c