Join GitHub today
GitHub is home to over 50 million developers working together to host and review code, manage projects, and build software together.Sign up
boot/gui: Use libffi rather than bespoke bindings #149
This is a mostly transparent change.
This uses the updated
Why make this change if it changes nothing? To reduce the surface of mistakes. I am not a C developer. Probably always be uneasy writing C. Some bits of the bindings already were iffy.
The only bit I'm not happy with, but I am satisfied with, is the struct bindings. Fiddle does not have a way to describe nested structs. (Neither does the ruby mainline Fiddle.) LVGL uses nested structs for styles. To work around the issue, accessor functions in C have been generated. It's not clean, but it's working in a correct manner, which for the best.
It already was an issue with the previous bindings, and still is with the Fiddle-based bindings, there is no proper deallocation / destruction for LVGL objects. Not much of an issue for what can be called "short lived applications", but still something to get fixed for correctness in the future.
But still, why? The code worked, and seemingly was right. Let's gloss over "seemingly", and go to a more useful reason. Using FFI bindings, rather than relying on a spaghetti mess of generated code for bespoke bindings, should allow us to more easily implement the missing functionality from LVGL, and doing it correctly.
Furthermore, having everything prepared for FFI bindings gives us freedom for non-LVGL related things. The
Other notable changes
The initrd doesn't use
This doesn't bloat the initrd, compressed or not. The compressed boot image for
The main space consumer is systemd libraries, used by udev, which already were using "normal" glibc builds, so this is why there is no bloating; everything pretty much already was in there.
Bindings to libffi, with (approximatively) the same API as the Ruby Fiddle stdlib. This uses a fork with fixes, and hopefully improvements and maintainership in the future.
This ends up saving ~100KiB. Not much, but we're already 1MiB over the ~7-8 MiB budget. Though, in reality, it's not for the space saving, but because dlopen/dlsym will be needed for ffi-based bindings.
Main changes are: * Dynamic build support * Minimal introspection * "better" makefile which handles the .pc file