9/09/2014

Fix Java font smoothing on Ubuntu: re-building OpenJDK from sources with Infinality patches

OpenJDK7

First we need to install some pre-requisities:
sudo apt-get install libasound2-dev libcups2-dev libfreetype6-dev gawk g++ libxext-dev libxrender-dev libxtst-dev libfontconfig1-dev mercurial openjdk-6-jdk

export LANG=C ALT_BOOTDIR=/usr/lib/jvm/java-6-openjdk-amd64
Getting the sources:
cd ~/tools
mkdir jdk7u60
cd jdk7u60
hg clone http://hg.openjdk.java.net/jdk7u/jdk7u60 forest
cd forest
sh ./get_source.sh
Patching fonts with Infinality:
cd ~
git clone https://gist.github.com/2893461.git
mv 2893461/fontfix.patch ~/tools/jdk7u60/forest/jdk/
cd ~/tools/jdk7u60/forest/jdk/
patch -p1 < fontfix.patch
The actual build:
cd ~/tools/jdk7u60/forest
. jdk/make/jdk_generic_profile.sh
#make ALLOW_DOWNLOADS=true fastdebug_build
make all
Verifying:
build/linux-amd64-fastdebug/j2sdk-image/bin/java -version

In case you get java.lang.RuntimeException: time is more than 10 years from present: 1104530400000

Try this:

cd ~/tools/jdk7u60/forest/jdk/
wget http://hg.openjdk.java.net/jdk7u/jdk7u/jdk/raw-rev/74a70385c21d
patch -p1 < 74a70385c21d

OpenJDK6

sudo apt-get install libasound2-dev libcups2-dev libfreetype6-dev gawk g++ libxext-dev libxrender-dev libxtst-dev libfontconfig1-dev mercurial openjdk-6-jdk libmotif-dev
export LANG=C ALT_BOOTDIR=/usr/lib/jvm/java-6-openjdk-amd64
cd ~/tools
mkdir jdk6
cd jdk6
hg clone http://hg.openjdk.java.net/jdk6/jdk6 forest
cd forest
sh ./get_source.sh
cd ~
git clone https://gist.github.com/2893461.git
mv 2893461/fontfix.patch ~/tools/jdk6/forest/jdk/
rm -rf 2893461
cd ~/tools/jdk6/forest/jdk/
patch -p1 < fontfix.patch
cd ~/tools/jdk6/forest
. jdk/make/jdk_generic_profile.sh
make all

OpenJDK8

cd ~/tools
mkdir jdk8
cd jdk8
hg clone http://hg.openjdk.java.net/jdk8/jdk8 forest
cd forest
sh ./get_source.sh
cd ~
git clone https://gist.github.com/2893461.git
mv 2893461/fontfix.patch ~/tools/jdk8/forest/jdk/
rm -rf 2893461
cd ~/tools/jdk8/forest/jdk/
patch -p1 < fontfix.patch
cd ~/tools/jdk8/forest
chmod +x configure
./configure
make all

Reference:

http://mail-index.netbsd.org/pkgsrc-users/2014/12/30/msg020846.html

No comments:

Post a Comment