Use --target-glib or check for gobject-2.0 in --pkg list instead of using --profile in the command line interface
Looking through some of the recent commits that are making really good progress in allowing Vala to compile without GLib, I notice a lot of the code uses the idiom of if (context.profile == Profile.GOBJECT) {}
. This made made me think of the following user interface:
valac my_program.vala
would compile as we think of as normal at present. So with all the GLib types.
valac my_program.vala --nostdpkg --pkg basic-types-libc
would compile for 'standard' C.
valac my_program.vala --nostdpkg --pkg glib-2.0 --pkg gobject-2.0 --target-glib 2.40
would be the equivalent of valac my_program.vala
.
--target-glib
would be the switch to activate the GOBJECT code in the compiler.
Without it Vala would target standard C. The problem with POSIX as a profile is it is a superset of the standard C library and there are platforms that people may want to target, like Windows and microcontrollers, that are not POSIX compliant.
I understand Meson may pass the --nostdpkg switch by default. In that case it may be better to have the Vala compiler check the package list passed and if it contains 'gobject-2.0' to enable the GOBJECT code generation.