Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Then, see how to switch java versions on Mac OS X.

Using Hudson for Continuous Build.

Hudson will perfectly fit to set a continuous build system.

You'll need :

  • Mercurial with hgforest extension

Hudson jobs.

I defined 2 jobs, free-style software project, one for building 32 bits JVM, openjdk-1.7-i586, the other to build 64 bits JVM, openjdk-1.7-x86_64.

Execute shell for openjdk-1.7-i586

Code Block

#!/bin/sh
#

if [ ! -z "$HUDSON_HOME" ]; then
  DROP_DIR=$HUDSON_HOME/DROP_DIR
else
  DROP_DIR=`pwd/DROP_DIR`
fi

DROP_DIR=$HUDSON_HOME/DROP_DIR

if [ ! -d $DROP_DIR ]; then
  echo "creating DROP_DIR"
  mkdir -p DROP_DIR
fi

SOYLATTE=$DROP_DIR/soylatte16-i386-1.0.3

if [ ! -d $SOYLATTE ]; then

  if [ ! -f $DROP_DIR/soylatte16-i386-1.0.3.tar.bz2 ]; then
    echo "downloading soylatte16-i386-1.0.3 into DROP_DIR"
    curl --user jrl:"I am a Licensee in good standing" http://hg.bikemonkey.org/archive/javasrc_1_6_jrl_darwin/soylatte16-i386-1.0.3.tar.bz2 -o $DROP_DIR/soylatte16-i386-1.0.3.tar.bz2
  fi

  pushd $DROP_DIR
  tar xjf $DROP_DIR/soylatte16-i386-1.0.3.tar.bz2 
  popd
fi

if [ ! -f $DROP_DIR/jaxp-1_4_4.zip ]; then
  echo "downloading jaxp-1_4_4.zip into DROP_DIR"
  curl http://icedtea.classpath.org/download/drops/jaxp-1_4_4.zip -o $DROP_DIR/jaxp-1_4_4.zip
fi

if [ ! -f $DROP_DIR/jdk7-jaf-2010_08_19.zip ]; then
  echo "downloading jdk7-jaf-2010_08_19.zip into DROP_DIR"
  curl http://icedtea.classpath.org/download/drops/jdk7-jaf-2010_08_19.zip -o $DROP_DIR/jdk7-jaf-2010_08_19.zip
fi

if [ ! -f $DROP_DIR/jdk7-jaxws2_2-2010_08_19.zip ]; then
  echo "downloading jdk7-jaxws2_2-2010_08_19.zip into DROP_DIR"
  curl http://icedtea.classpath.org/download/drops/jdk7-jaxws2_2-2010_08_19.zip -o $DROP_DIR/jdk7-jaxws2_2-2010_08_19.zip
fi

if [ ! -d ALT_COMPILER_PATH ]; then
  echo "setup compiler dirs"
  mkdir ALT_COMPILER_PATH
  pushd ALT_COMPILER_PATH
  ln -s /usr/bin .SOURCE
  ln -s .SOURCE/g++-4.0 g++
  ln -s .SOURCE/gcc-4.0 gcc
  popd
fi

echo "cleaning previous build"

rm -rf build

unset CLASSPATH
unset JAVA_HOME
unset LD_LIBRARY_PATH

# patching defs.make for build on 64bits machine if required
grep -q x86_64 hotspot/make/bsd/makefiles/defs.make
if [ $? -eq 1 ] ; then
echo "patching defs.make for build on 64bits machine"
patch -p0 <<EOF
--- hotspot/make/bsd/makefiles/defs.make.orig   2010-11-20 16:09:49.000000000 +0100
+++ hotspot/make/bsd/makefiles/defs.make        2010-11-20 16:10:29.000000000 +0100
@@ -90,6 +90,24 @@
   endif
 endif
 
+# x86_64 OS/X
+ifeq (\$(ARCH), x86_64)
+  ifeq (\$(ARCH_DATA_MODEL), 64)
+    ARCH_DATA_MODEL = 64
+    MAKE_ARGS       += LP64=1
+    PLATFORM        = bsd-amd64
+    VM_PLATFORM     = bsd_amd64
+    HS_ARCH         = x86
+  else
+    ARCH_DATA_MODEL = 32
+    PLATFORM        = bsd-i586
+    VM_PLATFORM     = bsd_i486
+    HS_ARCH         = x86
+    # We have to reset ARCH to i386 since SRCARCH relies on it
+    ARCH            = i386
+  endif
+endif
+
 # i386
 ifeq (\$(ARCH), i386)
   ifeq (\$(ARCH_DATA_MODEL), 64)
