3.2. 安装 XFree86

软件包的安装需要 root 用户登录,这可以通过 superuser/setuser 命令轻松获得:su - (参见 man su)。

以下仅以最基本的术语解释从源代码安装 XFree86 的过程。请务必阅读所有 XFree86 文档,以了解特殊选项。

如果您已经安装了 XFree86 的版本,您可能想要移动或删除它。但是,通常覆盖安装现有的 X 是可以的,并且会保留您可能已安装到 X 目录中的任何程序或库(尽管您真的不应该那样做)
	cd /usr
	mv X11R6 X11R6-old
	cd /etc
	mv X11 X11-old

	# you may have an X directory in /var also
	cd /var
	mv X11R6 X11R6-old
	

如果这些位置对于您的 Linux 发行版不正确,您将需要稍微浏览一下您的文件系统 - 尝试在以下位置查找/var

	cd /usr/src
	mkdir release
	cd release
	tar -xvzf X420src-1.tgz
	tar -xvzf X420src-2.tgz
	tar -xvzf X420src-3.tgz
	tar -xvzf doctools-1.3.tar.gz

	

如果您由于某种原因正在使用旧版本的 XFree86,您可能想要使用 man page 软件包。XFree 4.2.0 及更高版本已经包含了所有这些 man page。如果您不需要 man page 软件包,请跳过使用它们。查看 /usr/src/release/xc/doc/man 以了解您的 XFree86 包含的所有内容。
	# unpack the man pages if they are missing.
	cd /usr/src
	tar -xvzf mangl.tar.Z
	tar -xvzf manglu.tar.Z
	

必须编辑一个文件,以允许这些 man page 与发行版的其余部分一起编译/安装
	cd /usr/src/release/xc/doc/man/GL
	# Edit the file: Imakefile
	#	SUBDIRS = glx gl glu
	

当您解压缩了man*.tar.Z上面的文件后,添加了两个新目录gl glu

	cd /usr/src/release
	cd doctools

	# Having this variable set confuses the sgml docs build.
	# With it unset, the build uses the proper defaults.
	unset $SGML_CATALOG_FILES

	make
	make install

	# Note: doctools installs the perl program sgmlfmt to
	# /usr/local/bin.  It looks for the perl executable
	# at /usr/local/bin/perl.  If perl is installed
	# on your system at /usr/bin/perl, then it will not
	# find perl and the sgml docs build will fail!
	# Make a symlink if needed (or edit the script):
	cd /usr/local/bin
	ln -s /usr/bin/perl perl

	cd /usr/src/release
	cd xc/config/cf
	vi host.def
	# add the following three lines to host.def:
	#	#define HasSgmlFmt YES
	#	#define BuildAllDocs YES
	#	#define HasZlib YES
	# See the README file in doctools and xc/config/cf.
	# HasZlib YES instructs XFree86 not to build and install
	# it's own old zlib.  If you do not have zlib installed
	# (check /usr/lib/libz*), then omit the HasZlib line or
	# go download it and install it first:
	#       http://www.info-zip.org/pub/infozip/zlib/
	# A common zlib conflict occurs when a system already
	# has zlib installed and XFree86 installs it's also.
	# In this case, deleting /usr/X11R6/lib/libz.a fixes
	# the problem.

	cd /usr/src/release/xc
	make World
	# before installing, make sure you have moved
	# or deleted prior installation of X
	# unless you are sure you want to just overwrite
	make install
	make install.man

        # make symlinks
        cd /usr/include
        ln -s ../X11R6/include/DPS DPS
        ln -s ../X11R6/include/GL GL
        ln -s ../X11R6/include/X11 X11
        ln -s ../X11R6/include/bitmaps bitmaps
        cd ..
        ln -s X11R6 X11
	

添加/usr/X11R6/lib到您的/etc/ld.so.conf文件,然后运行命令 ldconfig 以更新/etc/ld.so.cache以便库可见。

GL/GLX/GLU HTML 文档位于/usr/src/release/xc/doc/hardcopy/GL。 可以按如下方式复制此目录
                cd /usr/src/release/xc/doc/hardcopy
                cp -r GL /usr/X11R6/lib/X11/doc/html
        
文档中的index.html文件可能指向manindex5x.html,但文件名实际上可能是manindex5.html。 如果需要,只需创建一个符号链接来修复它
		cd /usr/X11R6/lib/X11/doc/html
		ln -s manindex5.html manindex5x.html
        

X 启动并运行(稍后)后,尝试使用 xman 程序来查看 gl,glx,glu 和 glut 的 man page 是否在第 3 节中。如果您有 KDE2khelpcenter 允许浏览 man page。