Take a look at the comments and code in update.sh
Also see: OpenJDK 7 and 8 for OS/X Snow and Lion
Take a look at the comments and code in update.sh
Also see: OpenJDK 7 and 8 for OS/X Snow and Lion
#!/bin/sh | |
# | |
# Building the development version of jdk7u | |
# | |
# filename: update.sh | |
# latest version available here: http://gist.github.com/1529906 | |
# | |
# https://wikis.oracle.com/display/OpenJDK/Mac+OS+X+Port | |
# | |
# hg clone http://hg.openjdk.java.net/jdk7u/jdk7u-dev | |
# cd jdk7u-dev | |
# curl http://gist.github.com/raw/1529906/update.sh -o update.sh | |
# | |
# The Ruby script: jdk/src/macosx/native/jobjc/run-and-write-if-okay | |
# doesn't work with Ruby 1.9.2, | |
# | |
# If you are using the RVM (Ruby Version Manager) then create the file '.rvmrc' | |
# with the following to enable usage of the original Ruby version 1.8.7 included | |
# with Mac OS X when building: | |
# | |
# rvm system | |
# | |
export JDK_IMPORT_PATH=$(/usr/libexec/java_home --version 1.7) | |
export JDK_UPDATE_VERSION=04 | |
SWINGSET2_JAR=/Developer/Extras/Java/JFC/SwingSet2/SwingSet2.jar | |
echo ' | |
*** updating jdk7u-dev sources... | |
' | |
hg fpull -u | |
# 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 jdk7u-dev: java 1.7.0 ... | |
' | |
unset LC_ALL LANG CLASSPATH JAVA_HOME LD_LIBRARY_PATH; make ALLOW_DOWNLOADS=true SA_APPLE_BOOT_JAVA=true ALWAYS_PASS_TEST_GAMMA=true ALT_BOOTDIR=`/usr/libexec/java_home -v 1.6` HOTSPOT_BUILD_JOBS=`sysctl -n hw.ncpu` | |
BUILD="build/macosx-amd64/j2sdk-bundle/1.7.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 -version | |
" | |
$BUILT_IMAGE -version | |
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.7.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 | |
' |