--- /dev/null
+#!/bin/sh
+
+set -u
+set -e
+trap onexit INT
+trap onexit TERM
+trap onexit EXIT
+
+TMPDIR=
+
+onexit()
+{
+ if [ ! "$TMPDIR" = "" ]; then
+ rm -rf $TMPDIR
+ fi
+}
+
+usage()
+{
+ echo "$0 <package name> <version> <source dir.>"
+ exit 1
+}
+
+if [ $# -lt 3 ]; then usage $0; fi
+PACKAGE_NAME=$1
+VERSION=$2
+SRCDIR=$3
+
+umask 022
+rm -f $PACKAGE_NAME-$VERSION-cygwin.tar.bz2
+TMPDIR=`mktemp -d /tmp/ljtbuild.XXXXXX`
+__PWD=`pwd`
+make install DESTDIR=$TMPDIR/pkg mandir=/opt/$PACKAGE_NAME/man
+rm $TMPDIR/pkg/opt/$PACKAGE_NAME/lib/*.la
+DOCDIR=$TMPDIR/pkg/usr/share/doc/$PACKAGE_NAME-$VERSION
+mkdir -p $DOCDIR
+install -m 644 $SRCDIR/README-turbo.txt $DOCDIR
+install -m 644 $SRCDIR/README $DOCDIR
+install -m 644 $SRCDIR/libjpeg.doc $DOCDIR
+install -m 644 $SRCDIR/usage.doc $DOCDIR
+install -m 644 $SRCDIR/LICENSE.txt $DOCDIR
+install -m 644 $SRCDIR/LGPL.txt $DOCDIR
+ln -fs lib $TMPDIR/pkg/opt/$PACKAGE_NAME/lib32
+cd $TMPDIR/pkg
+tar cfj ../$PACKAGE_NAME-$VERSION-cygwin.tar.bz2 *
+cd $__PWD
+mv $TMPDIR/*.tar.bz2 .
+
+exit 0