forked from stooke/macos-build-openjdk8u
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build-javafx.sh
executable file
·189 lines (152 loc) · 4.21 KB
/
build-javafx.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
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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
#!/bin/bash
export BUILD_JDK_HOME="$1"
export JDK_HOME="$BUILD_JDK_HOME"
export JAVA_HOME="$BUILD_JDK_HOME"
### no need to change anything below this line unless something went wrong
# fedora: may need to sudo dnf install gtk2-devel gtk3-devel
# TODO: use jdk.jfr instead of jrockit package
# TODO: glibc no longer privides xlocale.h, so glib-lite won't build
# (this last one means this script doesn't work at the moment)
set -e
# define build environment
BUILD_DIR=`pwd`
pushd `dirname $0`
SCRIPT_DIR=`pwd`
PATCH_DIR="$SCRIPT_DIR/jfx8-patch"
TOOL_DIR="$BUILD_DIR/tools"
TMP_DIR="$TOOL_DIR/tmp"
popd
# remote repo URL
JAVAFX_REPO=https://hg.openjdk.java.net/openjfx/8u-dev/rt
# local repo directory
JAVAFX_BUILD_DIR="$BUILD_DIR/jfx8"
# where this build wil put a new JDK with javaFX
NEW_JDK_DIR="$TMP_DIR/jdk8ujfx"
set_os() {
IS_LINUX=false
IS_DARWIN=false
if [ "`uname`" = "Linux" ] ; then
IS_LINUX=true
fi
IS_DARWIN=false
if [ "`uname`" = "Darwin" ] ; then
IS_DARWIN=true
fi
}
set_os
clone_javafx() {
if [ ! -d $JAVAFX_BUILD_DIR ] ; then
progress "clone javafx repo"
cd `dirname $JAVAFX_BUILD_DIR`
hg clone $JAVAFX_REPO "$JAVAFX_BUILD_DIR"
chmod 755 "$JAVAFX_BUILD_DIR/gradlew"
fi
}
patch_javafx() {
progress "patch javafx with javafx8.patch"
pushd "$JAVAFX_BUILD_DIR"
hg import --no-commit "$1"
popd
}
revert_javafx() {
pushd "$JAVAFX_BUILD_DIR"
hg revert .
popd
}
test_javafx() {
progress "test javafx"
cd "$JAVAFX_BUILD_DIR"
./gradlew --info cleanTest :base:test
}
build_javafx() {
progress "build javafx"
cd "$JAVAFX_BUILD_DIR"
#./gradlew sdk
# JDK 8 now includes jfr, but javafx 8 refers to jrockit so won't build
./gradlew --stacktrace -PCOMPILE_JFR=false -PCOMPILE_WEBKIT=true -PCOMPILE_MEDIA=true sdk
}
build_javafx_demos() {
progress "build javafx demos"
cd "$JAVAFX_BUILD_DIR"
./gradlew :apps:build
}
clean_javafx() {
progress "clean javafx"
cd "$JAVAFX_BUILD_DIR"
./gradlew clean
rm -fr build
}
save_jdk() {
progress "move JDK to temp location"
## save off the new jdk with javafx
mkdir -p "`dirname $2`"
rm -fr "$2"
cp -r "$1" "$2"
export JAVA_HOME="$2"
export JDK_HOME="$JAVA_HOME"
rm -f "$JAVA_HOME/jre/lib/ext/jfxrt.jar"
export PATH="$JAVA_HOME/bin:$PATH"
}
overlay_javafx() {
progress "overlay javafx on top of $1"
cd "$JAVAFX_BUILD_DIR"
./gradlew -PCOMPILE_WEBKIT=true -PCOMPILE_MEDIA=true zips
cd "$1"
unzip -o "$JAVAFX_BUILD_DIR/build/bundles/javafx-sdk-overlay.zip"
}
add_scenerbuilder() {
# add scenebuilder jars
mkdir -p "$NEW_JDK_DIR/scenebuilder"
cp "$JAVAFX_BUILD_DIR/apps/scenebuilder/SceneBuilderApp/dist/"* "$NEW_JDK_DIR/scenebuilder"
cp "$JAVAFX_BUILD_DIR/apps/scenebuilder/SceneBuilderKit/dist/"* "$NEW_JDK_DIR/scenebuilder"
cd "$NEW_JDK_DIR/scenebuilder"
mkdir -p "$TMP_DIR/a"
cd "$TMP_DIR/a"
unzip -o "$NEW_JDK_DIR/scenebuilder/SceneBuilderKit.jar"
unzip -o "$NEW_JDK_DIR/scenebuilder/SceneBuilderApp.jar"
zip -r "$NEW_JDK_DIR/scenebuilder/scenebuilder.jar" .
cd "$BUILD_DIR"
rm -fr "$TMP_DIR/a"
}
progress() {
echo $1
}
#### build the world
progress "download tools"
if $IS_DARWIN ; then
. "$SCRIPT_DIR/tools.sh" "$BUILD_DIR/tools" autoconf mercurial webrev jtreg ant cmake mvn
fi
if $IS_LINUX ; then
# build machine will require system autoconf mercurial ant cmake mvn
. "$SCRIPT_DIR/tools.sh" "$BUILD_DIR/tools" webrev jtreg
fi
progress "first attempt to build javafx"
set -x
if true ; then
save_jdk "$BUILD_JDK_HOME" "$NEW_JDK_DIR"
clone_javafx
revert_javafx
patch_javafx "$PATCH_DIR/javafx8-pass1.patch"
clean_javafx
build_javafx
#test_javafx
#build_javafx_demos
fi
progress "overlay javafx on top of new jdk - pass 1"
overlay_javafx "$NEW_JDK_DIR"
revert_javafx
patch_javafx "$PATCH_DIR/javafx8-pass2a.patch"
#clean_javafx
rm -f "$NEW_JDK_DIR/jre/lib/ext/jfxrt.jar"
build_javafx
progress "overlay javafx on top of new jdk - pass 2"
overlay_javafx "$NEW_JDK_DIR"
add_scenerbuilder
progress "create distribution zip"
WITH_JAVAFX_STR=-javafx
if $BUILD_SHENANDOAH ; then
WITH_SHENANDOAH_STR=-shenandoah
fi
pushd "$NEW_JDK_DIR"
zip -r "$BUILD_DIR/new-$JDK_BASE$WITH_JAVAFX_STR$WITH_SHENANDOAH_STR.zip" .
popd