前言
最近瀏覽一份老舊的源碼,發(fā)現(xiàn)文檔是用一種擴(kuò)展名sgml的文件編寫的,需要編譯之后瀏覽,通過調(diào)整Makefile最終可以實現(xiàn)單獨編譯文檔,但是發(fā)現(xiàn)報錯:
XXX - you do not have the sgml2html binary installed
通過檢查發(fā)現(xiàn),是由于系統(tǒng)中少了名叫sgml2html的可執(zhí)行文件,查閱資料知道:
它源于1969年IBM公司開發(fā)的文檔描述語言GML,GML主要用來解決不同系統(tǒng)中文檔格式不同的問題。后經(jīng)過多年發(fā)展,1986年經(jīng)ISO批準(zhǔn)為國際標(biāo)準(zhǔn)ISO8897,并被稱為SGML。
GML是SGML的前身,SGML是XML的前身,工具sgml2html是linuxdoc-tools的一部分,這些匯集起來就是:這種整理源碼文檔的技術(shù)方案是一套老舊的方案,使用的是過時的描述語言SGML,其工具在一套比較舊的工具集中。通過搜索,最終發(fā)現(xiàn)在gitlab上有一份源碼https://gitlab.com/agmartin/linuxdoc-tools
如果編譯麻煩,你也可以通過brew安裝我編譯的版本:
brew install coleflowers/brew/linuxdoc
如果brew安裝不了,你也可以關(guān)注我的公眾號愛寫代碼的小馬,回復(fù)linuxdoc來獲取安裝包。
a. 操作系統(tǒng)
macOS
b. 源碼
linuxdoc-tools
https://gitlab.com/agmartin/linuxdoc-tools
openjade-1.3.2
http://openjade.sourceforge.net/download.html#oj132
OpenSP-1.5.1
http://openjade.sourceforge.net/download.html#os15
編譯OpenSP-1.5.1
./configure
make
sudo make install
問題1
../include/RangeMap.cxx:50:11: error: use of undeclared identifier 'wideCharMax',搜索知道源碼中有定義const Char charMax = 0x10ffff;把報錯位置的wideCharMax的引用換成0x10ffff
問題2
../include/InternalInputSource.h:37:45: error: extra qualification on member 'asInternalInputSource'
把include/InternalInputSource.h中的
InternalInputSource *InternalInputSource::asInternalInputSource();
換成
InternalInputSource *asInternalInputSource();
編譯openjade-1.3.2
./configure
make
sudo make install
#如果你的OpenSP沒有安裝在默認(rèn)位置
#./configure --enable-spincludedir=OpenSP的header目錄 --enable-splibdir=OpenSP的lib目錄
問題1
Undefined subroutine &main::Getopts called at ./../msggen.pl line 22.通過查看上一行是do 'getopts.pl'; ,而整個代碼目錄找不到這個文件,最終了解到getopts.pl原來是perl的標(biāo)準(zhǔn)庫文件,后來版本升級就沒有了,通過參考:http://www.itdecent.cn/p/7fcb7a0e553a:
a. 在msggen.pl的頭部添加
use Getopt::Std;
b. Getopt改成getopts就順利編譯了。
編譯linuxdoc
./configure --prefix=/Users/`whoami`/gitlab/linuxdoc-tools/dist
make
問題1
No executable found in path for (pdflatex). Aborting ...
安裝brew install Caskroom/cask/mactex,設(shè)置環(huán)境變量PATH=/Library/TeX/texbin/:$PATH
問題2
make[1]: *** [guide.lyx] Error 25直接配置BUILDDOC_FORMATS忽略lyx格式。
最終成功在macOS上編譯出可執(zhí)行文件linuxdoc其中
- sgml2html
- sgml2info
- sgml2latex
- sgml2lyx
- sgml2rtf
- sgml2txt
- sgmlcheck
均為linuxdoc的軟鏈接。
參考鏈接
- MBA智庫百科-SGML(https://wiki.mbalib.com/wiki/SGML)