Building Android on Gentoo

Ok, it is generally best practice to use Ubuntu  for building android but if you are a Gentoo fan and don’t want to mess with a vm you’ll have to bypass some bumps first.

So let’s start. Firstly you need sun-jdk6. icedtea-jdk won’t do the trick. So let’s get sun-jdk6 firstly. I’m going to just pass the commands you need and it should be self explanatory if you know what you are doing.

Download java and put it at /usr/portage/distfiles/

su-
cd /usr/portage/distfiles
wget http://uni-smr.ac.ru/archive/dev/java/SDKs/sun/j2se/6/jdk-6u45-linux-x64.bin

Then copy paste the exact same lines as below to auto-accept all licenses.


cat >> /etc/make.conf <<END
ACCEPT_LICENSE="*"
EMERGE_DEFAULT_OPTS="${EMERGE_DEFAULT_OPTS} --autounmask=n"
END

Then let’s unmask sun-jdk. It’s masked for security reason but we really need this. So edit  package.unmask with your favorite editor ( vi /etc/portage/package.unmask ) and add at the bottom


=dev-java/sun-jdk-1.6.0.45

Ok we’re ready let’s emerge


emerge dev-java/sun-jdk

After you’ve done select the appropriate package by issuing


java-config --set-system-vm sun-jdk-1.6

Afterwards let’s emerge all the packages we need to compile android.


emerge git app-crypt/gnupg flex bison gperf libsdl wxGTK squashfs-tools curl ncurses zlib schedtool perl-Switch zip unzip emul-linux-x86-baselibs emul-linux-x86-compat emul-linux-x86-cpplibs

You should be all done expect one last thing. repo sync etc. and before you start your build goto core/config.mk and comment out the following lines.


+#ifeq ($(wildcard $(HOST_JDK_TOOLS_JAR)),)
+#$(error Error: could not find jdk tools.jar, please install JDK6, \
+#    which you can download from <a href="http://java.sun.com" target="_blank">java.sun.com</a>)
+#endif

You are good to go! Happy android building!

Advertisements

#android, #building, #endif, #gentoo, #ifeq, #requires_openjdk, #sun-jdk