Skip to content

Building and Packaging OpenJDK7 for OSX

hgomez edited this page Oct 25, 2012 · 34 revisions

OSX build and packages scripts for OpenJDK7 on OSX will be under obuildfactory/openjdk7/macosx directory

Prepare environment

mkdir openjdkathome
cd openjdkathome
git clone https://github.com/hgomez/obuildfactory.git`

Building OpenJDK

Building is activated by XBUILD env var set to true

cd openjdkathome
XBUILD=true ./obuildfactory/openjdk7/macosx/standalone-job.sh

After some minutes you should see this logs :

#-- Build times ----------
Target all_product_build
Start 2012-10-25 22:10:11
End   2012-10-25 22:15:42
00:00:15 corba
00:00:06 hotspot
00:00:04 jaxp
00:00:07 jaxws
00:04:52 jdk
00:00:06 langtools
00:05:31 TOTAL
-------------------------
openjdk version "1.7.0-u10-b09"
OpenJDK Runtime Environment (build 1.7.0-u10-b09-20121025)
OpenJDK 64-Bit Server VM (build 23.6-b03, mixed mode)
openjdk version "1.7.0-u10-b09"
OpenJDK Runtime Environment (build 1.7.0-u10-b09-20121025)
OpenJDK 64-Bit Server VM (build 23.6-b03, mixed mode)

You'll find JDK/JRE tarballs under OBF_DROP_DIR/openjdk7

ls -l OBF_DROP_DIR/openjdk7
total 367752
-rw-r--r--  1 henri  staff  30740364 25 oct 21:45 j2re-bundle-x86_64-u10-b09-20121025.tar.bz2
-rw-r--r--  1 henri  staff  30734607 25 oct 21:44 j2re-image-x86_64-u10-b09-20121025.tar.bz2
-rw-r--r--  1 henri  staff  63399134 25 oct 21:45 j2sdk-bundle-x86_64-u10-b09-20121025.tar.bz2
-rw-r--r--  1 henri  staff  63407811 25 oct 21:44 j2sdk-image-x86_64-u10-b09-20121025.tar.bz2

Images tarballs

Images tarballs could be used like any others Unix Java, ie :

mbp-rico:openjdkathome henri$ tar xvfj OBF_DROP_DIR/openjdk7/j2sdk-image-x86_64-u10-b09-20121025.tar.bz2
x j2sdk-image/
x j2sdk-image/ASSEMBLY_EXCEPTION
x j2sdk-image/bin/
x j2sdk-image/demo/
x j2sdk-image/include/
x j2sdk-image/jre/
x j2sdk-image/lib/
x j2sdk-image/LICENSE
x j2sdk-image/man/
...
x j2sdk-image/bin/tnameserv
x j2sdk-image/bin/unpack200
x j2sdk-image/bin/wsgen
x j2sdk-image/bin/wsimport
x j2sdk-image/bin/xjc

mbp-rico:openjdkathome henri$ ./j2sdk-image/bin/java -version
openjdk version "1.7.0-u10-b09"
OpenJDK Runtime Environment (build 1.7.0-u10-b09-20121025)
OpenJDK 64-Bit Server VM (build 23.6-b03, mixed mode)

Bundle tarballs

Bundle tarballs are designed for OSX integration and should be installed under /Library/Java/JavaVirtualMachines

mbp-rico:openjdkathome henri$ tar xvfj OBF_DROP_DIR/openjdk7/j2sdk-bundle-x86_64-u10-b09-20121025.tar.bz2

Packaging OpenJDK

Packaging is activated by XPACKAGE env var set to true

cd openjdkathome
XBUILD=true XPACKAGE=true ./obuildfactory/openjdk7/macosx/standalone-job.sh

DMG files are located under OBF_DROP_DIR/openjdk7 OpenJDK7 will be installed under /Library/Java/JavaVirtualMachines/1.7.0u.jdk

To test newly installed OpenJDK :

export JAVA_HOME=/Library/Java/JavaVirtualMachines/1.7.0u.jdk/Contents/Home
mbp-rico:openjdkathome henri$ java -version
openjdk version "1.7.0-u10-b09"
OpenJDK Runtime Environment (build 1.7.0-u10-b09-20121025)
OpenJDK 64-Bit Server VM (build 23.6-b03, mixed mode)