Re: icedtea6 bootstrap

"Alon Bar-Lev" <[email protected]> Mon, 15 Sep 2008 08:08:08 +0300
Newsgroups gmane.linux.gentoo.java
Message-ID <[email protected]>
On 9/15/08, Alon Bar-Lev <[email protected]> wrote:
>  > Well this is probably a flaw in portage then, but the solution is only
>  >  a two-step emerge process:
>  >
>  >  emerge gcj-jdk
>  >  emerge icedtea6
>  >
>  >  I don't think that's inherently difficult.
>
>
> You forgot:
>  java-config -S icedtea6
>  emerge --unmerge gcj-jdk

And on a second thought... You need also add the gcj USE flag to gcc,
reemerge gcc, then at the end remove the gcj USE flag from gcc and
reemerge gcc.

So it is much more complex.

So basically, provided that >=gcc-4.3 is stable, this is the outline
of what I thought, you can make it more efficient if you check for
other valid jdks and not force only gcj...

if installed icedtea6; then
    exit 0
fi
if ! has_use gcc gcj; then
    should_remove_gcj_use_from_gcc=1
    USE="gcj" emerge --oneshot gcc || die
fi
if ! installed gcj-jdk; then
    should_remove_gcj_jdk=1
    emerge --oneshot gcj-jdk || die
fi
old_java=$(java-config -f)
java-config -S gcj-jdk || die
emerge icedtea6 || die
if [ ${old_java}" = "gcj-jdk" -a -n "${should_remove_gcj_jdk}" ]; then
    java-config -S icedtea6 || die
else
    java-config -S $(old_java) || die
fi
[ -n "${should_remove_gcj_jdk}" ] && emerge --unmerge gcj-jdk
[ -n "${should_remove_gcj_use_from_gcc}" ] && emerge --oneshot gcc

exit 0