Path: blob/buildjre8/buildjdk.sh
861 views
#!/bin/bash1set -e2. setdevkitpath.sh34if [[ "$TARGET_JDK" == "arm" ]]5then6export TARGET_JDK=aarch327export TARGET_PHYS=aarch32-linux-androideabi8export JVM_VARIANTS=client9else10export TARGET_PHYS=$TARGET11fi1213export FREETYPE_DIR=$PWD/freetype-$BUILD_FREETYPE_VERSION/build_android-$TARGET_SHORT14export CUPS_DIR=$PWD/cups-2.2.415export CFLAGS+=" -DLE_STANDALONE" # -I$FREETYPE_DIR -I$CUPS_DI1617# if [[ "$TARGET_JDK" == "aarch32" ]] || [[ "$TARGET_JDK" == "aarch64" ]]18# then19# export CFLAGS+=" -march=armv7-a+neon"20# fi2122# It isn't good, but need make it build anyways23# cp -R $CUPS_DIR/* $ANDROID_INCLUDE/2425# cp -R /usr/include/X11 $ANDROID_INCLUDE/26# cp -R /usr/include/fontconfig $ANDROID_INCLUDE/2728if [[ "$BUILD_IOS" != "1" ]]; then29export CFLAGS+=" -O3 -D__ANDROID__"3031ln -s -f /usr/include/X11 $ANDROID_INCLUDE/32ln -s -f /usr/include/fontconfig $ANDROID_INCLUDE/33AUTOCONF_x11arg="--x-includes=$ANDROID_INCLUDE/X11"3435export LDFLAGS+=" -L`pwd`/dummy_libs"3637# Create dummy libraries so we won't have to remove them in OpenJDK makefiles38mkdir -p dummy_libs39ar cru dummy_libs/libpthread.a40ar cru dummy_libs/libthread_db.a41else42ln -s -f /opt/X11/include/X11 $ANDROID_INCLUDE/43platform_args="--with-toolchain-type=clang SDKNAME=iphoneos"44# --disable-precompiled-headers45AUTOCONF_x11arg="--with-x=/opt/X11/include/X11 --prefix=/usr/lib"46sameflags="-arch arm64 -DHEADLESS=1 -I$PWD/ios-missing-include -Wno-c++11-narrowing -Wno-implicit-function-declaration -Wno-reserved-user-defined-literal -Wno-shift-negative-value"47export CFLAGS+=" $sameflags"48export LDFLAGS+=" -arch arm64"49export BUILD_SYSROOT_CFLAGS="-isysroot ${themacsysroot}"5051HOMEBREW_NO_AUTO_UPDATE=1 brew install ldid xquartz52fi5354# fix building libjawt55ln -s -f $CUPS_DIR/cups $ANDROID_INCLUDE/5657#FREEMARKER=$PWD/freemarker-2.3.8/lib/freemarker.jar5859cd openjdk6061# Apply patches62git reset --hard63if [[ "$BUILD_IOS" != "1" ]]; then64git apply --reject --whitespace=fix ../patches/jdk8u_android.diff || echo "git apply failed (universal patch set)"65if [[ "$TARGET_JDK" != "aarch32" ]]; then66git apply --reject --whitespace=fix ../patches/jdk8u_android_main.diff || echo "git apply failed (main non-universal patch set)"67else68git apply --reject --whitespace=fix ../patches/jdk8u_android_aarch32.diff || echo "git apply failed (aarch32 non-universal patch set)"69fi70if [[ "$TARGET_JDK" == "x86" ]]; then71git apply --reject --whitespace=fix ../patches/jdk8u_android_page_trap_fix.diff || echo "git apply failed (x86 page trap fix)"72fi73else74git apply --reject --whitespace=fix ../patches/jdk8u_ios.diff || echo "git apply failed (ios patch set)"75git apply --reject --whitespace=fix ../patches/jdk8u_ios_fix_clang.diff || echo "git apply failed (ios clang fix patch set)"76fi7778# --with-extra-cxxflags="$CXXFLAGS -Dchar16_t=uint16_t -Dchar32_t=uint32_t" \79# --with-extra-cflags="$CPPFLAGS" \80# --with-sysroot="$(xcrun --sdk iphoneos --show-sdk-path)" \8182# Let's print what's available83# bash configure --help8485# --with-freemarker-jar=$FREEMARKER \86# --with-toolchain-type=clang \87# --with-native-debug-symbols=none \88bash ./configure \89--openjdk-target=$TARGET_PHYS \90--with-extra-cflags="$CFLAGS" \91--with-extra-cxxflags="$CFLAGS" \92--with-extra-ldflags="$LDFLAGS" \93--enable-option-checking=fatal \94--with-jdk-variant=normal \95--with-jvm-variants="${JVM_VARIANTS/AND/,}" \96--with-cups-include=$CUPS_DIR \97--with-devkit=$TOOLCHAIN \98--with-debug-level=$JDK_DEBUG_LEVEL \99--with-fontconfig-include=$ANDROID_INCLUDE \100--with-freetype-lib=$FREETYPE_DIR/lib \101--with-freetype-include=$FREETYPE_DIR/include/freetype2 \102$AUTOCONF_x11arg $AUTOCONF_EXTRA_ARGS \103--x-libraries=/usr/lib \104$platform_args || \105error_code=$?106if [[ "$error_code" -ne 0 ]]; then107echo "\n\nCONFIGURE ERROR $error_code , config.log:"108cat config.log109exit $error_code110fi111112cd build/${JVM_PLATFORM}-${TARGET_JDK}-normal-${JVM_VARIANTS}-${JDK_DEBUG_LEVEL}113make JOBS=4 images || \114error_code=$?115if [[ "$error_code" -ne 0 ]]; then116echo "Build failure, exited with code $error_code. Trying again."117make JOBS=4 images118fi119120121