~lattis/muon#103: 
Implement 'gnome' module

Hi, i would like to ask if it is possible for partial or simple support of the 'gnome' module? particularly functions such as mkenums and genmarshal? these methods are required by big projects such as glib, gtk, etc. and are the final step to make a linux environment fully with muon.

I have attempted to make 'genmarshal's here in a paste (https://kitten.pastes.sh/gnome-muon.diff) but i have given up shortly after, as i do not have much experience with muon's code and routines.

For a short introduction for what these methods do, they are merely 'execute a command with concatenated arguments from the function argument':

-gdkpixbuf_marshals = gnome.genmarshal('gdk-pixbuf-marshal',
-                                      sources: 'gdk-pixbuf-marshal.list',
-                                      prefix: '_gdk_pixbuf_marshal',
-                                      install_header: true,
-                                      install_dir: join_paths(gdk_pixbuf_includedir, gdk_pixbuf_api_path))
-
-gdkpixbuf_enums = gnome.mkenums('gdk-pixbuf-enum-types',
-                                sources: gdkpixbuf_headers,
-                                c_template: 'gdk-pixbuf-enum-types.c.template',
-                                h_template: 'gdk-pixbuf-enum-types.h.template',
-                                install_header: true,
-                                install_dir: join_paths(gdk_pixbuf_includedir, gdk_pixbuf_api_path))
-gdkpixbuf_enum_h = gdkpixbuf_enums[1]
+gdkpixbuf_marshals = []
+gdkpixbuf_marshals += custom_target('gdb-pixbuf-marshal_h',
+  output: 'gdk-pixbuf-marshal.h',
+  input: 'gdk-pixbuf-marshal.list',
+  install: true,
+  install_dir: join_paths(gdk_pixbuf_includedir, gdk_pixbuf_api_path),
+  command: [
+    find_program('glib-genmarshal'),
+    '--prefix=_gdk_pixbuf_marshal',
+    '--output=@OUTPUT@',
+    '--quiet',
+    '--header',
+    '@INPUT@',
+  ],
+)
+
+gdkpixbuf_marshals += custom_target('gdb-pixbuf-marshal_c',
+  output: 'gdk-pixbuf-marshal.c',
+  input: 'gdk-pixbuf-marshal.list',
+  command: [
+    find_program('glib-genmarshal'),
+    '--prefix=_gdk_pixbuf_marshal',
+    '--include-header=gdk-pixbuf-marshal.h',
+    '--output=@OUTPUT@',
+    '--quiet',
+    '--body',
+    '@INPUT@',
+  ],
+)
+
+gdkpixbuf_enums = []
+gdkpixbuf_enums += custom_target('gdk-pixbuf-enum-types_h',
+  capture: true,
+  output: 'gdk-pixbuf-enum-types.h',
+  input: gdkpixbuf_headers,
+  install: true,
+  install_dir: join_paths(gdk_pixbuf_includedir, gdk_pixbuf_api_path),
+  command: [
+    find_program('glib-mkenums'),
+    '--template', files('gdk-pixbuf-enum-types.h.template'),
+    '@INPUT@',
+  ],
+)
+
+gdkpixbuf_enums += custom_target('gdk-pixbuf-enum-types_c',
+  capture: true,
+  output: 'gdk-pixbuf-enum-types.c',
+  input: gdkpixbuf_headers,
+  command: [
+    find_program('glib-mkenums'),
+    '--template', files('gdk-pixbuf-enum-types.c.template'),
+    '@INPUT@',
+  ],
+)
+
+gdkpixbuf_enum_h = gdkpixbuf_enums[0]

Which sounded easy for me, but i am inexperienced with the codebase.

Many thanks.

Status
REPORTED
Submitter
~sewn
Assigned to
No-one
Submitted
6 months ago
Updated
5 months ago
Labels
No labels applied.

~lattis 6 months ago

Hello, I am actually almost done with an experimental feature that would allow you to write modules in the meson dsl. It would look something like this:

# in src/script/modules/gnome.meson

func genmarshal(name, sources:, prefix:, install_header: ,install_dir:)
    return [
         custom_target(name ...),
    ]
endfunc

(For anyone reading this worried about user defined functions: don't worry, you can't define functions in regular meson.build files)

I can update this todo once the script-module feature is in master.

~sewn 6 months ago

On Mon Nov 27, 2023 at 8:33 PM +03, ~lattis wrote:

Hello, I am actually almost done with an experimental feature that would allow you to write modules in the meson dsl.

Thanks alot! this is exactly what i had in mind while i was writing the modules, i was thinking 'man, if i could directly write this in meson, this would be alot better'...

~lattis 5 months ago

~sewn: Hello, I think the script module system is getting close to mergeable. I was wondering if you'd be interested in trying to write parts of the gnome module in the new system to see if it the design is okay. If so, you'd need to check out the script-modules branch and add a new file src/script/modules/gnome.meson (you can refer to https://git.sr.ht/~lattis/muon/tree/script-modules/item/src/script/modules/_test.meson for the allowed syntax / features). You also need to modify src/script/meson.build to tell muon about your new module. After that you should be able to include('gnome') and call functions on it.

Register here or Log in to comment, or comment via email.