mirror of https://github.com/GNOME/gimp.git
Issue #8145: meson: generation of '*-enums.c' files.
Our meson build system was not properly building the enums.c file, because they are versionned. I did a similar trick as what I did for the pdbgen, which is that I used a wrapper script around the existing perl script, which sets proper options and generate a stamp file in the end (which is considered by meson as the actual custom target, not the C file since it is generated in the source dir). The most important part is that the stamp file is a generated header source (not just a random text file) which is **included** by the generated C file. This is what will force meson to regenerate the C file if the header is updated, **then** build using this new version, not use an outdated versionned version (which would make for hard to diagnose bugs), through the indirection of the intermediate stamp header. See #4201. See also: https://github.com/mesonbuild/meson/issues/10196#issuecomment-1080742592
This commit is contained in:
parent
f22b82f22f
commit
106f2a061d
|
@ -1,18 +1,20 @@
|
|||
|
||||
appconfigenums = custom_target('config-enums.c',
|
||||
input : [ 'config-enums.h', ],
|
||||
output: [ 'config-enums.c', ],
|
||||
command: [
|
||||
gimp_mkenums,
|
||||
'--fhead','#include "config.h"\n'
|
||||
+ '#include <gio/gio.h>\n'
|
||||
+ '#include "libgimpbase/gimpbase.h"\n'
|
||||
+ '#include "@basename@"\n'
|
||||
+ '#include "gimp-intl.h"\n',
|
||||
app_mkenums_custom_target_commonargs,
|
||||
'@INPUT@',
|
||||
stamp_config_enums = custom_target('stamp-config-enums.h',
|
||||
input : [
|
||||
files(
|
||||
'config-enums.h'
|
||||
),
|
||||
],
|
||||
capture: true,
|
||||
output: [ 'stamp-config-enums.h', ],
|
||||
command: [
|
||||
mkenums_wrap, perl,
|
||||
meson.source_root(), meson.current_source_dir(),
|
||||
meson.current_build_dir(),
|
||||
'config-',
|
||||
'#include <gio/gio.h>\n' +
|
||||
'#include "libgimpbase/gimpbase.h"\n',
|
||||
'#include "gimp-intl.h"'
|
||||
],
|
||||
build_by_default: true
|
||||
)
|
||||
|
||||
libappconfig_sources = [
|
||||
|
@ -32,7 +34,9 @@ libappconfig_sources = [
|
|||
'gimprc-unknown.c',
|
||||
'gimprc.c',
|
||||
'gimpxmlparser.c',
|
||||
appconfigenums,
|
||||
|
||||
'config-enums.c',
|
||||
stamp_config_enums,
|
||||
]
|
||||
|
||||
libappconfig = static_library('appconfig',
|
||||
|
|
|
@ -1,17 +1,20 @@
|
|||
appcoreenums = custom_target('core-enums',
|
||||
input : [ 'core-enums.h', ],
|
||||
output: [ 'core-enums.c', ],
|
||||
command: [
|
||||
gimp_mkenums,
|
||||
'--fhead','#include "config.h"\n'
|
||||
+ '#include <gio/gio.h>\n'
|
||||
+ '#include "libgimpbase/gimpbase.h"\n'
|
||||
+ '#include "@basename@"\n'
|
||||
+ '#include "gimp-intl.h"\n',
|
||||
app_mkenums_custom_target_commonargs,
|
||||
'@INPUT@',
|
||||
stamp_core_enums = custom_target('stamp-core-enums.h',
|
||||
input : [
|
||||
files(
|
||||
'core-enums.h'
|
||||
),
|
||||
],
|
||||
capture: true,
|
||||
output: [ 'stamp-core-enums.h', ],
|
||||
command: [
|
||||
mkenums_wrap, perl,
|
||||
meson.source_root(), meson.current_source_dir(),
|
||||
meson.current_build_dir(),
|
||||
'core-',
|
||||
'#include <gio/gio.h>\n' +
|
||||
'#include "libgimpbase/gimpbase.h"\n',
|
||||
'#include "gimp-intl.h"'
|
||||
],
|
||||
build_by_default: true
|
||||
)
|
||||
|
||||
appcoremarshal = gnome.genmarshal('gimpmarshal',
|
||||
|
@ -20,8 +23,6 @@ appcoremarshal = gnome.genmarshal('gimpmarshal',
|
|||
install_header: false,
|
||||
)
|
||||
|
||||
|
||||
|
||||
libappcore_sources = [
|
||||
'gimp-atomic.c',
|
||||
'gimp-batch.c',
|
||||
|
@ -250,7 +251,10 @@ libappcore_sources = [
|
|||
'gimpunit.c',
|
||||
'gimpviewable.c',
|
||||
'gimpwaitable.c',
|
||||
appcoreenums,
|
||||
|
||||
'core-enums.c',
|
||||
stamp_core_enums,
|
||||
|
||||
appcoremarshal,
|
||||
cursors_sources,
|
||||
pickers_sources,
|
||||
|
|
|
@ -1,18 +1,20 @@
|
|||
|
||||
appdisplayenums = custom_target('display-enums.c',
|
||||
input : [ 'display-enums.h', ],
|
||||
output: [ 'display-enums.c', ],
|
||||
command: [
|
||||
gimp_mkenums,
|
||||
'--fhead','#include "config.h"\n'
|
||||
+ '#include <gio/gio.h>\n'
|
||||
+ '#include "libgimpbase/gimpbase.h"\n'
|
||||
+ '#include "@basename@"\n'
|
||||
+ '#include "gimp-intl.h"\n',
|
||||
app_mkenums_custom_target_commonargs,
|
||||
'@INPUT@',
|
||||
stamp_display_enums = custom_target('stamp-display-enums.h',
|
||||
input : [
|
||||
files(
|
||||
'display-enums.h'
|
||||
),
|
||||
],
|
||||
capture: true,
|
||||
output: [ 'stamp-display-enums.h', ],
|
||||
command: [
|
||||
mkenums_wrap, perl,
|
||||
meson.source_root(), meson.current_source_dir(),
|
||||
meson.current_build_dir(),
|
||||
'display-',
|
||||
'#include <gio/gio.h>\n' +
|
||||
'#include "libgimpbase/gimpbase.h"\n',
|
||||
'#include "gimp-intl.h"'
|
||||
],
|
||||
build_by_default: true
|
||||
)
|
||||
|
||||
libappdisplay_sources = [
|
||||
|
@ -103,7 +105,10 @@ libappdisplay_sources = [
|
|||
'gimptooltransformgrid.c',
|
||||
'gimptoolwidget.c',
|
||||
'gimptoolwidgetgroup.c',
|
||||
appdisplayenums,
|
||||
|
||||
'display-enums.c',
|
||||
stamp_display_enums,
|
||||
|
||||
gitversion_h,
|
||||
|
||||
appcoremarshal[1],
|
||||
|
|
|
@ -1,19 +1,21 @@
|
|||
|
||||
appgeglenums = custom_target('gimp-gegl-enums.c',
|
||||
input : [ 'gimp-gegl-enums.h', ],
|
||||
output: [ 'gimp-gegl-enums.c', ],
|
||||
command: [
|
||||
gimp_mkenums,
|
||||
'--fhead','#include "config.h"\n'
|
||||
+ '#include <gio/gio.h>\n'
|
||||
+ '#include "libgimpbase/gimpbase.h"\n'
|
||||
+ '#include "core/core-enums.h"\n'
|
||||
+ '#include "@basename@"\n'
|
||||
+ '#include "gimp-intl.h"\n',
|
||||
app_mkenums_custom_target_commonargs,
|
||||
'@INPUT@',
|
||||
stamp_gegl_enums = custom_target('stamp-gimp-gegl-enums.h',
|
||||
input : [
|
||||
files(
|
||||
'gimp-gegl-enums.h'
|
||||
),
|
||||
],
|
||||
capture: true,
|
||||
output: [ 'stamp-gimp-gegl-enums.h', ],
|
||||
command: [
|
||||
mkenums_wrap, perl,
|
||||
meson.source_root(), meson.current_source_dir(),
|
||||
meson.current_build_dir(),
|
||||
'gimp-gegl-',
|
||||
'#include <gio/gio.h>\n' +
|
||||
'#include "libgimpbase/gimpbase.h"\n' +
|
||||
'#include "core/core-enums.h"\n',
|
||||
'#include "gimp-intl.h"'
|
||||
],
|
||||
build_by_default: true
|
||||
)
|
||||
|
||||
libappgegl_loops = simd.check('gimp-gegl-loops-simd',
|
||||
|
@ -40,7 +42,9 @@ libappgegl_sources = [
|
|||
'gimp-gegl.c',
|
||||
'gimpapplicator.c',
|
||||
'gimptilehandlervalidate.c',
|
||||
appgeglenums,
|
||||
|
||||
'gimp-gegl-enums.c',
|
||||
stamp_gegl_enums
|
||||
]
|
||||
|
||||
libappgegl = static_library('appgegl',
|
||||
|
|
|
@ -1,23 +1,5 @@
|
|||
rootAppInclude = include_directories('.')
|
||||
|
||||
app_mkenums_custom_target_commonargs = [
|
||||
gimp_mkenums_custom_target_commonargs,
|
||||
'--dtail',' { 0, NULL, NULL }\n'+
|
||||
' };\n'+
|
||||
'\n'+
|
||||
' static GType type = 0;\n'+
|
||||
'\n'+
|
||||
' if (G_UNLIKELY (! type))\n'+
|
||||
' {\n'+
|
||||
' type = g_@type@_register_static ("@EnumName@", values);\n'+
|
||||
' gimp_type_set_translation_context (type, "@enumnick@");\n'+
|
||||
' gimp_@type@_set_value_descriptions (type, descs);\n'+
|
||||
' }\n'+
|
||||
'\n'+
|
||||
' return type;\n'+
|
||||
'}\n',
|
||||
]
|
||||
|
||||
subdir('actions')
|
||||
subdir('core')
|
||||
subdir('dialogs')
|
||||
|
|
|
@ -1,21 +1,22 @@
|
|||
|
||||
appoperationsenums = custom_target('operations-enums.c',
|
||||
input : [ 'operations-enums.h', ],
|
||||
output: [ 'operations-enums.c', ],
|
||||
command: [
|
||||
gimp_mkenums,
|
||||
'--fhead','#include "config.h"\n'
|
||||
+ '#include <gio/gio.h>\n'
|
||||
+ '#include "libgimpbase/gimpbase.h"\n'
|
||||
+ '#include "@basename@"\n'
|
||||
+ '#include "gimp-intl.h"\n',
|
||||
app_mkenums_custom_target_commonargs,
|
||||
'@INPUT@',
|
||||
stamp_operations_enums = custom_target('stamp-operations-enums.h',
|
||||
input : [
|
||||
files(
|
||||
'operations-enums.h'
|
||||
),
|
||||
],
|
||||
capture: true,
|
||||
output: [ 'stamp-operations-enums.h', ],
|
||||
command: [
|
||||
mkenums_wrap, perl,
|
||||
meson.source_root(), meson.current_source_dir(),
|
||||
meson.current_build_dir(),
|
||||
'operations-',
|
||||
'#include <gio/gio.h>\n' +
|
||||
'#include "libgimpbase/gimpbase.h"\n',
|
||||
'#include "gimp-intl.h"'
|
||||
],
|
||||
build_by_default: true
|
||||
)
|
||||
|
||||
|
||||
libappoperations_sources = [
|
||||
'gimp-operation-config.c',
|
||||
'gimp-operations.c',
|
||||
|
@ -55,7 +56,9 @@ libappoperations_sources = [
|
|||
'gimpoperationshrink.c',
|
||||
'gimpoperationthreshold.c',
|
||||
'gimpoperationthresholdalpha.c',
|
||||
appoperationsenums
|
||||
|
||||
'operations-enums.c',
|
||||
stamp_operations_enums,
|
||||
]
|
||||
|
||||
libappoperations = static_library('appoperations',
|
||||
|
|
|
@ -1,21 +1,22 @@
|
|||
|
||||
apppaintenums = custom_target('paint-enums.c',
|
||||
input : [ 'paint-enums.h', ],
|
||||
output: [ 'paint-enums.c', ],
|
||||
command: [
|
||||
gimp_mkenums,
|
||||
'--fhead','#include "config.h"\n'
|
||||
+ '#include <gio/gio.h>\n'
|
||||
+ '#include "libgimpbase/gimpbase.h"\n'
|
||||
+ '#include "@basename@"\n'
|
||||
+ '#include "gimp-intl.h"\n',
|
||||
app_mkenums_custom_target_commonargs,
|
||||
'@INPUT@',
|
||||
stamp_paint_enums = custom_target('stamp-paint-enums.h',
|
||||
input : [
|
||||
files(
|
||||
'paint-enums.h'
|
||||
),
|
||||
],
|
||||
capture: true,
|
||||
output: [ 'stamp-paint-enums.h', ],
|
||||
command: [
|
||||
mkenums_wrap, perl,
|
||||
meson.source_root(), meson.current_source_dir(),
|
||||
meson.current_build_dir(),
|
||||
'paint-',
|
||||
'#include <gio/gio.h>\n' +
|
||||
'#include "libgimpbase/gimpbase.h"\n',
|
||||
'#include "gimp-intl.h"'
|
||||
],
|
||||
build_by_default: true
|
||||
)
|
||||
|
||||
|
||||
libapppaint_sources = [
|
||||
'gimp-paint.c',
|
||||
'gimpairbrush.c',
|
||||
|
@ -52,7 +53,9 @@ libapppaint_sources = [
|
|||
'gimpsmudgeoptions.c',
|
||||
'gimpsourcecore.c',
|
||||
'gimpsourceoptions.c',
|
||||
apppaintenums,
|
||||
|
||||
'paint-enums.c',
|
||||
stamp_paint_enums,
|
||||
]
|
||||
|
||||
libapppaint = static_library('apppaint',
|
||||
|
|
|
@ -1,21 +1,22 @@
|
|||
|
||||
apppluginenums = custom_target('plug-in-enums.c',
|
||||
input : [ 'plug-in-enums.h', ],
|
||||
output: [ 'plug-in-enums.c', ],
|
||||
command: [
|
||||
gimp_mkenums,
|
||||
'--fhead','#include "config.h"\n'
|
||||
+ '#include <gio/gio.h>\n'
|
||||
+ '#include "libgimpbase/gimpbase.h"\n'
|
||||
+ '#include "@basename@"\n'
|
||||
+ '#include "gimp-intl.h"\n',
|
||||
app_mkenums_custom_target_commonargs,
|
||||
'@INPUT@',
|
||||
stamp_plug_in_enums = custom_target('stamp-plug-in-enums.h',
|
||||
input : [
|
||||
files(
|
||||
'plug-in-enums.h'
|
||||
),
|
||||
],
|
||||
capture: true,
|
||||
output: [ 'stamp-plug-in-enums.h', ],
|
||||
command: [
|
||||
mkenums_wrap, perl,
|
||||
meson.source_root(), meson.current_source_dir(),
|
||||
meson.current_build_dir(),
|
||||
'plug-in-',
|
||||
'#include <gio/gio.h>\n' +
|
||||
'#include "libgimpbase/gimpbase.h"\n',
|
||||
'#include "gimp-intl.h"'
|
||||
],
|
||||
build_by_default: true
|
||||
)
|
||||
|
||||
|
||||
libappplugin_sources = [
|
||||
'gimpenvirontable.c',
|
||||
'gimpgpparams.c',
|
||||
|
@ -43,7 +44,9 @@ libappplugin_sources = [
|
|||
'gimptemporaryprocedure.c',
|
||||
'plug-in-menu-path.c',
|
||||
'plug-in-rc.c',
|
||||
apppluginenums,
|
||||
|
||||
'plug-in-enums.c',
|
||||
stamp_plug_in_enums,
|
||||
|
||||
appcoremarshal[1],
|
||||
]
|
||||
|
|
|
@ -1,18 +1,20 @@
|
|||
|
||||
apptextenums = custom_target('text-enums.c',
|
||||
input : [ 'text-enums.h', ],
|
||||
output: [ 'text-enums.c', ],
|
||||
command: [
|
||||
gimp_mkenums,
|
||||
'--fhead','#include "config.h"\n'
|
||||
+ '#include <gio/gio.h>\n'
|
||||
+ '#include "libgimpbase/gimpbase.h"\n'
|
||||
+ '#include "@basename@"\n'
|
||||
+ '#include "gimp-intl.h"\n',
|
||||
app_mkenums_custom_target_commonargs,
|
||||
'@INPUT@',
|
||||
stamp_text_enums = custom_target('stamp-text-enums.h',
|
||||
input : [
|
||||
files(
|
||||
'text-enums.h'
|
||||
),
|
||||
],
|
||||
capture: true,
|
||||
output: [ 'stamp-text-enums.h', ],
|
||||
command: [
|
||||
mkenums_wrap, perl,
|
||||
meson.source_root(), meson.current_source_dir(),
|
||||
meson.current_build_dir(),
|
||||
'text-',
|
||||
'#include <gio/gio.h>\n' +
|
||||
'#include "libgimpbase/gimpbase.h"\n',
|
||||
'#include "gimp-intl.h"'
|
||||
],
|
||||
build_by_default: true
|
||||
)
|
||||
|
||||
libapptext_sources = [
|
||||
|
@ -29,7 +31,9 @@ libapptext_sources = [
|
|||
'gimptextlayout-render.c',
|
||||
'gimptextlayout.c',
|
||||
'gimptextundo.c',
|
||||
apptextenums,
|
||||
|
||||
'text-enums.c',
|
||||
stamp_text_enums
|
||||
]
|
||||
|
||||
|
||||
|
|
|
@ -1,19 +1,21 @@
|
|||
|
||||
apptoolsenums = custom_target('tools-enums.c',
|
||||
input : [ 'tools-enums.h', ],
|
||||
output: [ 'tools-enums.c', ],
|
||||
command: [
|
||||
gimp_mkenums,
|
||||
'--fhead','#include "config.h"\n'
|
||||
+ '#include <gio/gio.h>\n'
|
||||
+ '#include "libgimpbase/gimpbase.h"\n'
|
||||
+ '#include "core/core-enums.h"\n'
|
||||
+ '#include "@basename@"\n'
|
||||
+ '#include "gimp-intl.h"\n',
|
||||
app_mkenums_custom_target_commonargs,
|
||||
'@INPUT@',
|
||||
stamp_tools_enums = custom_target('stamp-tools-enums.h',
|
||||
input : [
|
||||
files(
|
||||
'tools-enums.h'
|
||||
),
|
||||
],
|
||||
capture: true,
|
||||
output: [ 'stamp-tools-enums.h', ],
|
||||
command: [
|
||||
mkenums_wrap, perl,
|
||||
meson.source_root(), meson.current_source_dir(),
|
||||
meson.current_build_dir(),
|
||||
'tools-',
|
||||
'#include <gio/gio.h>\n' +
|
||||
'#include "libgimpbase/gimpbase.h"\n' +
|
||||
'#include "core/core-enums.h"\n',
|
||||
'#include "gimp-intl.h"'
|
||||
],
|
||||
build_by_default: true
|
||||
)
|
||||
|
||||
libapptools_sources = [
|
||||
|
@ -130,7 +132,8 @@ libapptools_sources = [
|
|||
'gimpwarpoptions.c',
|
||||
'gimpwarptool.c',
|
||||
'tool_manager.c',
|
||||
apptoolsenums,
|
||||
'tools-enums.c',
|
||||
stamp_tools_enums,
|
||||
|
||||
appcoremarshal[1],
|
||||
]
|
||||
|
|
|
@ -1,21 +1,22 @@
|
|||
|
||||
appwidgetsenums = custom_target('widgets-enums.c',
|
||||
input : [ 'widgets-enums.h', ],
|
||||
output: [ 'widgets-enums.c', ],
|
||||
command: [
|
||||
gimp_mkenums,
|
||||
'--fhead','#include "config.h"\n'
|
||||
+ '#include <gtk/gtk.h>\n'
|
||||
+ '#include "libgimpbase/gimpbase.h"\n'
|
||||
+ '#include "@basename@"\n'
|
||||
+ '#include "gimp-intl.h"\n',
|
||||
app_mkenums_custom_target_commonargs,
|
||||
'@INPUT@',
|
||||
stamp_widgets_enums = custom_target('stamp-widgets-enums.h',
|
||||
input : [
|
||||
files(
|
||||
'widgets-enums.h'
|
||||
),
|
||||
],
|
||||
capture: true,
|
||||
output: [ 'stamp-widgets-enums.h', ],
|
||||
command: [
|
||||
mkenums_wrap, perl,
|
||||
meson.source_root(), meson.current_source_dir(),
|
||||
meson.current_build_dir(),
|
||||
'widgets-',
|
||||
'#include <gtk/gtk.h>\n' +
|
||||
'#include "libgimpbase/gimpbase.h"\n',
|
||||
'#include "gimp-intl.h"'
|
||||
],
|
||||
build_by_default: true
|
||||
)
|
||||
|
||||
|
||||
libappwidgets_sources = [
|
||||
'gimpaccellabel.c',
|
||||
'gimpaction-history.c',
|
||||
|
@ -233,7 +234,9 @@ libappwidgets_sources = [
|
|||
'gimpwidgets-utils.c',
|
||||
'gimpwindow.c',
|
||||
'gimpwindowstrategy.c',
|
||||
appwidgetsenums,
|
||||
|
||||
'widgets-enums.c',
|
||||
stamp_widgets_enums,
|
||||
|
||||
appcoremarshal[1],
|
||||
]
|
||||
|
|
|
@ -1,4 +1,7 @@
|
|||
|
||||
# Similarly to libgimpthumb/gimpthumb-enums.c, libgimp/gimpenums.c is
|
||||
# not versionned so we don't use the mkenums_wrap.
|
||||
# Moreover it is generated in 2 steps, first with common mkenums
|
||||
# arguments, then concatenating with a "tail" file.
|
||||
gimpenums_notail = custom_target('gimpenums.c.notail',
|
||||
input : [ 'gimpenums.h', ],
|
||||
output: [ 'gimpenums.c.notail', ],
|
||||
|
@ -12,7 +15,31 @@ gimpenums_notail = custom_target('gimpenums.c.notail',
|
|||
+ '#include "libgimpbase/gimpbase-private.h"\n'
|
||||
+ '#include "libgimpconfig/gimpconfigenums.h"\n'
|
||||
+ '#include "gimpenums.h"\n',
|
||||
libgimp_mkenums_custom_target_commonargs,
|
||||
'--fprod',
|
||||
'/* enumerations from "@basename@" */',
|
||||
'--vhead',
|
||||
'GType\n'+
|
||||
'@enum_name@_get_type (void)\n'+
|
||||
'{\n'+
|
||||
' static const G@Type@Value values[] =\n'+
|
||||
' {',
|
||||
'--vprod',
|
||||
' { @VALUENAME@, "@VALUENAME@", "@valuenick@" },',
|
||||
'--vtail',
|
||||
' { 0, NULL, NULL }\n'+
|
||||
' };\n',
|
||||
'--dhead',
|
||||
' static const Gimp@Type@Desc descs[] =\n'+
|
||||
' {',
|
||||
'--dprod',
|
||||
' { @VALUENAME@, @valuedesc@, @valuehelp@ },'+
|
||||
'@if (\'@valueabbrev@\' ne \'NULL\')@\n'+
|
||||
' /* Translators: this is an abbreviated version of @valueudesc@.\n'+
|
||||
' Keep it short. */\n'+
|
||||
' { @VALUENAME@, @valueabbrev@, NULL },'+
|
||||
'@endif@',
|
||||
'--dtail',
|
||||
libgimp_mkenums_dtails,
|
||||
'@INPUT@',
|
||||
],
|
||||
capture: true,
|
||||
|
|
|
@ -8,37 +8,44 @@ gimpversion = configure_file(
|
|||
configuration: versionconfig,
|
||||
)
|
||||
|
||||
|
||||
gimpbaseenums = custom_target('gimpbaseenums.c',
|
||||
input : [ 'gimpbaseenums.h', ],
|
||||
output: [ 'gimpbaseenums.c', ],
|
||||
command: [
|
||||
gimp_mkenums,
|
||||
'--fhead','#include "config.h"\n'
|
||||
+ '#include <glib-object.h>\n'
|
||||
+ '#undef GIMP_DISABLE_DEPRECATED\n'
|
||||
+ '#include "gimpbasetypes.h"\n'
|
||||
+ '#include "libgimp/libgimp-intl.h"\n',
|
||||
libgimp_mkenums_custom_target_commonargs,
|
||||
'@INPUT@',
|
||||
stamp_base_enums = custom_target('stamp-gimpbaseenums.h',
|
||||
input : [
|
||||
files(
|
||||
'gimpbaseenums.h'
|
||||
),
|
||||
],
|
||||
capture: true,
|
||||
output: [ 'stamp-gimpbaseenums.h', ],
|
||||
command: [
|
||||
mkenums_wrap, perl,
|
||||
meson.source_root(), meson.current_source_dir(),
|
||||
meson.current_build_dir(),
|
||||
'gimpbase',
|
||||
'#include <glib-object.h>\n' +
|
||||
'#undef GIMP_DISABLE_DEPRECATED\n' +
|
||||
'#include "gimpbasetypes.h"\n' +
|
||||
'#include "libgimp/libgimp-intl.h"\n',
|
||||
'',
|
||||
libgimp_mkenums_dtails
|
||||
],
|
||||
build_by_default: true
|
||||
)
|
||||
|
||||
gimpcompatenums = custom_target('gimpcompatenums.c',
|
||||
input : [ 'gimpcompatenums.h', ],
|
||||
output: [ 'gimpcompatenums.c', ],
|
||||
command: [
|
||||
gimp_mkenums,
|
||||
'--fhead','#include "config.h"\n'
|
||||
+ '#include <glib-object.h>\n'
|
||||
+ '#include "gimpbasetypes.h"\n'
|
||||
+ '#include "@basename@"\n'
|
||||
+ '#include "libgimp/libgimp-intl.h"\n',
|
||||
libgimp_mkenums_custom_target_commonargs,
|
||||
'@INPUT@',
|
||||
stamp_compat_enums = custom_target('stamp-gimpcompatenums.h',
|
||||
input : [
|
||||
files(
|
||||
'gimpcompatenums.h'
|
||||
),
|
||||
],
|
||||
capture: true,
|
||||
output: [ 'stamp-gimpcompatenums.h', ],
|
||||
command: [
|
||||
mkenums_wrap, perl,
|
||||
meson.source_root(), meson.current_source_dir(), meson.current_build_dir(),
|
||||
'gimpcompat',
|
||||
'#include <glib-object.h>\n' +
|
||||
'#include "gimpbasetypes.h"\n',
|
||||
'#include "libgimp/libgimp-intl.h"',
|
||||
],
|
||||
build_by_default: true
|
||||
)
|
||||
|
||||
libgimpbase_sources_introspectable = files(
|
||||
|
@ -64,8 +71,12 @@ libgimpbase_sources = [
|
|||
'gimpprotocol.c',
|
||||
'gimpreloc.c',
|
||||
'gimpwire.c',
|
||||
gimpbaseenums,
|
||||
gimpcompatenums,
|
||||
|
||||
'gimpbaseenums.c',
|
||||
stamp_base_enums,
|
||||
|
||||
'gimpcompatenums.c',
|
||||
stamp_compat_enums
|
||||
]
|
||||
|
||||
libgimpbase_headers_introspectable = files(
|
||||
|
|
|
@ -1,18 +1,22 @@
|
|||
|
||||
gimpconfigenums = custom_target('gimpconfigenums.c',
|
||||
input : [ 'gimpconfigenums.h', ],
|
||||
output: [ 'gimpconfigenums.c', ],
|
||||
command: [
|
||||
gimp_mkenums,
|
||||
'--fhead','#include "config.h"\n'
|
||||
+ '#include <gio/gio.h>\n'
|
||||
+ '#include "libgimpbase/gimpbase.h"\n'
|
||||
+ '#include "@basename@"\n'
|
||||
+ '#include "libgimp/libgimp-intl.h"\n',
|
||||
libgimp_mkenums_custom_target_commonargs,
|
||||
'@INPUT@',
|
||||
stamp_config_enums = custom_target('stamp-gimpconfigenums.h',
|
||||
input : [
|
||||
files(
|
||||
'gimpconfigenums.h'
|
||||
),
|
||||
],
|
||||
capture: true,
|
||||
output: [ 'stamp-gimpconfigenums.h', ],
|
||||
command: [
|
||||
mkenums_wrap, perl,
|
||||
meson.source_root(), meson.current_source_dir(),
|
||||
meson.current_build_dir(),
|
||||
'gimpconfig',
|
||||
'#include <gio/gio.h>\n' +
|
||||
'#include "libgimpbase/gimpbase.h"\n',
|
||||
'#include "libgimp/libgimp-intl.h"',
|
||||
libgimp_mkenums_dtails
|
||||
],
|
||||
build_by_default: true
|
||||
)
|
||||
|
||||
libgimpconfig_sources_introspectable = files(
|
||||
|
@ -31,7 +35,9 @@ libgimpconfig_sources_introspectable = files(
|
|||
|
||||
libgimpconfig_sources = [
|
||||
libgimpconfig_sources_introspectable,
|
||||
gimpconfigenums,
|
||||
|
||||
'gimpconfigenums.c',
|
||||
stamp_config_enums
|
||||
]
|
||||
|
||||
libgimpconfig_headers_introspectable = files(
|
||||
|
|
|
@ -1,4 +1,7 @@
|
|||
|
||||
# Unlike other enums file, we don't use the mkenums_wrap because this
|
||||
# one is not versionned in the repository (not sure why). Moreover the
|
||||
# options are quite different from the other generated enums, so it
|
||||
# didn't make sense to overdo it.
|
||||
gimpthumbenums = custom_target('gimpthumb-enums.c',
|
||||
input : [ 'gimpthumb-enums.h', ],
|
||||
output: [ 'gimpthumb-enums.c', ],
|
||||
|
@ -7,7 +10,7 @@ gimpthumbenums = custom_target('gimpthumb-enums.c',
|
|||
'--fhead','#include "config.h"\n'+
|
||||
'#include <glib-object.h>\n'+
|
||||
'#include "gimpthumb-enums.h"\n',
|
||||
'--fprod','/* enumerations from "@filename@" */\n',
|
||||
'--fprod','/* enumerations from "@filename@" */',
|
||||
'--vhead','GType\n'+
|
||||
'@enum_name@_get_type (void)\n'+
|
||||
'{\n'+
|
||||
|
|
|
@ -1,18 +1,21 @@
|
|||
|
||||
gimpwidgetsenums = custom_target('gimpwidgetsenums.c',
|
||||
input : [ 'gimpwidgetsenums.h', ],
|
||||
output: [ 'gimpwidgetsenums.c', ],
|
||||
command: [
|
||||
gimp_mkenums,
|
||||
'--fhead','#include "config.h"\n'
|
||||
+ '#include <gio/gio.h>\n'
|
||||
+ '#include "libgimpbase/gimpbase.h"\n'
|
||||
+ '#include "@basename@"\n'
|
||||
+ '#include "libgimp/libgimp-intl.h"\n',
|
||||
libgimp_mkenums_custom_target_commonargs,
|
||||
'@INPUT@',
|
||||
stamp_widgets_enums = custom_target('stamp-gimpwidgetsenums.h',
|
||||
input : [
|
||||
files(
|
||||
'gimpwidgetsenums.h'
|
||||
),
|
||||
],
|
||||
capture: true,
|
||||
output: [ 'stamp-gimpwidgetsenums.h', ],
|
||||
command: [
|
||||
mkenums_wrap, perl,
|
||||
meson.source_root(), meson.current_source_dir(),
|
||||
meson.current_build_dir(),
|
||||
'gimpwidgets',
|
||||
'#include <gio/gio.h>\n' +
|
||||
'#include "libgimpbase/gimpbase.h"\n',
|
||||
'#include "libgimp/libgimp-intl.h"',
|
||||
libgimp_mkenums_dtails
|
||||
],
|
||||
build_by_default: true
|
||||
)
|
||||
|
||||
gimpwidgetsmarshal = gnome.genmarshal('gimpwidgetsmarshal',
|
||||
|
@ -94,7 +97,9 @@ libgimpwidgets_sources = [
|
|||
'gimpeevl.c',
|
||||
'gimpwidgets-private.c',
|
||||
|
||||
gimpwidgetsenums,
|
||||
'gimpwidgetsenums.c',
|
||||
stamp_widgets_enums,
|
||||
|
||||
gimpwidgetsmarshal,
|
||||
icons_imgs_sources,
|
||||
cursors_sources,
|
||||
|
|
63
meson.build
63
meson.build
|
@ -1186,52 +1186,25 @@ gimppath2svg = find_program('tools'/'gimppath2svg.py')
|
|||
module_dependencies = find_program('tools'/'module-dependencies.py')
|
||||
meson_install_subdir= find_program('tools'/'meson_install_subdir.py')
|
||||
|
||||
gimp_mkenums = find_program('tools'/'gimp-mkenums')
|
||||
gimp_mkenums_custom_target_commonargs = [
|
||||
'--fprod',
|
||||
'/* enumerations from "@basename@" */',
|
||||
'--vhead',
|
||||
'GType\n'+
|
||||
'@enum_name@_get_type (void)\n'+
|
||||
'{\n'+
|
||||
' static const G@Type@Value values[] =\n'+
|
||||
' {',
|
||||
'--vprod',
|
||||
' { @VALUENAME@, "@VALUENAME@", "@valuenick@" },',
|
||||
'--vtail',
|
||||
' { 0, NULL, NULL }\n'+
|
||||
' };\n',
|
||||
'--dhead',
|
||||
' static const Gimp@Type@Desc descs[] =\n'+
|
||||
' {',
|
||||
'--dprod',
|
||||
' { @VALUENAME@, @valuedesc@, @valuehelp@ },'+
|
||||
'@if (\'@valueabbrev@\' ne \'NULL\')@\n'+
|
||||
' /* Translators: this is an abbreviated version of @valueudesc@.\n'+
|
||||
' Keep it short. */\n'+
|
||||
' { @VALUENAME@, @valueabbrev@, NULL },'+
|
||||
'@endif@',
|
||||
]
|
||||
gimp_mkenums = find_program('tools' / 'gimp-mkenums')
|
||||
mkenums_wrap = find_program(meson.current_source_dir() / 'tools' / 'meson-mkenums.sh')
|
||||
|
||||
libgimp_mkenums_custom_target_commonargs = [
|
||||
gimp_mkenums_custom_target_commonargs,
|
||||
'--dtail',
|
||||
' { 0, NULL, NULL }\n'+
|
||||
' };\n'+
|
||||
'\n'+
|
||||
' static GType type = 0;\n'+
|
||||
'\n'+
|
||||
' if (G_UNLIKELY (! type))\n'+
|
||||
' {\n'+
|
||||
' type = g_@type@_register_static ("@EnumName@", values);\n'+
|
||||
' gimp_type_set_translation_domain (type, GETTEXT_PACKAGE "-libgimp");\n'+
|
||||
' gimp_type_set_translation_context (type, "@enumnick@");\n'+
|
||||
' gimp_@type@_set_value_descriptions (type, descs);\n'+
|
||||
' }\n'+
|
||||
'\n'+
|
||||
' return type;\n'+
|
||||
'}\n',
|
||||
]
|
||||
libgimp_mkenums_dtails = \
|
||||
' { 0, NULL, NULL }\n' + \
|
||||
' };\n' + \
|
||||
'\n' + \
|
||||
' static GType type = 0;\n' + \
|
||||
'\n' + \
|
||||
' if (G_UNLIKELY (! type))\n' + \
|
||||
' {\n' + \
|
||||
' type = g_@type@_register_static ("@EnumName@", values);\n' + \
|
||||
' gimp_type_set_translation_domain (type, GETTEXT_PACKAGE "-libgimp");\n' + \
|
||||
' gimp_type_set_translation_context (type, "@enumnick@");\n' + \
|
||||
' gimp_@type@_set_value_descriptions (type, descs);\n' + \
|
||||
' }\n' + \
|
||||
'\n' + \
|
||||
' return type;\n' + \
|
||||
'}\n'
|
||||
|
||||
conf.set('ENABLE_NLS', true)
|
||||
conf.set('HAVE_GETTEXT', true)
|
||||
|
|
|
@ -0,0 +1,53 @@
|
|||
#!/bin/sh
|
||||
|
||||
# This is a wrapper to the tools/gimp-mkenums perl script which:
|
||||
# * sets a few common values;
|
||||
# * updates the ${filebase}enums.c directly in the source directory in
|
||||
# order for it to be versionned.
|
||||
# * Create a no-op stamp-header file to be included by the resulting
|
||||
# enums.c. The goal is to make sure that meson will trigger a rebuild
|
||||
# of the enums.c generation before compiling, if the enums.h changed.
|
||||
# See the explanation here:
|
||||
# https://github.com/mesonbuild/meson/issues/10196#issuecomment-1080742592
|
||||
# This is also the trick used for pdbgen.
|
||||
|
||||
# Arguments to this script:
|
||||
# The perl binary to use.
|
||||
PERL="$1"
|
||||
# Root of the source directory.
|
||||
top_srcdir="$2"
|
||||
# Current source folder.
|
||||
srcdir="$3"
|
||||
# Current build folder.
|
||||
builddir="$4"
|
||||
# Base of the generated enums.c file name.
|
||||
filebase="$5"
|
||||
# Includes before #include "${filebase}enums.h"
|
||||
preincludes="$6"
|
||||
# Includes after #include "${filebase}enums.h"
|
||||
postincludes="$7"
|
||||
# Value for --dtail option if the default doesn't fit.
|
||||
dtail="$8"
|
||||
|
||||
if [ -z "$dtail" ]; then
|
||||
dtail=" { 0, NULL, NULL }\n };\n\n static GType type = 0;\n\n if (G_UNLIKELY (! type))\n {\n type = g_@type@_register_static (\"@EnumName@\", values);\n gimp_type_set_translation_context (type, \"@enumnick@\");\n gimp_@type@_set_value_descriptions (type, descs);\n }\n\n return type;\n}\n"
|
||||
fi
|
||||
|
||||
$PERL $top_srcdir/tools/gimp-mkenums \
|
||||
--fhead "#include \"stamp-${filebase}enums.h\"\n#include \"config.h\"\n$preincludes#include \"${filebase}enums.h\"\n$postincludes" \
|
||||
--fprod "\n/* enumerations from \"@basename@\" */" \
|
||||
--vhead "GType\n@enum_name@_get_type (void)\n{\n static const G@Type@Value values[] =\n {" \
|
||||
--vprod " { @VALUENAME@, \"@VALUENAME@\", \"@valuenick@\" }," \
|
||||
--vtail " { 0, NULL, NULL }\n };\n" \
|
||||
--dhead " static const Gimp@Type@Desc descs[] =\n {" \
|
||||
--dprod " { @VALUENAME@, @valuedesc@, @valuehelp@ },@if ('@valueabbrev@' ne 'NULL')@\n /* Translators: this is an abbreviated version of @valueudesc@.\n Keep it short. */\n { @VALUENAME@, @valueabbrev@, NULL },@endif@" \
|
||||
--dtail "$dtail" \
|
||||
"$srcdir/${filebase}enums.h" > "$builddir/${filebase}enums-tmp.c"
|
||||
|
||||
if ! cmp -s "$builddir/${filebase}enums-tmp.c" "$srcdir/${filebase}enums.c"; then
|
||||
cp "$builddir/${filebase}enums-tmp.c" "$srcdir/${filebase}enums.c";
|
||||
else
|
||||
touch "$srcdir/${filebase}enums.c"; 2> /dev/null || true;
|
||||
fi
|
||||
|
||||
echo "/* Generated on `date`. */" > $builddir/stamp-${filebase}enums.h
|
Loading…
Reference in New Issue