ikvmnet / ikvm

A Java Virtual Machine and Bytecode-to-IL Converter for .NET
Other
1.15k stars 109 forks source link

Native AWT #528

Closed wasabii closed 1 month ago

wasabii commented 1 month ago

New native libraries: libawt, libawt_headless, libawt_lwawt, libawt_xawt, libfontmanager, libfreetype, libjawt, libjnf, libjpeg, liblcms, libmlib_image, libosxui.

Notable:

libawt is the basic AWT library. The Windows version has the full implementation contained in it. On Linux, minor parts are included in libawt, and libawt_xawt or libawt_headless are loaded depending on whether in headless mode or not. On OSX libawt_lwawt is used.

Font support is done using freetype. This library is distributed with IKVM for Windows and OS X, but the Linux version relies on the platform freetype being present and linkable.

We are using static fontconfig files from Windows on each OS for now. This can be fixed later, but the files need to be generated at build time from templates.

Local imageio/jpeg stuff is removed. Replaced with libjpeg. The entirety of the peices of local AWT stuff are gone.

LoadLibrary now inherits the caller ID. This needs more review: I think we can use the complete LoadLibrary implementation in native code now to replace all this. But more research should be done.

mlib_image is a static library, and ends up embedded into the other deps.

OSX uses a Framework named JavaNativeFoundation. This does not exist on arm64, which seems to be the main reason JDK8 isn't available for newer Macs natively. JNF however was open sourced. We incorporate this source for ARM64 only. Still uses built in version for x64. Another Framework, JavaRuntimeSupport, is missing a method, which we implement as a DEFINE that points to an inline version.