: Use /bin/sh
#
# $Id: Makekit,v 1.52 2005/05/25 16:17:57 geoff Exp $
#
# Copyright 1992, 1993, 2001, 2005, Geoff Kuenning, Claremont, CA
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributions of source code must retain the above copyright
#    notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
#    notice, this list of conditions and the following disclaimer in the
#    documentation and/or other materials provided with the distribution.
# 3. All modifications to the source code must be clearly marked as
#    such.  Binary redistributions based on modified source code
#    must be clearly marked as modified versions in the documentation
#    and/or other materials provided with the distribution.
# 4. The code that causes the 'ispell -v' command to display a prominent
#    link to the official ispell Web site may not be removed.
# 5. The name of Geoff Kuenning may not be used to endorse or promote
#    products derived from this software without specific prior
#    written permission.
#
# THIS SOFTWARE IS PROVIDED BY GEOFF KUENNING AND CONTRIBUTORS ``AS IS'' AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED.  IN NO EVENT SHALL GEOFF KUENNING OR CONTRIBUTORS BE LIABLE
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
#
#	Make an ispell distribution kit.  This is not a clever script,
#	just a handy one.
#
#	Usage:
#
USAGE="Usage:  Makekit [-d destdir] [-e]"
#
#	destdir is the directory in which the kits will be made;  you will
#	want to pick someplace that has lots of space.
#
#	If -e is specified, the list of files in the kit is echoed to
#	stdout and no kit is made.
#
# $Log: Makekit,v $
# Revision 1.52  2005/05/25 16:17:57  geoff
# Add local.h.cygwin to the kit.
#
# Revision 1.51  2005/04/27 01:18:34  geoff
# Add the CHANGES file.
#
# Revision 1.50  2005/04/27 00:17:35  geoff
# Add a sample local.h for BSD systems.
#
# Revision 1.49  2005/04/26 22:41:07  geoff
# Remove fixispell-a, since it really doesn't do the job
#
# Revision 1.48  2005/04/14 14:38:23  geoff
# Update license.  Add several new files, notably Eli Zaretskii's
# changes to support DOS/Windows systems.
#
# Revision 1.47  2002/06/21 00:19:30  geoff
# Fix the names of the deformatters.  Generate RCS version tags when
# building a kit.
#
# Revision 1.46  2002/06/20 23:46:15  geoff
# Put sq/unsq back, since some dictionaries are still distributed in sq
# format.
#
# Revision 1.45  2001/07/25 21:51:46  geoff
# Minor license update.
#
# Revision 1.44  2001/07/23 20:24:02  geoff
# Update the copyright and the license.
#
# Revision 1.43  2001/06/07 08:02:18  geoff
# Change the kit to use my deformatters.
#
# Revision 1.42  2001/06/06 23:08:23  geoff
# Add some sample deformatters.
#
# Revision 1.41  1999/01/18 03:40:32  geoff
# Build tar file from a version-numbered directory
#
# Revision 1.40  1999/01/07  01:23:03  geoff
# Update the copyright.  Make the kit into a gzipped tar file rather
# than shars.  Get rid of the -c switch.  Remove the following files
# from the kit: ishar, ispell.el, ispell.texinfo, makeshar, splitdict,
# sq.1, sq.c, unsq.c, and all foreign-language affix files.
#
# Revision 1.39  1995/10/11  04:58:07  geoff
# Add the Portuguese language files
#
# Revision 1.38  1995/01/15  00:54:45  geoff
# Add iwhich and the new Spanish support
#
# Revision 1.37  1994/05/18  02:56:25  geoff
# Remember to list dictionaries with the -e switch
#
# Revision 1.36  1994/04/27  02:58:42  geoff
# Add the new English-dialect Makefiles
#
# Revision 1.35  1994/02/07  08:39:49  geoff
# Don't delete everything when we're only echoing names
#
# Revision 1.34  1994/01/25  08:51:16  geoff
# Get rid of all old RCS log lines in preparation for the 3.1 release.
#
#
maxsize=60000		# This leaves room for some headers
destdir=kits
echolist=false
PATH=`pwd`:$PATH; export PATH

while [ $# -gt 0 ]
do
    case "$1" in
	-d)
	    destdir="$2"
	    shift; shift
	    ;;
	-e)
	    echolist=true
	    shift
	    ;;
	*)
	    echo "$USAGE" 1>&2
	    exit 1
	    ;;
    esac
done

case "$destdir" in
    /*)
	;;
    *)
	destdir=`pwd`/$destdir
	;;
esac

flist='
CHANGES
Contributors
README
Magiclines
Makefile
Makekit
Makepatch
WISHES
buildhash.c
config.X
correct.c
defmt.c
dump.c
exp_table.c
exp_table.h
fields.3
fields.c
fields.h
findaffix.X
good.c
hash.c
icombine.c
ijoin.c
ispell.1X
ispell.5X
ispell.c
ispell.h
iwhich
local.h.bsd
local.h.cygwin
local.h.generic
local.h.linux
local.h.macos
local.h.solaris
lookup.c
makedict.sh
makedent.c
munchlist.X
parse.y
proto.h
sq.1
sq.c
subset.X
term.c
tgood.c
tree.c
tryaffix.X
unsq.c
version.h
xgets.c
zapdups.X
languages/Makefile
languages/Where
languages/fix8bit.c
languages/altamer/Makefile
languages/american/Makefile
languages/british/Makefile
languages/dansk/Makefile
languages/deutsch/Makefile
languages/english/Makefile
languages/english/altamer.0
languages/english/altamer.1
languages/english/altamer.2
languages/english/american.0
languages/english/american.1
languages/english/american.2
languages/english/british.0
languages/english/british.1
languages/english/british.2
languages/english/english.0
languages/english/english.1
languages/english/english.2
languages/english/english.3
languages/english/english.5X
languages/english/english.aff
languages/english/msgs.h
languages/espanol/Makefile
languages/francais/Makefile
languages/nederlands/Makefile
languages/norsk/Makefile
languages/portugues/Makefile
languages/svenska/Makefile
addons/nextispell/Makefile
addons/nextispell/README
addons/nextispell/configure
addons/nextispell/configure.h.template
addons/nextispell/configureTeX
addons/nextispell/nextispell.m
addons/nextispell/services.template
addons/xspell.shar
deformatters/Makefile
deformatters/README
deformatters/defmt-c.c
deformatters/defmt-sh.c
pc/README
pc/cfglang.sed
pc/cfgmain.sed
pc/configdj.bat
pc/djterm.c
pc/local.djgpp
pc/local.emx
pc/make-dj.bat
pc/makeemx.bat
'

if $echolist
then
    echo $flist
    exit 0
fi

[ -d "$destdir" ]  ||  mkdir "$destdir"
version=`egrep 'International Ispell' version.h | awk '{print $5;exit}'`
rcsversion=`echo $version | tr . _`

TMP=$destdir/ispell-$version
rm -rf $TMP
trap "rm -rf $TMP; exit 1" 1 2 15
trap "rm -rf $TMP; exit 0" 13

rcs -NV${rcsversion}: $flist

mkdir $TMP
tar cf - $flist | (cd $TMP; tar xf -)

tarfile=$destdir/ispell-$version.tar.gz

rm -f $tarfile
(cd $destdir; tar cvf - ispell-$version) | gzip -v -9 > $tarfile
rm -rf $TMP