EOF
fi

# patching Platform.gmk for 32bits VM build on 64bits machine
grep -q "force i586 if 32bits VM asked" jdk/make/common/shared/Platform.gmk
if [ $? -eq 1 ] ; then
echo "patching Platform.gmk for 32bits VM on 64bits machine"
patch -p0 <<EOF1
--- jdk/make/common/shared/Platform.gmk.orig	2010-11-20 19:33:19.000000000 +0100
+++ jdk/make/common/shared/Platform.gmk	2010-11-21 00:39:18.000000000 +0100
@@ -272,6 +272,12 @@
 
   # Darwin builds may be 32-bit or 64-bit data model.
   ifeq (\$(SYSTEM_UNAME), Darwin)
+    ifeq (\$(ARCH), amd64)
+      # force i586 if 32bits VM asked
+      ifeq (\$(ARCH_DATA_MODEL), 32)
+        ARCH=i586
+      endif
+    endif
     ifeq (\$(ARCH), i586)
       ifeq (\$(ARCH_DATA_MODEL), 64)
         ARCH=amd64
EOF1
fi

env -i PATH=/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin \
 LANG=C \
 CC=gcc-4.0 \
 CXX=g++-4.0 \
 make \
 ALT_DROPS_DIR=$DROP_DIR \
 ALT_BOOTDIR=$SOYLATTE \
 ALT_JDK_IMPORT_PATH=$SOYLATTE \
 ALT_FREETYPE_HEADERS_PATH=/usr/X11R6/include \
 ALT_FREETYPE_LIB_PATH=/usr/X11R6/lib \
 ALT_CUPS_HEADERS_PATH=/usr/include \
 ALLOW_DOWNLOADS=true \
 ANT_HOME=/usr/share/ant \
 NO_DOCS=true \
 HOTSPOT_BUILD_JOBS=2 \
 ARCH_DATA_MODEL=32 \
 ALT_COMPILER_PATH=$(pwd -P)/ALT_COMPILER_PATH/ \
 LD_LIBRARY_PATH=

echo "testing build: ./build/bsd-i586/j2sdk-image/bin/java -version"

./build/bsd-i586/j2sdk-image/bin/java -version

Execute shell for openjdk-1.7-x86_64

Code Block

#!/bin/sh
#

if [ ! -z "$HUDSON_HOME" ]; then
  DROP_DIR=$HUDSON_HOME/DROP_DIR
else
  DROP_DIR=`pwd/DROP_DIR`
fi

DROP_DIR=$HUDSON_HOME/DROP_DIR

if [ ! -d $DROP_DIR ]; then
  echo "creating DROP_DIR"
  mkdir -p DROP_DIR
fi

SOYLATTE=$DROP_DIR/soylatte16-amd64-1.0.3

if [ ! -d $SOYLATTE ]; then

  if [ ! -f $DROP_DIR/soylatte16-amd64-1.0.3.tar.bz2 ]; then
    echo "downloading soylatte16-amd64-1.0.3 into DROP_DIR"
    curl --user jrl:"I am a Licensee in good standing" http://hg.bikemonkey.org/archive/javasrc_1_6_jrl_darwin/soylatte16-amd64-1.0.3.tar.bz2 -o $DROP_DIR/soylatte16-amd64-1.0.3.tar.bz2
  fi

  pushd $DROP_DIR
  tar xjf $DROP_DIR/soylatte16-amd64-1.0.3.tar.bz2 
  popd
fi

if [ ! -f $DROP_DIR/jaxp-1_4_4.zip ]; then
  echo "downloading jaxp-1_4_4.zip into DROP_DIR"
  curl http://icedtea.classpath.org/download/drops/jaxp-1_4_4.zip -o $DROP_DIR/jaxp-1_4_4.zip
fi

if [ ! -f $DROP_DIR/jdk7-jaf-2010_08_19.zip ]; then
  echo "downloading jdk7-jaf-2010_08_19.zip into DROP_DIR"
  curl http://icedtea.classpath.org/download/drops/jdk7-jaf-2010_08_19.zip -o $DROP_DIR/jdk7-jaf-2010_08_19.zip
fi

