corda/sgx-jvm/jvm-enclave/enclave/create-boot-jar.sh
2017-03-24 18:23:04 +00:00

46 lines
1.3 KiB
Bash
Executable File

#!/bin/bash
# Args:
# 1) path to avian
# 2) path to the app jar (corda-enclave.jar)
# 3) path to the output dir
# 4) path to proguard jar
# 5) path to proguard conf
# 6) path to openjdk install
if [ ! -d "$1" ]; then echo "$1 is not a directory"; exit 1; fi
if [ ! -e "$2" ]; then echo "$2 does not exist"; exit 1; fi
if [ ! -e "$4" ]; then echo "$4 is not a ProGuard jar"; exit 1; fi
set -ex
avianpath=$( readlink -f $1 )
bootjar="$avianpath/classpath.jar"
if [ ! -e "$bootjar" ]; then echo "$avianpath does not appear to be an Avian build directory"; exit 1; fi
appjar=$( readlink -f $2 )
outputjardir=$( readlink -f $3 )
proguard_jar=$( readlink -f $4 )
proguard_conf=$( readlink -f $5 )
openjdk_libs=$6/jre/lib
mkdir -p $outputjardir
if [ ! -e $openjdk_libs/jsse.jar ]; then
echo "$6 does not appear to be an OpenJDK directory."
exit 1
fi
cmd="java -jar $proguard_jar @$avianpath/../../vm.pro @$avianpath/../../openjdk.pro @$proguard_conf -injars $bootjar -injars $appjar -injars $openjdk_libs/jsse.jar -injars $openjdk_libs/jce.jar -injars $openjdk_libs/ext/sunjce_provider.jar -outjars $outputjardir"
# echo $cmd
$cmd
mkdir -p $outputjardir/temp
cd $outputjardir/temp
jar xf ../jce.jar
jar xf ../jsse.jar
jar xf ../sunjce_provider.jar
jar xf $openjdk_libs/charsets.jar
jar xf $2
jar cf ../app.jar *
cd ..
rm -r temp