前言
最近浏览一份老旧的源码,发现文档是用一种扩展名sgml的文件编写的,需要编译之后浏览,通过调整Makefile最终可以实现单独编译文档,但是发现报错:
XXX - you do not have the sgml2html binary installed
通过检查发现,是由于系统中少了名叫sgml2html的可执行文件,查阅资料知道:
它源于1969年IBM公司开发的文档描述语言GML,GML主要用来解决不同系统中文档格式不同的问题。后经过多年发展,1986年经ISO批准为国际标准ISO8897,并被称为SGML。
GML是SGML的前身,SGML是XML的前身,工具sgml2html是linuxdoc-tools的一部分,这些汇集起来就是:这种整理源码文档的技术方案是一套老旧的方案,使用的是过时的描述语言SGML,其工具在一套比较旧的工具集中。通过搜索,最终发现在gitlab上有一份源码https://gitlab.com/agmartin/linuxdoc-tools
如果编译麻烦,你也可以通过brew安装我编译的版本:
brew install coleflowers/brew/linuxdoc
如果brew安装不了,你也可以关注我的公众号爱写代码的小马,回复linuxdoc来获取安装包。
a. 操作系统
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没有安装在默认位置
#./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的标准库文件,后来版本升级就没有了,通过参考:https://www.jianshu.com/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,设置环境变量PATH=/Library/TeX/texbin/:$PATH
问题2
make[1]: *** [guide.lyx] Error 25直接配置BUILDDOC_FORMATS忽略lyx格式。
最终成功在macOS上编译出可执行文件linuxdoc其中
- sgml2html
- sgml2info
- sgml2latex
- sgml2lyx
- sgml2rtf
- sgml2txt
- sgmlcheck
均为linuxdoc的软链接。
参考链接
- MBA智库百科-SGML(https://wiki.mbalib.com/wiki/SGML)