Repository navigation
Expand file tree
/
Copy pathbuildjdk.sh
More file actions
executable file
·131 lines (111 loc) · 4.38 KB
/
Copy pathbuildjdk.sh
File metadata and controls
executable file
·131 lines (111 loc) · 4.38 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
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
#!/bin/bash
set -e
. setdevkitpath.sh
if [[ "$TARGET_JDK" == "arm" ]]
then
export TARGET_JDK=aarch32
export TARGET_PHYS=aarch32-linux-androideabi
export JVM_VARIANTS=client
export CFLAGS+=" -march=armv7-a"
else
export TARGET_PHYS=$TARGET
fi
if [[ "$TARGET_JDK" == "x86" || "$TARGET_JDK" == "x86_64" ]]; then
export CFLAGS+=" -march=silvermont"
fi
if [[ "$TARGET_JDK" == "x86" ]]; then
export CFLAGS+=" -mstackrealign"
fi
export FREETYPE_DIR=$PWD/freetype-$BUILD_FREETYPE_VERSION/build_android-$TARGET_SHORT
export CUPS_DIR=$PWD/cups-2.2.4
export CFLAGS+=" -DLE_STANDALONE" # -I$FREETYPE_DIR -I$CUPS_DI
# if [[ "$TARGET_JDK" == "aarch32" ]] || [[ "$TARGET_JDK" == "aarch64" ]]
# then
# export CFLAGS+=" -march=armv7-a+neon"
# fi
# It isn't good, but need make it build anyways
# cp -R $CUPS_DIR/* $ANDROID_INCLUDE/
# cp -R /usr/include/X11 $ANDROID_INCLUDE/
# cp -R /usr/include/fontconfig $ANDROID_INCLUDE/
if [[ "$BUILD_IOS" != "1" ]]; then
export CFLAGS+=" -O3 -D__ANDROID__"
ln -s -f /usr/include/X11 $ANDROID_INCLUDE/
ln -s -f /usr/include/fontconfig $ANDROID_INCLUDE/
AUTOCONF_x11arg="--x-includes=$ANDROID_INCLUDE/X11"
export LDFLAGS+=" -L`pwd`/dummy_libs"
# Create dummy libraries so we won't have to remove them in OpenJDK makefiles
mkdir -p dummy_libs
ar cru dummy_libs/libpthread.a
ar cru dummy_libs/libthread_db.a
if [[ "$TARGET_JDK" == "aarch64" || "$TARGET_JDK" == "x86_64" ]]; then
export LDFLAGS+=" -Wl,-z,max-page-size=16384 -Wl,-z,common-page-size=16384"
fi
else
ln -s -f /opt/X11/include/X11 $ANDROID_INCLUDE/
platform_args="--with-toolchain-type=clang SDKNAME=iphoneos"
# --disable-precompiled-headers
AUTOCONF_x11arg="--with-x=/opt/X11/include/X11 --prefix=/usr/lib"
sameflags="-arch arm64 -DHEADLESS=1 -I$PWD/ios-missing-include -Wno-implicit-function-declaration"
export CFLAGS+=" $sameflags"
export LDFLAGS+=" -arch arm64"
export BUILD_SYSROOT_CFLAGS="-isysroot ${themacsysroot}"
HOMEBREW_NO_AUTO_UPDATE=1 brew install ldid xquartz
fi
# fix building libjawt
ln -s -f $CUPS_DIR/cups $ANDROID_INCLUDE/
#FREEMARKER=$PWD/freemarker-2.3.8/lib/freemarker.jar
cd openjdk
# Apply patches
git reset --hard
if [[ "$BUILD_IOS" != "1" ]]; then
git apply --reject --whitespace=fix ../patches/jdk8u_android.diff || echo "git apply failed (universal patch set)"
git apply --reject --whitespace=fix ../patches/jdk8u_android_branding.diff || echo "git apply failed (android branding patch)"
if [[ "$TARGET_JDK" != "aarch32" ]]; then
git apply --reject --whitespace=fix ../patches/jdk8u_android_main.diff || echo "git apply failed (main non-universal patch set)"
else
git apply --reject --whitespace=fix ../patches/jdk8u_android_aarch32.diff || echo "git apply failed (aarch32 non-universal patch set)"
fi
if [[ "$TARGET_JDK" == "x86" ]]; then
git apply --reject --whitespace=fix ../patches/jdk8u_android_page_trap_fix.diff || echo "git apply failed (x86 page trap fix)"
fi
else
git apply --reject --whitespace=fix ../patches/jdk8u_ios.diff || echo "git apply failed (ios patch set)"
fi
# --with-extra-cxxflags="$CXXFLAGS -Dchar16_t=uint16_t -Dchar32_t=uint32_t" \
# --with-extra-cflags="$CPPFLAGS" \
# --with-sysroot="$(xcrun --sdk iphoneos --show-sdk-path)" \
# Let's print what's available
# bash configure --help
# --with-freemarker-jar=$FREEMARKER \
# --with-toolchain-type=clang \
# --with-native-debug-symbols=none \
bash ./configure \
--openjdk-target=$TARGET_PHYS \
--with-extra-cflags="$CFLAGS" \
--with-extra-cxxflags="$CFLAGS" \
--with-extra-ldflags="$LDFLAGS" \
--enable-option-checking=fatal \
--with-jdk-variant=normal \
--with-jvm-variants="${JVM_VARIANTS/AND/,}" \
--with-cups-include=$CUPS_DIR \
--with-devkit=$TOOLCHAIN \
--with-debug-level=$JDK_DEBUG_LEVEL \
--with-fontconfig-include=$ANDROID_INCLUDE \
--with-freetype-lib=$FREETYPE_DIR/lib \
--with-freetype-include=$FREETYPE_DIR/include/freetype2 \
$AUTOCONF_x11arg $AUTOCONF_EXTRA_ARGS \
--x-libraries=/usr/lib \
$platform_args || \
error_code=$?
if [[ "$error_code" -ne 0 ]]; then
echo "\n\nCONFIGURE ERROR $error_code , config.log:"
cat config.log
exit $error_code
fi
cd build/${JVM_PLATFORM}-${TARGET_JDK}-normal-${JVM_VARIANTS}-${JDK_DEBUG_LEVEL}
make JOBS=4 images || \
error_code=$?
if [[ "$error_code" -ne 0 ]]; then
echo "Build failure, exited with code $error_code. Trying again."
make JOBS=4 images
fi