3.6. 安装 GLUT 3.7 发行版 (可选)

如果您安装了 MesaDemos/MesaLib 包,那么您已经安装了 GLUT 3.7,因为它包含在 MesaDemos 中。 但是,您可能对安装 GLUT 手册页感兴趣,您可以直接跳到下面的“安装 GLUT 手册页”...

安装 GLUT 有点棘手。 我不太熟悉 imake,它用于管理 Makefile 的程序,并且不太清楚如何让 GLUT 安装到我想要的位置(/usr/lib,但 MesaDemos 可以毫无问题地做到这一点)。无论如何,它可以手动完成

	cd /usr/src
	tar -xvzf glut-3.7.tar.gz
	cd glut-3.7

	Read the file: README.linux
	cd linux
	READ the file: README
	cp Glut.cf ..
	cd ..
	Edit Glut.cf: remove any Mesa references.
	Replace any -lMesaGL -lMesaGLU with -lGL -lGLU if needed.
	In particular, replace:
		OPENGL = $(TOP)/../lib/libMesaGL.so
		GLU = $(TOP)/../lib/libMesaGLU.so
	with:
		OPENGL = -lGL
		GLU = -lGLU

	./mkmkfiles.imake
	cd lib/glut
	cp /usr/src/glut-3.7/linux/Makefile .
	Edit the Makefile: remove any Mesa references.
	Replace any -lMesaGL -lMesaGLU with -lGL -lGLU if needed.
	In particular, replace:
		OPENGL = $(TOP)/../lib/libMesaGL.so
		GLU = $(TOP)/../lib/libMesaGLU.so
	with:
		OPENGL = -lGL
		GLU = -lGLU

	make
	ln -s libglut.so.3.7 libglut.so
	ln -s libglut.so.3.7 libglut.so.3
	cp -d libglut.* /usr/lib
	cd ..
	cd gle
	# make a shared lib for libgle
	make
	gcc -shared -o libgle.so.3.7 *.o
	ln -s libgle.so.3.7 libgle.so
	ln -s libgle.so.3.7 libgle.so.3
	cp -d libgle.* /usr/lib
	cd ..
	cd mui
	# make a shared lib for libmui
	make
	gcc -shared -o libmui.so.3.7 *.o
	ln -s libmui.so.3.7 libmui.so
	ln -s libmui.so.3.7 libmui.so.3
	cp -d libmui.* /usr/lib

        # Install the GLUT manual pages (not included with MesaDemos)
	cd /usr/src/glut-3.7
	make SUBDIRS=man Makefile
	cd man/glut
	make install.man
	ldconfig

	cd ../../progs/demos/ideas
	# edit the Makefile, change OPENGL = -lGL and GLU = -lGLU
	make
	./ideas
	# test compiling some demos
	# take a look at which libraries have to be linked (-lX11 ...) in
	# the Makefiles.  Qt's tmake program available at www.troll.no
	# is a quick way to make a Makefile but you have to edit it
	# and add the -l needed.