# This file contains the commands I type to compile and install Siag.
# If fed to sh, this script *may* do everything automagically.
# It may also fail to do so.

# Although I develop Siag under Linux, it should be pretty
# straightforward to port it to other Unices. I have successfully
# built Siag under Solaris with no modifications of the source.

# A text version of Siag is available in the tsiag directory. It is
# not built by default. Uncomment the relevant lines in this file to build.

# A Gtk version is in the gsiag directory.

# This is to set SIAGHOME, SIAGHELP and choose libraries
vi topdir.mk

# This compiles and installs Xaw3d, the 3D Athena replacement widget set
if [ -d xc ]; then
	(cd xc/lib/Xaw3d
	xmkmf
	make Makefiles
	make depend
	make
	su root -c "make install")
fi

# This compiles and installs OffiX-style drag and drop
(cd DND/DNDlib
./configure
make
su root -c "make install")

# This compiles Guile
if [ -d guile-1.2 ]; then
	(cd guile-1.2
	./configure
	make
	su root -c "make install")
fi

# This compiles Siod
(cd siod
xmkmf
make Makefiles
make depend
make)

# This compiles common parts of Siag, PW and Egon
(cd common
xmkmf
make Makefiles
make depend
make)
(cd xcommon
xmkmf
make Makefiles
make depend
make)

# This compiles and installs Siag
(cd siag
xmkmf
make Makefiles
make depend
make)
(cd xsiag
xmkmf
make Makefiles
make depend
make
su root -c "make install")
#(cd tsiag
#xmkmf
#make Makefiles
#make depend
#make
#su root -c "make install")
#(cd gsiag
#xmkmf
#make Makefiles
#make depend
#make
#su root -c "make install")

# After this point, everything is optional.

# This compiles and installs Pathetic Writer
if [ -d pw ]; then
	(cd pw
	xmkmf
	make Makefiles
	make depend
	make
	su root -c "make install")
fi

# This compiles and installs Egon Animator
if [ -d egon ]; then
	(cd egon
	xmkmf
	make Makefiles
	make depend
	make
	su root -c "make install")
fi

# This compiles and installs netpbm
if [ -s netpbm ]; then
	(cd netpbm
	xmkmf
	make Makefiles
	make depend
	make
	su root -c "make install")
fi

# This compiles and installs Convert and View
if [ -d cv ]; then
	(cd cv
	xmkmf
	make Makefiles
	make depend
	make
	su root -c "make install")
fi

# This compiles and installs Chimera
if [ -d chimera-1.70 ]; then
	(cd chimera-1.70
	cp Common.tmpl.dist Common.tmpl
	cp options.h.dist options.h
	xmkmf
	make Makefiles
	make depend
	make
	su root -c "make install")
fi

# This compiles and installs Ghostview
if [ -d ghostview-1.5 ]; then
	(cd ghostview-1.5
	xmkmf
	make Makefiles
	make depend
	make
	su root -c "make install")
fi

# This compiles and installs Gnuplot
if [ -d gnuplot ]; then
	(cd gnuplot
	make All
	su root -c "make x11 TARGET=Install")
fi

