#!/bin/sh
#
# You certainly don't have to use the directories specified below
# for your installation, but you may find that this organization
# is convenient, or that a couple of simple editing steps performed
# on this file will make things easier.  The references are to the
# INSTALL file in this directory.
#
# we assume you are in a directory named "tib" or something like.
# If you change any of the following four lines, you will have to
# make corrections throughout this file.  "tib" doesn't have to
# be a part of /usr/local/lib/tex yet.  You can move it there with
# tar, later on.  You may want to put tib/src somewhere else entirely.
#
mkdir src
mkdir inputs
mkdir doc
mkdir index
#
# INSTALL, section 2.a
#
echo "Replacing AAAAA ..... FFFFF with paths and filenames"
sed -e 's|AAAAA|/usr/local/lib/tex/tib/doc|' \
	-e 's|BBBBB|/usr/local/lib/tex/tib/inputs|' \
	-e 's|CCCCC|/usr/local/lib/tex/tib/index/common|' \
         tibdoc.tex > doc/tibdoc.tex
mv tibdoc.tex \#tibdoc.tex\#
#
# INSTALL, section 2.b
#
sed -e 's|AAAAA|/usr/local/lib/tex/tib/doc|g' \
	-e 's|BBBBB|/usr/local/lib/tex/tib/inputs|' \
	-e 's|CCCCC|/usr/local/lib/tex/tib/index/common|' \
	-e 's|EEEEE|/usr/local/lib/tex/tib/src|' \
	-e 's|FFFFF|/usr/local/lib/tex/tib/index/INDEX|' tib.man > doc/tib.1
mv tib.man \#tib.man\#
#
# INSTALL, section 2.c
#
sed -e 's|AAAAA|/usr/local/lib/tex/tib/doc|g' intro.tib > doc/intro.tib
mv intro.tib \#intro.tib\#
#
# INSTALL, section 2.d
#
sed 	-e 's|BBBBB|/usr/local/lib/tex/tib/inputs|' \
	-e 's|CCCCC|/usr/local/lib/tex/tib/index/common|' \
	-e 's|FFFFF|/usr/local/lib/tex/tib/index/INDEX|' tib.h > src/tib.h
mv tib.h \#tib.h\#
#
# INSTALL, section 2.e and give makefile proper reference to manual page
#
sed -e 's|DDDDD|/usr/local/bin|' \
	-e 's|tib.man|../doc/tib.1|' Makefile > src/Makefile
mv Makefile \#Makefile\#
#
# INSTALL, section 6
#
echo "Filling the documentation directory"
mv *.tex ./doc
mv Styles ./doc
#
# INSTALL, section 7
#
echo "Filling the inputs directory"
mv *.tib ./inputs
mv *.ttx ./inputs
mv *.ttz ./inputs
#
# INSTALL, section 8
#
echo "Filling the index directory"
mv common ./index
#
# INSTALL, section 9
#
echo "Filling the program source directory"
mv *.c ./src
#
echo "Now cd to the program source directory"
echo "check INSTALL sections 3-4, and make all"
#
