-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathmake_hottub.sh
More file actions
executable file
·95 lines (74 loc) · 2.16 KB
/
make_hottub.sh
File metadata and controls
executable file
·95 lines (74 loc) · 2.16 KB
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
#!/usr/bin/env bash
set -e
# You can set `JVMS_DIR`
# This script will try to copy the built JVM image here if the dir exists
# This script will also create a symlink `java_home` -> `$IMG` (see below)
JVMS_DIR="${JVMS_DIR:-"$HOME/jvms"}"
cd "$(dirname "${BASH_SOURCE[0]}")"
ROOT="$(pwd)"
if [ "$#" != "1" ] && [ "$#" != "2" ]; then
echo
echo "Usage: $0 <image name> [<jvm build type>]"
echo '- <jvm build type> is: release, fastdebug, or slowdebug (see OpenJDK build notes)'
echo '- Defaults to release build type and only copies debuginfo if not release'
echo '- Remember to do `bash configure --with-debug-level=<jvm build type>`'
echo
exit 1
fi
IMG="j2sdk-image.java8.$1"
TYPE="${2:-release}"
DIR="build/linux-x86_64-normal-server-$TYPE"
BUILD_HOME="$DIR/images/j2sdk-image"
echo "=== Building $IMG of type $TYPE"
echo "===== Building static analysis"
cd hottub/static_analysis
make
cd -
echo
echo "===== Building client"
cd hottub/client
make
cd -
echo
# force it to rebuild java binary
rm -f "$BUILD_HOME/bin/java"
echo "===== Building OpenJDK"
make images "CONF=linux-x86_64-normal-server-$TYPE"
echo
echo "===== Extracting debuginfo"
cp -r "$DIR"/jdk/objs/java_objs/java.debuginfo "$BUILD_HOME"/bin/
if [[ "$TYPE" == *"debug" ]]; then
pushd "$BUILD_HOME"/jre/lib/amd64/server
unzip -o libjvm.diz
popd
fi
echo
echo "=== Finishing up"
rm -rf "$BUILD_HOME/hottub"
mkdir -p "$BUILD_HOME/hottub/data"
if [ -d "$IMG" ]; then
echo "- Local image $IMG exists, replacing"
rm -rf "$IMG"
fi
if [ -d "$JVMS_DIR" ]; then
if [ -d "$JVMS_DIR/$IMG" ]; then
echo "- Image $IMG in JVMs dir $JVMS_DIR exists, replacing"
rm -rf "$JVMS_DIR/$IMG"
fi
fi
# client
mv "$BUILD_HOME/bin/java" "$BUILD_HOME/bin/java_real"
cp hottub/client/java "$BUILD_HOME/bin"
cp hottub/client/spoonjvm "$BUILD_HOME/bin"
# static analysis
cp -r hottub/static_analysis/build $BUILD_HOME/hottub/static_analysis
cp -r "$BUILD_HOME" "$IMG"
if [ -d "$HOME/jvms" ]; then
cp -r "$BUILD_HOME" "$JVMS_DIR/$IMG"
if [ -e "$JVMS_DIR/java_home" ]; then
rm $HOME/jvms/java_home
fi
ln -s "$JVMS_DIR/$IMG" "$JVMS_DIR/java_home"
fi
echo "Done."
echo