本文包括4部分内容:
1.基本流程(阅读README和README-builds.html)
2.安装基础软件包
3.配置变量
4.检查环境是否配置ok与编译jdk源码
下载源码openjdk-7u6-fcs-src-b24-28_aug_2012.zip,解压
基本流程(阅读README和README-builds.html)
README-builds.html中包含有详细的安装信息,最好能完整的阅读一下。
———README——–
Simple Build Instructions:
0.Get the necessary system software/packages installed on your system, see
http://hg.openjdk.java.net/jdk7/build/raw-file/tip/README-builds.html
1.If you don’t have a jdk6 installed, download and install a JDK 6 from
http://java.sun.com/javase/downloads/index.jsp
Set the environment variable ALT_BOOTDIR to the location of JDK 6.
2.Check the sanity of doing a build with your current system:
make sanity
See README-builds.html if you run into problems.
3.Do a complete build of the OpenJDK:
make all
The resulting JDK image should be found in build/*/j2sdk-image
———-README-builds.html———
Basic Linux Check List
Install the Bootstrap JDK, set ALT_BOOTDIR.
Optional Import JDK, set ALT_JDK_IMPORT_PATH.
Install or upgrade the FreeType development package.
Install Ant 1.7.1 or newer, make sure it is in your PATH.
CentOS 5.5
After installing CentOS 5.5 you need to make sure you have the following Development bundles installed:
Development Libraries
Development Tools
Java Development
X Software Development (Including XFree86-devel)
Plus the following packages:
cups devel: Cups Development Package
alsa devel: Alsa Development Package
ant: Ant Package
Xi devel: libXi.so Development Package
The freetype 2.3 packages don’t seem to be available, but the freetype 2.3 sources can be downloaded, built, and installed easily enough from the freetype site. Build and install with something like:
1 | ./configure && make && sudo -u root make install |
(注意:Version 2.3 or newer of FreeType is required for building the OpenJDK.) =》freetype的版本至少为2.3或更新
Mercurial packages could not be found easily, but a Google search should find ones, and they usually include Python if it’s needed.
注意:
(1).All OpenJDK builds require access to least Ant 1.7.1.(ant的版本至少为1.7.1)
(2).Linux only: Version 0.9.1 or newer of the ALSA files are required for building the OpenJDK on Linux.
安装基础软件包
我的centos6安装在vmware Fusion上,安装时使用最小化(Minimal)安装
1 | [root@vm-pc ~]# cat /etc/redhat-release |
执行下面命令
1 |
|
如果安装时出现如下错误,则执行
mkdir -p /usr/local/include/freetype2/freetype/internal
make install
rmdir /usr/local/include/freetype2/freetype/internal
rmdir: failed to remove `/usr/local/include/freetype2/freetype/internal’: No such file or directory
make: [install] Error 1 (ignored)
/usr/bin/install -c -m 644 ./builds/unix/ft2unix.h
/usr/local/include/ft2build.h
/usr/bin/install -c -m 644 ./builds/unix/ftconfig.h
/usr/local/include/freetype2/freetype/config/ftconfig.h
1 |
|
检查java与ant
1 | [root@vm-pc ~]# java -version |
配置变量
1 | unset CLASSPATH |
检查环境是否配置OK与编译jdk源码
1 | [root@vm-pc openjdk]# pwd |
Sanity check passed. #表示ok了
1 | [root@vm-pc openjdk]# make all ARCH_DATA_MODEL=64 ALLOW_DOWNLOADS=true |
查看劳动成果
1 | [root@vm-pc openjdk]# ./build/linux-amd64/bin/java -version |
附:安装install_jdk.sh脚本
1 | #!bin/bash |