Created
May 27, 2009 08:13
-
-
Save rose00/118516 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
# source build.sh | |
# This script is originally derived from Stephen Bannasch's instructions: | |
# http://confluence.concord.org/display/CCTR/Build+OpenJDK+Java+1.7.0+on+Mac+OS+X+10.5 | |
# This script is placed in ../davinci/sources/ and run from there. See also: | |
# http://mail.openjdk.java.net/pipermail/mlvm-dev/2009-April/000434.html | |
# Works on JDK7 M3 (b59). | |
# Note the dependency on http://sourceforge.net/projects/jibx | |
# Download 1.1.5 from here: | |
# http://sourceforge.net/project/showfiles.php?group_id=69358&package_id=68290 | |
# The current version (1.2) may break your build. | |
export LC_ALL=C | |
export LANG=C | |
unset CLASSPATH | |
unset JAVA_HOME | |
#export ALT_BOOTDIR=/usr/local/soylatte16-i386-1.0.3 | |
#export ALT_BOOTDIR=/usr/local/soylatte16-amd64-1.0.3 | |
#export ALT_BOOTDIR=$JAVA7X_HOME | |
#export ALT_BOOTDIR=$DAVINCI/sources/build-stable-bootstrap-0623/bsd-amd64/j2sdk-image | |
#export ALT_BOOTDIR=$HOME/env/JAVA7_HOME | |
export ALT_BOOTDIR=$HOME/env/JAVA8_HOME | |
#for solaris hack this file: ./jdk/src/solaris/javavm/export/machine/endian.h | |
case $(uname) in | |
Darwin) export LP64=1;; | |
esac | |
: ${build64:=false} | |
case $LP64 in | |
1) build64=true | |
esac | |
sets=" | |
ALT_BOOTDIR=$ALT_BOOTDIR | |
ALT_JIBX_LIBS_PATH=$HOME/Downloads/jibx/lib | |
ALT_JDK_IMPORT_PATH=$ALT_BOOTDIR | |
ALT_BOOTDIR=$ALT_BOOTDIR | |
ANT_HOME=/usr/share/ant | |
NO_DOCS=true | |
NO_DEMOS=true | |
NO_SAMPLES=true | |
HOTSPOT_BUILD_JOBS=2 | |
BUILD_LANGTOOLS=true | |
BUILD_HOTSPOT=true | |
BUILD_JDK=true | |
BUILD_CORBA=false | |
BUILD_DEPLOY=false | |
BUILD_INSTALL=false | |
BUILD_JAXP=false | |
BUILD_JAXWS=false | |
BUILD_SPONSORS=false | |
ALT_COMPILER_PATH=$(pwd -P)/ALT_COMPILER_PATH/ | |
LD_LIBRARY_PATH= | |
COMMAND_MODE=unix2003 | |
OPENJDK=true | |
CC=$( xcrun -find gcc ) | |
CXX=$( xcrun -find g++ ) | |
" | |
# MACOSX_UNIVERSAL=false | |
# ALWAYS_PASS_TEST_GAMMA=true | |
# If PLATFORM=macosx: | |
# ? DARWIN_AS_BSD=true | |
# ? MACOSX_UNIVERSAL=false | |
# CC=gcc | |
# CXX=g++ | |
# ? MACOSX_UNIVERSAL=false | |
: ' | |
# ? CC=gcc-4.0 | |
# ? CXX=g++-4.0 | |
' | |
unset CC CXX | |
sets64=" | |
ARCH_DATA_MODEL=64 | |
LP64=1 | |
" | |
$build64 && sets="$sets$sets64" | |
# not needed on Mac as of 6/2009: ALT_CUPS_HEADERS_PATH=/usr/include | |
# Kurt Miller, 6/16/2009: | |
# ALT_HOTSPOT_IMPORT_PATH, ALT_JDK_IMPORT_PATH should never be set | |
# when building the full bsd-port. This may be the source of the | |
# problem you are hitting. | |
# I also recommend that a controlled, clean environment be used | |
# to build bsd-port. For Apple something similar to this should be | |
# correct: | |
# env -i PATH=/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin \ | |
# make \ | |
# ALT_BOOTDIR=$DEVTOOLS/soylatte16-i386-1.0.3/ \ | |
# ALT_FREETYPE_HEADERS_PATH=/usr/X11R6/include \ | |
# ALT_FREETYPE_LIB_PATH=/usr/X11R6/lib \ | |
# ALT_JIBX_LIBS_PATH=/export/devtools/jibx-1.1.6 \ | |
# ANT_HOME=/usr/share/ant \ | |
# NO_DOCS=true \ | |
# HOTSPOT_BUILD_JOBS=1 | |
# Execute the above sets, into the environment. | |
for s in $sets; do eval export $s; done | |
# Preview sets in command line | |
for s | |
do case $s in | |
*'[ ;]'*) break;; | |
*'='*) eval "$s";; | |
*) break;; | |
esac | |
done | |
# 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 && [ -d build ] && { | |
HOTSPOT_DIRS=$(find build -name hotspot -type d -prune -print) | |
${KEEP_HOTSPOT_HEADERS:-false} || | |
[ "$HOTSPOT_DIRS" = "" ] || | |
rm -f $(find $HOTSPOT_DIRS -name \*.gch) | |
${BUILD_HOTSPOT_CLEAN:-false} && | |
rm -f $(find $HOTSPOT_DIRS -name \*.o) | |
} | |
if $build64; then | |
rm -f build/bsd-i586/bsd-amd64/tmp/java/components_imported | |
else | |
rm -f build/bsd-i586/bsd-i586/tmp/java/components_imported | |
fi | |
#rm -f build-0201/bsd-i586/tmp/java/components_imported | |
#More vigorous: | |
# rm -rf build/*/{tmp,classes,symbols} | |
${BUILD_LANGTOOLS_CLEAN:-false} && | |
rm -rf build/bsd-i586/langtools/build/bootstrap/classes build/bsd-i586/tmp/java/components_imported | |
# consider: rm -rf build/bsd-i586/tmp build/bsd-i586/classes build/bsd-i586/symbols | |
# Run make, or whatever, in the resulting environment. | |
eval "${@-make}" | |
# Usage example: For a partial (re-)build of JDK only: | |
# sh build.sh BUILD_{LANGTOOLS,JDK_SUBDIRS}=false make |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This is the script I use to build mlvm, after cloning a source repo (from hotspot-comp) and applying mlvm patches (to jdk and hotspot sub-repos).