RFR: 8255240: Mobile builds need to exclude some modules [v3]

Johan Vos jvos at openjdk.java.net
Tue Nov 3 13:58:58 UTC 2020


On Tue, 3 Nov 2020 00:33:36 GMT, Magnus Ihse Bursie <ihse at openjdk.org> wrote:

>> Good news! It turned out that java.desktop can build just fine without X11 if you just want headless. 
>> 
>> A quick and dirty hack to confirm that this works for you too:
>> diff --git a/make/autoconf/libraries.m4 b/make/autoconf/libraries.m4
>> index 5120918aed2..42a641c3228 100644
>> --- a/make/autoconf/libraries.m4
>> +++ b/make/autoconf/libraries.m4
>> @@ -46,7 +46,7 @@ AC_DEFUN_ONCE([LIB_DETERMINE_DEPENDENCIES],
>>    else
>>      # All other instances need X11, even if building headless only, libawt still
>>      # needs X11 headers.
>> -    NEEDS_LIB_X11=true
>> +    NEEDS_LIB_X11=false
>>    fi
>>  
>>    # Check if fontconfig is needed
>> 
>> I'll open a separate bug to get a fix in mainline so that X11 is not required for headless builds.
>
> See. https://bugs.openjdk.java.net/browse/JDK-8255785

Thanks for the suggestion.
`NEEDS_LIB_X11` was already false for ios/android (same file, in the if clause) but there were a few places where an X11 header was still required. I could easily fix those, but there are more issues when building libawt.a. For example, font.c relies on fontconfig/fontconfig.h which we don't have on android.
Actually, the whole font handling is something that is already done in JavaFX (in OpenJFX), and for Android we leverage freetype. 
I'm a bit puzzled, as I think it would be a huge overkill to somehow port the font code from OpenJDK to android, but never using it as it is already done in OpenJFX. 
Another area is the dependency on X11 in the java2d/opengl/J2D_GL files.

To me, it seems the main issue is that I don't think this code belongs in the core of OpenJDK.

-------------

PR: https://git.openjdk.java.net/mobile/pull/10


More information about the mobile-dev mailing list