if [ ! -f $DROP_DIR/jdk7-jaxws2_2-2010_08_19.zip ]; then
  echo "downloading jdk7-jaxws2_2-2010_08_19.zip into DROP_DIR"
  curl http://icedtea.classpath.org/download/drops/jdk7-jaxws2_2-2010_08_19.zip -o $DROP_DIR/jdk7-jaxws2_2-2010_08_19.zip
fi

if [ ! -d ALT_COMPILER_PATH ]; then
  echo "setup compiler dirs"
  mkdir ALT_COMPILER_PATH
  pushd ALT_COMPILER_PATH
  ln -s /usr/bin .SOURCE
  ln -s .SOURCE/g++-4.0 g++
  ln -s .SOURCE/gcc-4.0 gcc
  popd
fi

echo "cleaning previous build"

rm -rf build

unset CLASSPATH
unset JAVA_HOME
unset LD_LIBRARY_PATH

# patching defs.make for build on 64bits machine if required
grep -q x86_64 hotspot/make/bsd/makefiles/defs.make
if [ $? -eq 1 ] ; then
echo "patching defs.make for build on 64bits machine"
patch -p0 <<EOF
--- hotspot/make/bsd/makefiles/defs.make.orig   2010-11-20 16:09:49.000000000 +0100
+++ hotspot/make/bsd/makefiles/defs.make        2010-11-20 16:10:29.000000000 +0100
@@ -90,6 +90,24 @@
   endif
 endif
 
+# x86_64 OS/X
+ifeq (\$(ARCH), x86_64)
+  ifeq (\$(ARCH_DATA_MODEL), 64)
+    ARCH_DATA_MODEL = 64
+    MAKE_ARGS       += LP64=1
+    PLATFORM        = bsd-amd64
+    VM_PLATFORM     = bsd_amd64
+    HS_ARCH         = x86
+  else
+    ARCH_DATA_MODEL = 32
+    PLATFORM        = bsd-i586
+    VM_PLATFORM     = bsd_i486
+    HS_ARCH         = x86
+    # We have to reset ARCH to i386 since SRCARCH relies on it
+    ARCH            = i386
+  endif
+endif
+
 # i386
 ifeq (\$(ARCH), i386)
   ifeq (\$(ARCH_DATA_MODEL), 64)
EOF
fi

# patching Platform.gmk for 32bits VM build on 64bits machine
grep -q "force i586 if 32bits VM asked" jdk/make/common/shared/Platform.gmk
if [ $? -eq 1 ] ; then
echo "patching Platform.gmk for 32bits VM on 64bits machine"
patch -p0 <<EOF1
--- jdk/make/common/shared/Platform.gmk.orig	2010-11-20 19:33:19.000000000 +0100
+++ jdk/make/common/shared/Platform.gmk	2010-11-21 00:39:18.000000000 +0100
@@ -272,6 +272,12 @@
 
   # Darwin builds may be 32-bit or 64-bit data model.
   ifeq (\$(SYSTEM_UNAME), Darwin)
+    ifeq (\$(ARCH), amd64)
+      # force i586 if 32bits VM asked
+      ifeq (\$(ARCH_DATA_MODEL), 32)
+        ARCH=i586
+      endif
+    endif
     ifeq (\$(ARCH), i586)
       ifeq (\$(ARCH_DATA_MODEL), 64)
         ARCH=amd64
EOF1
fi

env -i PATH=/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin \
 LANG=C \
 CC=gcc-4.0 \
 CXX=g++-4.0 \
 make \
 ALT_DROPS_DIR=$DROP_DIR \
 ALT_BOOTDIR=$SOYLATTE \
 ALT_JDK_IMPORT_PATH=$SOYLATTE \
 ALT_FREETYPE_HEADERS_PATH=/usr/X11R6/include \
 ALT_FREETYPE_LIB_PATH=/usr/X11R6/lib \
 ALT_CUPS_HEADERS_PATH=/usr/include \
 ALLOW_DOWNLOADS=true \
 ANT_HOME=/usr/share/ant \
 NO_DOCS=true \
 HOTSPOT_BUILD_JOBS=2 \
 ARCH_DATA_MODEL=64 \
 ALT_COMPILER_PATH=$(pwd -P)/ALT_COMPILER_PATH/ \
 LD_LIBRARY_PATH=

echo "testing build: ./build/bsd-amd64/j2sdk-image/bin/java -version"

./build/bsd-amd64/j2sdk-image/bin/java -version