#!/bin/csh

# Copyright (C) 2004 Andrew Oliver

# This script takes a Java Runtime Environment for the ARM
# architecture (Compaq iPaq handhelds, for example) and pares it down
# to fit in the limited resources of an iPaq (64 MB RAM, 32 MB Flash).

# Usage instructions:
# 1. Unpack the JRE
# 2. Change into the JRE directory
# 3. Run this script
# 4. Download the contents of the "newjre" directory to your iPaq

set DEST=../newjre

mkdir $DEST

cp -r bin $DEST
cp -r lib $DEST

# Remove unnecessary stuff from bin
cd $DEST/bin
rm tnameserv
rm policyserv
rm keyserv
rm rmid
rm rmiregistry
rm -rf armv4l/green_threads
rm armv4l/native_threads/tnameserv
rm armv4l/native_threads/policyserv
rm armv4l/native_threads/keyserv
rm armv4l/native_threads/rmid
rm armv4l/native_threads/rmiregistry

# Remove unnecessary stuff from lib
cd ../lib
rm i18n.jar
rm -rf applet
rm font.properties.ja
rm font.properties.zh
rm sunrsasign.jar
rm -rf armv4l/green_threads
rm -rf audio
rm cmm/PYCC.pf

# Create JAR file with key classes from the JRE
mkdir tmp
cd tmp
jar xf ../rt.jar
rm ../rt.jar
jar cfm ../rt.jar META-INF/MANIFEST.MF java/lang java/io java/security java/net java/util java/text java/sql java/math java/beans java/awt sun/dc sun/beans sun/tools sun/io sun/jdbc sun/misc sun/net sun/security sun/awt sun/java2d com/sun/image com/sun/naming com/sun/org com/sun/media com/sun/jndi com/sun/java javax/accessibility javax/transaction javax/naming sunw
# javax/swing

# Remove temporary directory
cd ..
rm -rf tmp
