Files
gimp/extensions/goat-exercises/meson.build
Jehan 3e57f2f482 extensions, po-plug-ins: demo extensions use the new i18n logic.
Since these are demos, for the sake of showing how the localization
works, let's localize the goat-exercises with a locally installed
catalog.
Note that actually use the gimp30-std-plug-ins catalog, simply I copy it
in the plug-in folder and rename it as org.gimp.extension.goat-exercises
domain.

As a consequence:

- The C plug-in does not need the INIT_I18N anymore, which was
  specifically for the centrally installed catalog and cannot be used by
  third-party plug-in developers (so it's not a good demo code).
- I now use GLib.dgettext() for Python instead of the gettext Python
  module, because the later won't "catch" the catalog declared in
  libgimp.
- The other Goat exercises are now localized correctly, unlike before.
- Just setting GETTEXT_PACKAGE is apparently enough for the Vala
  plug-in.
- Lua is untested. Hopefully the code will work.
2022-06-05 01:57:02 +02:00

124 lines
2.9 KiB
Meson

# C version
extension_name = 'org.gimp.extension.goat-exercises'
plug_in_name = 'goat-exercise'
plugin_sources = [
'goat-exercise-c.c',
]
if platform_windows
plugin_sources += windows.compile_resources(
gimp_plugins_rc,
args: [
'--define', 'ORIGINALFILENAME_STR="@0@"'.format(plug_in_name + '-c.exe'),
'--define', 'INTERNALNAME_STR="@0@"' .format(plug_in_name),
'--define', 'TOP_SRCDIR="@0@"' .format(meson.source_root()),
],
include_directories: [
rootInclude, appInclude,
],
)
endif
exe = executable(plug_in_name + '-c',
plugin_sources,
dependencies: [
libgimpui_dep,
math,
],
install: true,
install_dir: gimpplugindir / 'extensions' / extension_name,
)
# XXX This is so ugly!
# From meson 0.54.0, we will be able to use exe.name().
plug_ins = exe.full_path().split('/')[-1].split('\\')[-1]
install_data(
'goat-exercise-c.c',
install_dir: gimpplugindir / 'extensions' / extension_name,
)
# Vala version
if have_vala and have_gobject_introspection
exe = executable('goat-exercise-vala',
'goat-exercise-vala.vala',
include_directories: [ rootInclude, ],
dependencies: [
libgimp_vapi, libgimpui_vapi, gtk3, gegl, math,
],
c_args: [
'-DGETTEXT_PACKAGE="@0@"'.format('org.gimp.extension.goat-exercises'),
],
install: true,
install_dir: gimpplugindir / 'extensions' / extension_name,
)
plug_ins = plug_ins + ':' + exe.full_path().split('/')[-1].split('\\')[-1]
install_data(
'goat-exercise-vala.vala',
install_dir: gimpplugindir / 'extensions' / extension_name,
)
endif
# Python 3 (pygobject) version.
if have_python
install_data(
'goat-exercise-py3.py',
install_dir: gimpplugindir / 'extensions' / extension_name,
)
plug_ins = plug_ins + ':goat-exercise-py3.py'
endif
# Javascript (GJS) version.
if have_javascript
install_data(
'goat-exercise-gjs.js',
install_dir: gimpplugindir / 'extensions' / extension_name,
)
plug_ins = plug_ins + ':goat-exercise-gjs.js'
endif
# Lua (lua-jit + LGI) version.
if have_lua
install_data(
'goat-exercise-lua.lua',
install_dir: gimpplugindir / 'extensions' / extension_name,
)
plug_ins = plug_ins + ':goat-exercise-lua.lua'
endif
# Generate the AppData.
conf = configuration_data()
conf.set('GOAT_EXERCISES', plug_ins)
appdatafilename = 'org.gimp.extension.goat-exercises.metainfo.xml'
appdatafilein = configure_file(
input : appdatafilename + '.in.in',
output: appdatafilename + '.in',
configuration: conf,
)
appdatafile = custom_target(appdatafilename,
input : [ appdatafilein, ],
output: [ appdatafilename, ],
depend_files: [ po_plug_ins_dir ],
command: [
intltool_merge,
po_plug_ins_dir,
'@INPUT@',
'@OUTPUT@',
'--xml-style',
'--utf8',
'--cache=' + '@OUTDIR@' / 'intltool-merge-cache',
],
install: true,
install_dir: gimpplugindir / 'extensions' / extension_name,
)