#!/bin/sh

#
# pack/compress a jar archive with pack200 and gzip
#

# get option
if [ "$1" = "--strip-debug" ]; then
   STRIP_DEBUG="$1"
   shift
fi

# usage message
if [ "$#" -ne 1 ]; then
   echo "usage: `basename \"$0\"` [--strip-debug] <jarfile>"
   exit 1
fi

# normalize and optionally strip debug symbols from archive
pack200 --repack $STRIP_DEBUG "$1"

# sign archive
#jarsigner -storepass mysecret -keypass mysecret "$1" mykey

# pack it
gzip -9 -c "$1" > "$1.gz"
pack200 --effort=9 "$1.pack.gz" "$1"


