Commit 98e633f6 authored by Tim-Philipp Müller's avatar Tim-Philipp Müller Committed by Emmanuele Bassi
Browse files

meson: gtk: use gnome.mkenums() and gnome.genmarshal()

parent 07ffb19c
#!/usr/bin/env python3
# This is in its own file rather than inside meson.build
# because a) mixing the two is ugly and b) trying to
# make special characters such as \n go through all
# backends is a fool's errand.
import sys, os, shutil, subprocess
# [perl, glib-mkenums]
cmd = [sys.argv[1], sys.argv[2]]
template = sys.argv[3]
ofilename = sys.argv[4]
headers = sys.argv[5:]
arg_array = ['--template', template];
pc = subprocess.Popen(cmd + arg_array + headers, stdout=subprocess.PIPE)
(stdo, _) = pc.communicate()
if pc.returncode != 0:
sys.exit(pc.returncode)
open(ofilename, 'wb').write(stdo)
#!/usr/bin/env python3
# This is in its own file rather than inside meson.build
# because a) mixing the two is ugly and b) trying to
# make special characters such as \n go through all
# backends is a fool's errand.
import sys, os, shutil, subprocess
# [genmarshal, prefix, infile, outfile]
cmd = [sys.argv[1]]
prefix = sys.argv[2]
ifilename = sys.argv[3]
ofilename = sys.argv[4]
h_array = ['--prefix=' + prefix, '--header', '--valist-marshallers']
c_array = ['--prefix=' + prefix, '--body', '--valist-marshallers']
if ofilename.endswith('.h'):
arg_array = h_array
else:
arg_array = c_array
pc = subprocess.Popen(cmd + [ifilename] + arg_array, stdout=subprocess.PIPE)
(stdo, _) = pc.communicate()
if pc.returncode != 0:
sys.exit(pc.returncode)
open(ofilename, 'wb').write(stdo)
......@@ -650,60 +650,35 @@ gtk_dbus_src = gnome.gdbus_codegen('gtkdbusgenerated', 'gtkdbusinterfaces.xml',
interface_prefix: 'org.Gtk.',
namespace: '_Gtk')
gtkmarshal_h = custom_target(
'gtkmarshal_h',
output : 'gtkmarshalers.h',
input : 'gtkmarshalers.list',
command : [mkmarshal, glib_marshal, '_gtk_marshal', '@INPUT@', '@OUTPUT@']
)
gtkmarshalers = gnome.genmarshal('gtkmarshalers',
sources : 'gtkmarshalers.list',
prefix : '_gtk_marshal',
valist_marshallers : true)
gtkmarshal_c = custom_target(
'gtkmarshal_c',
output : 'gtkmarshalers.c',
input : 'gtkmarshalers.list',
command : [mkmarshal, glib_marshal, '_gtk_marshal', '@INPUT@', '@OUTPUT@']
)
gtkmarshal_h = gtkmarshalers[1]
gtktypebuiltins_h = custom_target(
'gtkypebuiltins_h',
output : 'gtktypebuiltins.h',
input : gtk_public_headers + gtk_deprecated_headers,
command : [mkenum, perl, glib_mkenums, meson.current_source_dir() + '/gtktypebuiltins.h.template', '@OUTPUT@', '@INPUT@'],
install: true,
install_dir: 'include/gtk-4.0/gtk/'
)
gtktypebuiltins = gnome.mkenums('gtktypebuiltins',
sources: gtk_public_headers + gtk_deprecated_headers,
c_template : 'gtktypebuiltins.c.template',
h_template : 'gtktypebuiltins.h.template',
install_dir : 'include/gtk-4.0/gtk',
install_header : true)
gtktypebuiltins_c = custom_target(
'gtkypebuiltins_c',
output : 'gtktypebuiltins.c',
input : gtk_public_headers + gtk_deprecated_headers,
depends : gtktypebuiltins_h,
command : [mkenum, perl, glib_mkenums, meson.current_source_dir() + '/gtktypebuiltins.c.template', '@OUTPUT@', '@INPUT@']
)
gtktypebuiltins_h = gtktypebuiltins[1]
gtkprivatetypebuiltins_h = custom_target(
'gtkprivateypebuiltins_h',
output : 'gtkprivatetypebuiltins.h',
input : gtk_private_type_headers,
command : [mkenum, perl, glib_mkenums, meson.current_source_dir() + '/gtkprivatetypebuiltins.h.template', '@OUTPUT@', '@INPUT@']
)
gtkprivatetypebuiltins = gnome.mkenums('gtkprivatetypebuiltins',
sources: gtk_private_type_headers,
c_template : 'gtkprivatetypebuiltins.c.template',
h_template : 'gtkprivatetypebuiltins.h.template')
gtkprivatetypebuiltins_c = custom_target(
'gtkprivateypebuiltins_c',
output : 'gtkprivatetypebuiltins.c',
input : gtk_private_type_headers,
depends : [gtkprivatetypebuiltins_h, gtktypebuiltins_h],
command : [mkenum, perl, glib_mkenums, meson.current_source_dir() + '/gtkprivatetypebuiltins.c.template', '@OUTPUT@', '@INPUT@']
)
gtkprivatetypebuiltins_h = gtkprivatetypebuiltins[1]
gentypefuncs_prog = find_program('gentypefuncs.py')
# Generate gtktypefuncs.inc
typefuncs = custom_target(
'typefuncs',
typefuncs = custom_target('gtktypefuncs.inc',
depends: gdkenum_h,
output : 'gtktypefuncs.inc',
input : gdk_headers + gtk_public_headers + gtk_deprecated_headers + gtk_private_headers + [gtktypebuiltins_h] + [gdkenum_h],
command: [gentypefuncs_prog, '@OUTPUT@', '@INPUT@'],
command: [find_program('gentypefuncs.py'), '@OUTPUT@', '@INPUT@'],
install: false,
)
......@@ -740,9 +715,9 @@ gtk_sources += [
inspector_sources,
a11y_sources,
gtkresources,
gtkmarshal_c,
gtkprivatetypebuiltins_c,
gtktypebuiltins_c,
gtkmarshalers,
gtkprivatetypebuiltins,
gtktypebuiltins,
]
gtk_deps = [
......@@ -801,7 +776,6 @@ libgtk_dep = declare_dependency(
sources: [
'gtk.h',
gtkversion,
gtktypebuiltins_c,
gtktypebuiltins_h,
],
include_directories: [confinc],
......
......@@ -40,12 +40,6 @@ mir_enabled = get_option('enable-mir-backend')
quartz_enabled = false # FIXME
win32_enabled = false # FIXME
mkmarshal = find_program('build_marshal.py')
glib_marshal = find_program('glib-genmarshal')
mkenum = find_program('build_enum.py')
perl = find_program('perl')
glib_mkenums = find_program('glib-mkenums')
os_unix = false
os_linux = false
os_win32 = false
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment