#-----------------------------------------------------------------------------
#
#  dumb bash script for building lout328d.zip
#  Copyright (c) 2003 Kein-Hong Man <mkh.pl.jaring.my>
#  2003-05-20
#
#-----------------------------------------------------------------------------
#
#  This program is free software; you can redistribute it and/or modify
#  it under the terms of the GNU General Public License as published by
#  the Free Software Foundation; either Version 2, or (at your option)
#  any later version.
#
#  This program is distributed in the hope that it will be useful,
#  but WITHOUT ANY WARRANTY; without even the implied warranty of
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#  GNU General Public License for more details.
#
#  You should have received a copy of the GNU General Public License
#  along with this program; if not, write to the Free Software
#  Foundation, Inc., 59 Temple Place, Suite 330, Boston MA 02111-1307 USA
#
#-----------------------------------------------------------------------------
#  Assumes:
#  (1) DJGPP works correctly in a bash shell
#  (2) a free-standing lout328s directory structure
#  (3) lout328d built in the same directory as lout328s
#
# WARNING! Processing of the User's Guide is quite slow
#-----------------------------------------------------------------------------
# creates the appropriate directories
#-----------------------------------------------------------------------------

LOUTVER=lout-3.28
DNAME=lout328d
DESC="Basser Lout 3.28 for DJGPP V2"

DOCSLIDES=l-slides.ps
DOCDESIGN=l-design.ps
DOCEXPERT=l-expert.ps
DOCUSER=l-user.ps

#-----------------------------------------------------------------------------
# creates the appropriate directories
#-----------------------------------------------------------------------------

D=doc
M=manifest
BASEPATH=../../../../$DNAME
DPATH=$BASEPATH/$D
DOCPATH=$DPATH/$LOUTVER
MFTPATH=$BASEPATH/$M

mkdir -p $BASEPATH
mkdir -p $DPATH
mkdir -p $DOCPATH
mkdir -p $MFTPATH
echo $DNAME directories created...

#-----------------------------------------------------------------------------
# sets LOUTLIB and the path for proper execution
#-----------------------------------------------------------------------------

cd ..				# should be now at /contrib/$LOUTVER/
export LOUTLIB=$PWD		# help lout find library files
export PATH="$PWD;$PATH"	# make sure can run prg2lout for user guide
export LOUTEXE=lout

#-----------------------------------------------------------------------------
# this documents need a 2 runs to complete
#-----------------------------------------------------------------------------

cd doc/slides
$LOUTEXE all > ../$DOCPATH/$DOCSLIDES
$LOUTEXE all > ../$DOCPATH/$DOCSLIDES
dtou ../$DOCPATH/$DOCSLIDES
rm -f lout.li
rm -f *.ld
echo $DOCSLIDES completed...

#-----------------------------------------------------------------------------
# this documents need a 3 runs to complete
#-----------------------------------------------------------------------------

cd ../design
$LOUTEXE all > ../$DOCPATH/$DOCDESIGN
$LOUTEXE all > ../$DOCPATH/$DOCDESIGN
$LOUTEXE all > ../$DOCPATH/$DOCDESIGN
dtou ../$DOCPATH/$DOCDESIGN
rm -f lout.li
rm -f *.ld
echo $DOCDESIGN completed...

#-----------------------------------------------------------------------------
# this documents need a 4 runs to complete
#-----------------------------------------------------------------------------

cd ../expert
$LOUTEXE all > ../$DOCPATH/$DOCEXPERT
$LOUTEXE all > ../$DOCPATH/$DOCEXPERT
$LOUTEXE all > ../$DOCPATH/$DOCEXPERT
$LOUTEXE all > ../$DOCPATH/$DOCEXPERT
dtou ../$DOCPATH/$DOCEXPERT
rm -f lout.li
rm -f *.ld
echo $DOCEXPERT completed...

#-----------------------------------------------------------------------------
# this documents need a 6 runs to complete
#-----------------------------------------------------------------------------

cd ../user
$LOUTEXE all > ../$DOCPATH/$DOCUSER
$LOUTEXE all > ../$DOCPATH/$DOCUSER
$LOUTEXE all > ../$DOCPATH/$DOCUSER
$LOUTEXE all > ../$DOCPATH/$DOCUSER
$LOUTEXE all > ../$DOCPATH/$DOCUSER
$LOUTEXE all > ../$DOCPATH/$DOCUSER
dtou ../$DOCPATH/$DOCUSER
rm -f lout.li
rm -f *.ld
echo $DOCUSER completed...

#-----------------------------------------------------------------------------
# write the manifest files
#-----------------------------------------------------------------------------

cd ../../djgpp
cat > $MFTPATH/$DNAME.ver <<HERE
$DNAME  $DESC
HERE

cat > $MFTPATH/$DNAME.mft <<HERE
$D/$LOUTVER/$DOCSLIDES
$D/$LOUTVER/$DOCDESIGN
$D/$LOUTVER/$DOCEXPERT
$D/$LOUTVER/$DOCUSER
$M/$DNAME.ver
$M/$DNAME.mft
$M/$DNAME.dsm
HERE
echo manifest files created...

cat > $MFTPATH/$DNAME.dsm <<HERE
#
# DSM for Lout 3.28 documentation
#

dsm-file-version: 1.0
dsm-name: lout328d
dsm-version: 0.6.1

dsm-author: Kein-Hong Man
dsm-author-email: mkh@pl.jaring.my
dsm-author-web-site: http://www.geocities.com/keinhong/

name: lout
version: 3.28
type: documentation
manifest: lout328d
binaries-dsm: lout328b
sources-dsm: lout328s

license: GNU General Public License, Version 2
short-description: Basser Lout for DJGPP
long-description: Basser Lout typesetter for DJGPP with \
standard library files.

author: Jeffrey Kingston
author-email: jeff@it.usyd.edu.au

web-site: http://www.ptc.spbu.ru/~uwe/lout/lout.html
ftp-site: ftp://ftp.cs.usyd.edu.au/jeff/lout/

mailing-list: lout@ptc.spbu.ru
mailing-list-description: subscribers-only official Lout mailing list
mailing-list-request: lout-request@ptc.spbu.ru
mailing-list-web-site: http://www.ptc.spbu.ru/~uwe/lout/list.html

porter: Kein-Hong Man
porter-email: mkh@pl.jaring.my
porter-web-site: http://www.geocities.com/keinhong/

simtelnet-path: v2apps/
zip: lout328d.zip

requires: DPMI >= 0.9
replaces: lout < 3.28

HERE

#-----------------------------------------------------------------------------

echo $DNAME completed.
