Created
March 5, 2012 19:55
-
-
Save stepheneb/1980690 to your computer and use it in GitHub Desktop.
building jdk8/tl with http://cr.openjdk.java.net/~michaelm/7113349/jdk8/webrev.4 applied
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# | |
# Building jdk8/tl | |
# | |
# filename: update.sh | |
# latest version available here: http://gist.github.com/1980690 | |
# | |
# https://wikis.oracle.com/display/OpenJDK/Mac+OS+X+Port | |
# | |
# Prerequisites: | |
# Mac OS X Java 1.7 | |
# A working version of Java 1.7. | |
# Binary distributions are available here: http://code.google.com/p/openjdk-osx-build/ | |
# I build it from source: https://gist.github.com/908156 | |
# | |
# Once Java 1.7 is installed you should be able to successfully run this command | |
# and see a result similar to the following: | |
# | |
# $ `/usr/libexec/java_home --version 1.7`/bin/java -version | |
# openjdk version "1.7.0_04-internal" | |
# OpenJDK Runtime Environment (build 1.7.0_04-internal-stephen_2012_02_24_16_26-b00) | |
# OpenJDK 64-Bit Server VM (build 23.0-b16, mixed mode) | |
# | |
# After building OpenJDK this script runs a few tests using jtreg the regression | |
# test harness for the OpenJDK platform. | |
# | |
# http://openjdk.java.net/jtreg/ | |
# http://openjdk.java.net/jtreg/faq.html | |
# https://blogs.oracle.com/jjg/entry/jtreg_4_1 | |
# http://download.java.net/openjdk/jtreg/ | |
# | |
# Download jtreg and make sure jtreg/lib is on your PATH. | |
# After installing jtreg download junit-4.5.jar and move it to jtreg/lib/junit.jar | |
# | |
# curl -L http://sourceforge.net/projects/junit/files/junit/4.5/junit-4.5.jar -o jtreg/lib/junit.jar | |
# | |
# The Ruby script: jdk/src/macosx/native/jobjc/run-and-write-if-okay doesn't work | |
# with Ruby 1.9.2 so if you are using the RVM (Ruby Version Manager) create the | |
# file '.rvmrc' in the jdk8tl directory with the following content: "rvm use system" to | |
# enable usage of the original Ruby version 1.8.7 included with Mac OS X when building: | |
# | |
# Basic setup after installing prerequisites: | |
# | |
# mkdir jdk8tl | |
# echo "rvm use system" > jdk8tl/.rvmrc | |
# cd jdk8tl | |
# hg fclone http://hg.openjdk.java.net/jdk8/tl sources | |
# rm -rf 7113349-jdk8-webrev.4 | |
# mkdir 7113349-jdk8-webrev.4 | |
# cd 7113349-jdk8-webrev.4/ | |
# wget http://cr.openjdk.java.net/~michaelm/7113349/jdk8/webrev.4/top/jdk8-merge.patch | |
# wget http://cr.openjdk.java.net/~michaelm/7113349/jdk8/webrev.4/jdk/jdk.patch | |
# wget http://cr.openjdk.java.net/~michaelm/7113349/jdk8/webrev.4/corba/corba.patch | |
# wget http://cr.openjdk.java.net/~michaelm/7113349/jdk8/webrev.4/langtools/langtools.patch | |
# cd .. | |
# curl http://gist.github.com/raw/1980690/update.sh -o update.sh | |
# chmod u+x update.sh | |
# | |
# Start the build: | |
# | |
# ./update.sh | |
# | |
JDK8TL=$(pwd) | |
SOURCES=$JDK8TL/sources | |
PATCHES=$JDK8TL/7113349-jdk8-webrev.4 | |
JDK_UPDATE_VERSION=00 | |
TEST_GAMMA=true | |
SYSTEM_JAVA_1_7=$(/usr/libexec/java_home --version 1.7) | |
BUILD_JOBS=$(sysctl -n hw.ncpu) | |
SWINGSET2_JAR=/Developer/Extras/Java/JFC/SwingSet2/SwingSet2.jar | |
echo ' | |
*** rolback changes in source directories: | |
- removing untracked files ... | |
- backing out applied patches ... | |
' | |
(cd $SOURCES; hg st -nu | xargs rm; hg update -C .) | |
(cd $SOURCES/jdk; hg st -nu | xargs rm; hg update -C .) | |
(cd $SOURCES/langtools; hg st -nu | xargs rm; hg update -C .) | |
(cd $SOURCES/corba; hg st -nu | xargs rm; hg update -C .) | |
echo ' | |
*** updating jdk8/tl sources... | |
' | |
cd $SOURCES | |
hg fpull -u | |
echo ' | |
*** applying patches ... | |
' | |
ls -l $PATCHES | |
echo " | |
*** patching $SOURCES ... | |
" | |
patch -f -p1 < $PATCHES/jdk8-merge.patch | |
echo " | |
*** patching $SOURCES/jdk ... | |
" | |
(cd jdk; patch -f -p1 < $PATCHES/jdk.patch) | |
echo " | |
*** patching $SOURCES/corba ... | |
" | |
(cd corba; patch -f -p1 < $PATCHES/corba.patch) | |
echo " | |
*** patching $SOURCES/langtools ... | |
" | |
(cd langtools; patch -f -p1 < $PATCHES/langtools.patch) | |
# delete the previous build dir in the background if it exists | |
if [ -e build ] | |
then | |
mv build build.del; rm -rf build.del & | |
fi | |
# Remove file with versioned name of last build and symbolic link to last build. | |
# Used when referring to a build when copying or creating a tarball later. | |
if [ -e .last_build ] | |
then | |
echo ' | |
removing references to last build | |
' | |
buildname=`cat .last_build` | |
rm -f .last_build | |
rm -f $buildname | |
fi | |
echo ' | |
*** building jdk8/tl: java 1.8.0 ... | |
' | |
unset LC_ALL LANG CLASSPATH JAVA_HOME LD_LIBRARY_PATH; make LANG=C LP64=1 OPENJDK=true ALLOW_DOWNLOADS=true SA_APPLE_BOOT_JAVA=true ALWAYS_PASS_TEST_GAMMA=$TEST_GAMMA ALT_BOOTDIR=$SYSTEM_JAVA_1_7 HOTSPOT_BUILD_JOBS=$BUILD_JOBS | |
BUILD="build/macosx-amd64/j2sdk-bundle/1.8.0.jdk" | |
BUILD_HOME="$BUILD/Contents/Home" | |
BUILT_IMAGE="$BUILD_HOME/bin/java" | |
JTREG_INVOKE="jtreg -XX:+UnlockExperimentalVMOptions -ignore:quiet -agentvm -jdk:$BUILD_HOME" | |
echo " | |
*** testing build: | |
$BUILT_IMAGE -Xinternalversion | |
" | |
$BUILT_IMAGE -Xinternalversion | |
echo " | |
*** running jdk/test/java/lang/invoke tests: | |
$JTREG_INVOKE -v:summary jdk/test/java/lang/invoke/ | |
" | |
$JTREG_INVOKE -v:summary jdk/test/java/lang/invoke/ | |
echo " | |
*** testing Swing: running SwingSet2.jar: | |
./$BUILT_IMAGE -jar $SWINGSET2_JAR | |
" | |
./$BUILT_IMAGE -jar $SWINGSET2_JAR& | |
# Save a name with the date for referring to this build and create a symbolic | |
# link to use when copying or creating a tarball later. | |
buildname=1.8.0_$JDK_UPDATE_VERSION-`date "+%Y_%m_%d".jdk` | |
ln -Ffs $BUILD/ $buildname | |
echo $buildname > .last_build | |
echo " | |
*** if the build works install with this command: | |
cp -r $buildname ~/Library/Java/JavaVirtualMachines | |
" | |
echo ' | |
*** after installation the new Java should appear in the list generated when running this command: | |
/usr/libexec/java_home --version 1.8 -V | |
' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment