--- /usr/portage/dev-java/icedtea/icedtea-6.1.9.1.ebuild	2010-11-26 23:35:36.000000000 +0100
+++ icedtea-6.1.8.0.ebuild	2010-12-19 12:13:01.078894291 +0100
@@ -166,13 +166,14 @@
 
 src_configure() {
 	local config procs rhino_jar
+	local openjdk_libdir=$(java-config -O|sed "s:/lib/:/$(get_libdir)/:g")
 	local vm=$(java-pkg_get-current-vm)
-	local vmhome="/usr/lib/jvm/${vm}"
+	local vmhome="/usr/$(get_libdir)/jvm/${vm}"
 
 	# IcedTea6 can't be built using IcedTea7; its class files are too new
 	if [[ "${vm}" == "icedtea6" ]] || [[ "${vm}" == "icedtea6-bin" ]] ; then
 		# If we are upgrading icedtea, then we don't need to bootstrap.
-		config="${config} --with-openjdk=$(java-config -O)"
+		config="${config} --with-openjdk=${openjdk_libdir}"
 	elif [[ "${vm}" == "gcj-jdk" || "${vm}" == "cacao" ]] ; then
 		# For other 1.5 JDKs e.g. GCJ, CACAO.
 		config="${config} --with-ecj-jar=/usr/share/eclipse-ecj/ecj.jar" \
@@ -239,18 +240,23 @@
 
 	# Paludis does not respect unset from src_configure
 	unset_vars
+
+	local arch=${ARCH}
+	( [[ ${ABI} == x86 ]] || use x86 ) && arch=i586
 	emake -j 1  || die "make failed"
 }
 
 src_install() {
-	local dest="${ROOT}usr/$(get_libdir)/icedtea${SLOT}"
+	local dest="/usr/$(get_libdir)/icedtea${SLOT}"
 	local ddest="${D}/${dest}"
 	dodir "${dest}" || die
 
+	local arch=${ARCH}
+	( [[ ${ABI} == x86 ]] || use x86 ) && arch=i586
+
 	dodoc README NEWS AUTHORS THANKYOU || die
-	dosym "${ROOT}usr/share/doc/${PF}" "${ROOT}usr/share/doc/${PN}${SLOT}"
 
-	cd "${S}/openjdk.build/j2sdk-image" || die
+	cd "${S}/openjdk/build/linux-${arch}/j2sdk-image" || die
 
 	if use doc ; then
 		# java-pkg_dohtml needed for package-list #302654
@@ -277,8 +283,7 @@
 	find "${ddest}" \! -type l \( -perm /111 -exec chmod 755 {} \; -o -exec chmod 644 {} \; \) || die
 
 	if use nsplugin; then
-		local arch=${ARCH};
-		use x86 && arch=i386;
+		( [[ ${ABI} == x86 ]] || use x86 ) && arch=i386;
 		install_mozilla_plugin "${dest}/jre/lib/${arch}/IcedTeaPlugin.so";
 	fi