: Use /bin/sh
#
# $Id: Makekit,v 1.45 2001/07/25 21:51:46 geoff Exp $
#
# Copyright 1992, 1993, 2001, 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. Any web site or other electronic service that offers ispell for
#    download or other electronic transfer as a separate entity, in
#    either source or binary form, must also include a prominent statement
#    indicating that information about ispell can be obtained from the
#    following Web site URL:
#	http://fmg-www.cs.ucla.edu/geoff/ispell.html
#    If the offering service supports hyperlinks, the aforementioned
#    Web site must also be offered as a hyperlink.  Condition #4 does
#    not apply if ispell is offered only as part of a larger, aggregated
#    product such as a word processor or packaged operating system.
# 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.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='
Contributors
README
Magiclines
Makefile
Makekit
Makepatch
WISHES
buildhash.c
config.X
correct.c
defmt.c
dump.c
fields.3
fields.c
fields.h
findaffix.X
good.c
hash.c
icombine.c
ijoin.c
ispell.1X
ispell.4
ispell.c
ispell.h
iwhich
local.h.samp
lookup.c
makedict.sh
makedent.c
munchlist.X
parse.y
proto.h
subset.X
term.c
tgood.c
tree.c
tryaffix.X
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.4l
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/deformat-c.c
deformatters/deformat-sh.c
'

if $echolist
then
    echo $flist
    exit 0
fi

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

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

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
