forked from bcgit/bc-java
-
Notifications
You must be signed in to change notification settings - Fork 0
/
add_module.sh
65 lines (56 loc) · 2.1 KB
/
add_module.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
export JAVA_HOME=/usr/lib/jvm/java-9-oracle
export PATH=$JAVA_HOME/bin:$PATH
if [ $# -ne 1 ]
then
echo "usage: add_module.sh prov|prov-ext|tls|pg|pkix|mail"
exit 0
fi
for jarName in bc$1-jdk15on-*.jar
do
rm -rf module.tmp
# Java 9 Step
(
export JAVA_HOME=/usr/lib/jvm/java-9-oracle
export PATH=$JAVA_HOME/bin:$PATH
mkdir -p module.tmp/v5
mkdir -p module.tmp/versions/v9
( cd module.tmp/v5; jar xf ../../build/artifacts/jdk1.5/jars/$jarName )
provJar=`echo build/artifacts/jdk1.5/jars/bcprov-jdk15on*.jar`
pkixJar=`echo build/artifacts/jdk1.5/jars/bcpkix-jdk15on*.jar`
if [ $1 = "prov" ]
then
javac -classpath module.tmp/v5 -d module.tmp/v9 `find $1/src/main/jdk1.9 -name "*.java"` -sourcepath $1/src/main/jdk1.9:$1/src/main/java:core/src/main/java
elif [ $1 = "prov-ext" ]
then
javac -classpath module.tmp/v5 -d module.tmp/v9 `find prov/src/main/ext-jdk1.9 -name "*.java"` -sourcepath prov/src/main/ext-jdk1.9:prov/src/main/java:core/src/main/java
elif [ $1 = "mail" ]
then
javac --module-path ${provJar}:$pkixJar -classpath module.tmp/v5 -d module.tmp/v9 `find $1/src/main/jdk1.9 -name "*.java"` -sourcepath $1/src/main/jdk1.9:$1/src/main/java
else
javac --module-path $provJar -classpath module.tmp/v5 -d module.tmp/v9 `find $1/src/main/jdk1.9 -name "*.java"` -sourcepath $1/src/main/jdk1.9:$1/src/main/java
fi
)
# Java 11 Step
(
export JAVA_HOME=/usr/lib/jvm/java-11-openjdk-amd64
export PATH=$JAVA_HOME/bin:$PATH
cd module.tmp
extras=`2>&1 jar cf $jarName -C v5 . --release 9 -C v9 . | egrep Warning | sed -e "s/Warning: entry //" | sed -e "s/ contains.*$//"`
for f in `echo $extras`
do
p=`echo $f | sed -e "s:META-INF/versions/9::"`
rm v9/$p
done
)
sh ./bnd.sh build/artifacts/jdk1.5/jars/$jarName
cp build/artifacts/jdk1.5/jars/$jarName module.tmp/$jarName
# Java 11 Step
(
export JAVA_HOME=/usr/lib/jvm/java-11-openjdk-amd64
export PATH=$JAVA_HOME/bin:$PATH
cd module.tmp
jar uf $jarName --release 9 -C v9 .
)
cp module.tmp/$jarName build/artifacts/jdk1.5/jars/$jarName
bcsign build/artifacts/jdk1.5/jars/$jarName
done