Skip to content

How to build and package OpenJDK 7 on Linux

hgomez edited this page Nov 9, 2012 · 35 revisions

Some pre-requisites are required to build OpenJDK7 on Linux

Build and package pre-requisites

Be sure to have git, mercurial, gcc/g++, make and required libs and some mandatory tools installed. Java 6 or 7 should be installed. Ensure JAVA_HOME env var point to a valid JDK location

openSUSE / SLES

sudo zypper install git-core mercurial zip bzip2 unzip tar 
sudo zypper install ccache make gcc gcc-c++ ca-certificates-cacert ca-certificates-mozilla
sudo zypper install libstdc++-devel alsa-devel cups-devel xorg-x11-devel libjpeg62-devel giflib-devel 
sudo zypper install curl rpm gpg
sudo zypper install java-1_6_0-openjdk-devel (or java-1_7_0-openjdk-devel)

CentOS 5/6

sudo yum install git-core mercurial zip bzip2 unzip tar 
sudo yum install ccache make gcc gcc-c++ libstdc++-devel 
sudo yum install alsa-lib-devel cups-devel libX11-devel libXext-devel libXt-devel libXrender-devel libXtst-devel libXi-devel libjpeg-devel giflib-devel freetype-devel
sudo yum install curl rpm-build gpg
sudo yum install java-1.6.0-openjdk-devel (or java-1.7.0-openjdk-devel)

Fedora 16/17

sudo yum install git-core mercurial zip bzip2 unzip tar 
sudo yum install ccache make gcc gcc-c++ 
sudo yum install libstdc++-devel libstdc++-static alsa-lib-devel cups-devel libX11-devel libXext-devel libXt-devel libXrender-devel libXtst-devel libXi-devel libjpeg-devel giflib-devel freetype-devel 
sudo yum install curl rpm-build gpg rpmbuild rpm-sign
sudo yum install java-1.6.0-openjdk-devel (or java-1.7.0-openjdk-devel)

Prepare environment

For example, you want to build OpenJDKs in openjdkathome directory under your home directory.

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/linux/standalone-job.sh

After some minutes you should see this logs :

#-- Build times ----------
Target all_product_build
Start 2012-11-09 16:33:27
End   2012-11-09 17:46:09
00:04:46 corba
00:29:46 hotspot
00:00:41 jaxp
00:00:53 jaxws
00:35:09 jdk
00:01:27 langtools
01:12:42 TOTAL
-------------------------
make[1]: Leaving directory `/root/openjdkathome/sources/openjdk7'
openjdk version "1.7.0-u12-b01"
OpenJDK Runtime Environment (build 1.7.0-u12-b01-20121109)
OpenJDK 64-Bit Server VM (build 24.0-b24, mixed mode)
openjdk version "1.7.0-u12-b01"
OpenJDK Runtime Environment (build 1.7.0-u12-b01-20121109)
OpenJDK 64-Bit Server VM (build 24.0-b24, mixed mode)

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

ls -l OBF_DROP_DIR/openjdk7
total 276092
-rw-r--r-- 1 root root 124458037 Nov  9 17:47 j2re-image-x86_64.tar.bz2
-rw-r--r-- 1 root root 157968523 Nov  9 17:47 j2sdk-image-x86_64.tar.bz2

Images tarballs