|
# Building the Java 1.7 Da Vinci Machine (mlvm) on Mac OS X |
|
# |
|
# filename: update.sh |
|
# latest version available here: http://gist.github.com/243072 |
|
# |
|
# Stephen Bannasch, 2009 11 29, tested on Mac OS X 10.5.8 |
|
# |
|
# This script assumes: |
|
# Apple's Mac OX X developer tools are installed |
|
# hg (mercurial) is installed |
|
# The forest extension to hg is installed |
|
# The bsd port forest is checked out into: ./sources/ |
|
# The mlvm patchsets are checked out into: ./patches/ |
|
# SoyLatte 32-bit Java 1.6 is located here: |
|
# /usr/local/soylatte16-i386-1.0.3 |
|
# ALT_JIBX_LIBS_PATH points to JIBX v1.1.5 |
|
# |
|
# References: |
|
# http://wikis.sun.com/display/mlvm |
|
# http://wikis.sun.com/display/mlvm/Building |
|
# http://hg.openjdk.java.net/mlvm/mlvm/file/tip/README.txt |
|
# http://bit.ly/8TKqcS |
|
# http://landonf.bikemonkey.org/static/soylatte/ |
|
# http://hg.openjdk.java.net/jdk7/build/raw-file/tip/README-builds.html |
|
# http://sourceforge.net/projects/jibx/files/ |
|
# |
|
# http://hgbook.red-bean.com/read/advanced-uses-of-mercurial-queues.html |
|
# |
|
# Prerequisites: |
|
# SoyLatte 32-bit Java 1.6 |
|
# |
|
# Download v1.0.3 of Landon Fuller's SoyLatte Java 1.6 32 bit release |
|
# and install or link it to /usr/local/soylatte16-i386-1.0.3 and test it: |
|
# |
|
# $ /usr/local/soylatte16-i386-1.0.3/bin/java -version |
|
# java version "1.6.0_03-p3" |
|
# Java(TM) SE Runtime Environment (build 1.6.0_03-p3-landonf_19_aug_2008_14_55-b00) |
|
# Java HotSpot(TM) Server VM (build 1.6.0_03-p3-landonf_19_aug_2008_14_55-b00, mixed mode) |
|
# |
|
# JiBX v1.1.5 (Binding XML to Java libraries) |
|
# |
|
# Download and install v1.1.5 of JIBX from sourceforge |
|
# http://sourceforge.net/projects/jibx/files/ |
|
# update the ALT_JIBX_LIBS_PATH variable in this script. |
|
# |
|
# Basic setup after installing prerequisites: |
|
# mkdir davinci |
|
# cd davinci |
|
# hg fclone http://hg.openjdk.java.net/bsd-port/bsd-port sources |
|
# hg fclone http://hg.openjdk.java.net/mlvm/mlvm patches |
|
# |
|
# Create the ALT_COMPILER_PATH directoru and compiler links: |
|
# In the sources/ dir create the ALT_COMPILER_PATH dir and |
|
# the following symbolic links to the gcc 4.0 compilers: |
|
# |
|
# cd sources |
|
# mkdir ALT_COMPILER_PATH |
|
# cd ALT_COMPILER_PATH |
|
# ln -s /usr/bin .SOURCE |
|
# ln -s .SOURCE/g++-4.0 g++ |
|
# ln -s .SOURCE/gcc-4.0 gcc |
|
# |
|
# Building: |
|
# cd davinci |
|
# source update.sh |
|
# |
|
# After building see if the new build can report it's version number: |
|
# $ ./build/bsd-i586/j2sdk-image/bin/java -version |
|
# openjdk version "1.7.0-internal" |
|
# OpenJDK Runtime Environment (build 1.7.0-internal-stephen_2009_11_25_22_57-b00) |
|
# OpenJDK Server VM (build 17.0-b05, mixed mode) |
|
# |
|
|
|
cd sources |
|
|
|
echo ' |
|
*** popping previously applied patches to bsdport sources: hotspot, jdk, and langtools ...' |
|
|
|
echo ' |
|
[hotspot] ' |
|
cd hotspot; hg qpop -a; cd - |
|
|
|
echo ' |
|
[jdk] ' |
|
cd jdk; hg qpop -a; cd - |
|
|
|
echo ' |
|
[langtools] ' |
|
cd langtools; hg qpop -a; cd - |
|
|
|
echo ' |
|
*** updating bsdport sources... |
|
' |
|
hg fpull -u |
|
|
|
echo ' |
|
*** updating mlvm patchsets ... |
|
' |
|
cd ../patches |
|
hg fpull -u |
|
cd .. |
|
|
|
echo ' |
|
*** integrating mlvm patchsets into bsdport sources ... |
|
' |
|
bash patches/make/link-patch-dirs.sh sources patches |
|
ls -il patches/hotspot/series sources/hotspot/.hg/patches/series |
|
export davinci=$(pwd) guards="buildable testable" |
|
|
|
echo ' |
|
*** running: hg qselect --reapply $guards |
|
' |
|
sh patches/make/each-patch-repo.sh "hg qselect --reapply $guards" '$(sh $davinci/patches/make/current-release.sh)' |
|
|
|
echo ' |
|
*** running: hg qselect --pop $guards |
|
' |
|
sh patches/make/each-patch-repo.sh "hg qselect --pop $guards" '$(sh $davinci/patches/make/current-release.sh)' |
|
|
|
echo ' |
|
*** running: hg qselect; hg qunapplied |
|
' |
|
sh patches/make/each-patch-repo.sh "hg qselect; hg qunapplied" |
|
|
|
echo ' |
|
*** running: hg update -r |
|
' |
|
sh patches/make/each-patch-repo.sh "hg update -r" '$(sh $davinci/patches/make/current-release.sh)' |
|
|
|
echo ' |
|
*** running: hg qpush -a |
|
' |
|
sh patches/make/each-patch-repo.sh "hg qpush -a" |
|
|
|
echo ' |
|
*** cleaning previous build products ... |
|
' |
|
cd sources |
|
mv build build.del; rm -rf build.del & |
|
|
|
# Remove file with versioned name of last build and symbolic link to last build. |
|
# Used when referring to a build when copying to /usr/local or creating a tarball. |
|
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 davinci (mlvm) ... |
|
' |
|
export LC_ALL=C |
|
export LANG=C |
|
unset CLASSPATH |
|
unset JAVA_HOME |
|
|
|
sets=" |
|
ALT_BOOTDIR=/usr/local/soylatte16-i386-1.0.3 |
|
ALT_JDK_IMPORT_PATH=/usr/local/soylatte16-i386-1.0.3 |
|
ALT_BINARY_PLUGS_PATH=$HOME/dev/java/jdk-7-icedtea-plugs |
|
ALT_FREETYPE_HEADERS_PATH=/usr/X11R6/include |
|
ALT_FREETYPE_LIB_PATH=/usr/X11R6/lib |
|
ALT_JIBX_LIBS_PATH=$HOME/dev/java/jibx/lib |
|
ANT_HOME=/usr/share/ant |
|
NO_DOCS=true |
|
HOTSPOT_BUILD_JOBS=2 |
|
BUILD_LANGTOOLS=true |
|
BUILD_JAXP=false |
|
BUILD_JAXWS=false |
|
BUILD_CORBA=false |
|
BUILD_HOTSPOT=true |
|
BUILD_JDK=true |
|
DEBUG_NAME=fastdebug |
|
SKIP_FASTDEBUG_BUILD=true |
|
CC=gcc-4.0 |
|
CXX=g++-4.0 |
|
ALT_COMPILER_PATH=$(pwd -P)/ALT_COMPILER_PATH/ |
|
LD_LIBRARY_PATH= |
|
" |
|
|
|
echo ' |
|
*** executing sets into the environment ... |
|
' |
|
# Execute the above sets, into the environment. |
|
for s in $sets; do eval export $s; done |
|
|
|
echo ' |
|
*** preview sets in command line ... |
|
' |
|
# Preview sets in command line |
|
for s |
|
do case $s in |
|
*'[ ;]'*) break;; |
|
*'='*) eval "$s";; |
|
*) break;; |
|
esac |
|
done |
|
|
|
echo ' |
|
*** removing *.gch files ... |
|
' |
|
# Incremental JVM rebuilds have trouble with *.gch files. |
|
# The *.gch file does not get regenerated unless you remove it, |
|
# even if 20 header files have changed. |
|
# This is not a problem for batch builds, of course. |
|
$BUILD_HOTSPOT && { |
|
${KEEP_HOTSPOT_HEADERS:-false} || |
|
rm -f $(find build -name _precompiled.incl.gch) |
|
} |
|
|
|
# If COMMAND_MODE=legacy then the archive command: 'ar' will not create or update |
|
# catalog entries when creating an archive resulting in errors like this: |
|
# |
|
# libfdlibm.i586.a, archive has no table of contents |
|
# |
|
# This only appears to be a problem when using iTerm as the terminal program. |
|
# Using the Terminal.app program that comes with Mac OS X sets COMMAND_MODE=unix2003. |
|
# See: http://old.nabble.com/Why-ar-doesn't-call-ranlib-on-Mac--td22319721.html |
|
if [ "$COMMAND_MODE" = "legacy" ] |
|
then |
|
echo ' |
|
*** changing COMMAND_MODE from legacy to unix2003 |
|
' |
|
export COMMAND_MODE=unix2003 |
|
fi |
|
|
|
echo ' |
|
*** running make ... |
|
' |
|
# Run make, or whatever, in the resulting environment. |
|
eval "${@-make}" |
|
|
|
# Usage example: For a partial (re-)build of JDK only: |
|
# sh build.sh BUILD_{HOTSPOT,LANGTOOLS}=false make |
|
|
|
echo ' |
|
testing build: ./build/bsd-i586/j2sdk-image/bin/java -version |
|
' |
|
./build/bsd-i586/j2sdk-image/bin/java -version |
|
|
|
# Save a name with the date to use when referring to this build |
|
# when copying to /usr/local or creating a tarball later. |
|
buildname=java-1.7.0-internal-`date "+%Y_%m_%d"` |
|
ln -Ffs build/bsd-i586/j2sdk-image/ $buildname |
|
echo $buildname > .last_build |