Commit Graph

33 Commits

Author SHA1 Message Date
Lukas Oberhuber deaa99cf08 meson: fix MacOS build
lua is not available on macOS currently and the lack of lack of the lua variable causes
the build to fail.
2024-08-12 10:48:50 +00:00
Jehan 34af64b70f extensions, plug-ins: fixing CamelCase on the "Plug-In Examples" items.
First of all: sorry to all translators who started working on these new
strings!

We use CamelCase for our titles, and in particular "Plug-In" is
capitalized with 'I'.

Furthermore, let's use understandable titles like "Plug-In Example in C"
and not just "In C", because while the short title works OK in the menu,
it makes for very broken action names in non-contextual parts of the
software, such as the action search.

Note that we in fact have a concept of short label for actions since
commit 89772351c9. I added support for it to GEGL actions (cf. commit
6dc5f6792e), and to a few core actions (e.g. commit ea1205f094).
Unfortunately I don't think I added an API yet for short label in
plug-ins. Maybe I'll add it soon. But for now, if we have to have a
single label, it should be long, so that it works in every situation.

P.S.: not sure if it's useful to keep documentation strings just
repeating the title, but for now, let's leave them.
2024-08-10 23:33:57 +02:00
bootchk fef971fa8d GUI: Rename menu Filters>Development>Goat exercises => Plug-in Examples
The old menu label was confusing to users.

Remove translatable strings having joke "goat" so translators not confused.

Move the goat plugins to the menu.

The items under the menu should all be example plugins.
The menu is in a release.

Test plugins should not be in this menu.
Test plugins should not ship in a stable release.

!!! Note that 2.10 does not ship with example plugins.
If we don't want 3.0 to ship stable build with example plugins,
then the meson.build for goat-exercises needs to change
and the menu removed entirely in menus/image-menu.ui.in.in.
2024-08-10 14:58:58 +00:00
Jehan 063324cff0 extensions: install the lua interpreter for all non-relocatable builds.
As discussed in #11876, the interp files work fine on Linux (and other
platforms) too, and this allows to properly redirect to the working
interpreter found at configure time, without touching the scripts'
shebang.
2024-08-09 16:31:00 +02:00
Bruno 7037297526 meson: Prevent broken lua plug-ins
See: https://gitlab.gnome.org/GNOME/gimp/-/issues/11876

For 3.0 we will support only Lua 5.1, since we need to figure out how
much of the Lua 5.1 API is compatible with newer versions (Lua minor
versions aren't like Python minor versions, there is API breakage so
plug-ins would be completely unreliable, this commit prevent this).

Also, change some files to not force luajit since it isn't mandatory.
2024-08-09 12:26:26 +00:00
Jehan 93cc81281c Issue #11317: make Python plug-ins mandatory.
Unlike the other bindings (Lua, JS, Vala) where we only have a demo
plug-in, we actually have a bunch of interesting and useful Python
plug-ins.

Furthermore, we are running several Python scripts through GIMP during
our build (to generate a few images), so pygobject becomes a build
dependency anyway, even if it may not be a run dependency with
-Dpython=disabled.

This all becomes a bit confusing and in fact handling this case (of not
installing Python plug-ins) seems like an annoyance while we lose good
core plug-ins. So let's just make Python plug-ins mandatory. It's not
like Python is very controversial these days, and AFAWK, it is available
on every platform out there.
2024-08-09 01:01:58 +02:00
Bruno Lopes d5f41b296b build/windows, data, extensions, plug-ins: Fix Build omissions
- Fix "no icons" errors generating loaders.cache with .cmd (CI-Cross).
  ! This is a sub-optimal fix, but it's better than a useless build.

- Fix "no interpreter" errors generating .interp with Meson (CI-Native)
  and generating .interp and copying .typelib with .cmd (Local-Native).
  ! This is a sub-optimal fix to Local-Native, but plug-ins will work.

- Fix "no iso" error copying iso_639.xml with Meson (Local-Native).
2024-01-02 10:49:31 +00:00
Jehan 1d50c81130 libgimp, plug-ins, extensions: gimp_image_procedure_new2() renamed gimp_image_procedure_new(). 2023-10-01 21:02:34 +02:00
Alx Sa 22cb6b3bb6 plug-ins: port goat-exercise to gimp_image_procedure_new2()
Not yet porting to GimpProcedureDialog because there's no settings to import/export,
so it would add several unnecessary buttons.
2023-10-01 20:52:02 +02:00
Anders Jonsson 095af5629c extensions: more i18n for goat-exercises 2023-07-22 15:16:42 +00:00
Michael Natterer 26dce72d2c Remove autotools 2023-05-27 00:03:52 +02:00
Lukas Oberhuber bce3bf23de goat-exercise: fix ability to load js
However, this is still currently crashing on MacOS.
2022-10-04 18:02:38 +01:00
Jehan ca230cb770 meson: fix warnings of deprecated features.
Now that we bumped our meson requirement, meson is complaining about
several features now deprecated even in the minimum required meson
version:

s/meson.source_root/meson.project_source_root/ to fix:

> WARNING: Project targets '>=0.56.0' but uses feature deprecated since '0.56.0': meson.source_root. use meson.project_source_root() or meson.global_source_root() instead.

s/meson.build_root/meson.project_build_root/ to fix:

> WARNING: Project targets '>=0.56.0' but uses feature deprecated since '0.56.0': meson.build_root. use meson.project_build_root() or meson.global_build_root() instead.

Fixing using path() on xdg_email and python ExternalProgram variables:

> WARNING: Project targets '>=0.56.0' but uses feature deprecated since '0.55.0': ExternalProgram.path. use ExternalProgram.full_path() instead

s/get_pkgconfig_variable *(\([^)]*\))/get_variable(pkgconfig: \1)/ to
fix:

> WARNING: Project targets '>=0.56.0' but uses feature deprecated since '0.56.0': dependency.get_pkgconfig_variable. use dependency.get_variable(pkgconfig : ...) instead
2022-08-31 01:29:37 +02:00
Anders Jonsson e601a6c7de Change GTK+ to GTK
GTK got rid of the + in 2019:
https://lwn.net/Articles/779305/
2022-07-07 14:02:36 +00:00
Jehan 8122e8cf36 extensions: fix builds after MR !653 (migrating to gettext).
(1) On recent meson versions, it fixes this error:

> extensions/goat-exercises/meson.build:108:0: ERROR: i18n.merge_file keyword argument 'output' was of type array[str] but should have been str

As docs explains, 'output' only accepts one item in i18n.merge_file().

This bug also happens on older meson (but there the reported error is a
lot less useful as it doesn't mention local meson build code).

(2) `setup.isl.xml` is a temporary intermediary file used to create the
    Windows installer. It must not be installed.

(3) `gimp30-windows-installer.mo` itself is only used to create
    `setup.isl.xml`. It must not be installed as well.

(4) gimp-tips.(its|loc) files (same for gimp-tags ones) should not be
    installed. They are only temporary data.

(5) Fix environment variable: s/GETTEXT_DATA_DIRS/GETTEXTDATADIRS/

Fixes:

> /usr/bin/msgfmt: cannot locate ITS rules for ../../../data/tips/gimp-tips.xml.in

(6) Fix various bugs in the *.setup.isl files creation in autotools
    build (typo, wrong files used, order of options in `xsltproc`
    apparently meaningful, and so on. I guess the autotools build was
    not as well tested as the meson one :P).

(7) Fixing the unit test verifying language lists consistency.

(8) `setup.isl.xml.in` must be added to the distribution.
2022-06-25 12:41:21 +02:00
Niels De Graef f663d26ab5 Migrate from intltool to gettext
intltool has long been dead upstream. Let's not poke the dead corpse,
please.

This commit is quite large, but that's mostly since trying to support a
hybrid of both gettext and intltool with both Meson and Autotools was
really hard, so I stopped trying.

Due to gettext relying on quite some things being at the exactly right
place in the autotools build (like `ABOUT-NLS` and `config.rpath`) we
really needed to cleanup the `autogen.sh` to only call `aclocal` and
`autoreconf`. No more strange magic; I tried to do it without changing
too much in the file, and things just broke. If people want to do
something more custom, they can just change the script directly. This
change also uncovered some problems in our `configure.ac`, like using
deprecated macros.

The following major changes happened:

* meson: Changed `custom_target()` to `i18n.merge_file()` for all
  supported file types
* Added `.its` and `.loc`  files for the GIMP-specific XML formats, so
  that gettext understands them
* For the `.isl` (Window installer stuff) file, there's no easy way to
  do this in gettext, so instead we start from an XML file (again with
  its own ITS rules etc), translate that with gettext, and then use
  `xsltproc` with a bit of magic to output the .isl file for each
  language
* the `po*/Makefile.in.in` files are migrated to `Makevars` files,
  which gettext natively understands.

Fixes: https://gitlab.gnome.org/GNOME/gimp/-/issues/8028
2022-06-25 10:25:49 +02:00
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
Jehan c02b4836dd extensions: remove call to gettext.bind_textdomain_codeset().
I added this call originally, mimicking the C plug-ins. Yet in Python,
this function is deprecated since Python 3.8 and removed in 3.10.
Looking closer in the docs, it looks like Python's gettext module works
differently.

While all the *gettext() functions return strings in the locale's
encoding in C, unless overriden by bind_textdomain_codeset() (therefore
we need this call, in order to have locale-independent string encoding),
this is not the case in Python, whose gettext() call is already
locale-independent. The gettext.bind_textdomain_codeset() function only
applies to the specific l*gettext() functions which are deprecated too.

Fixes the warning:

> goat-exercise-py3.py:37: DeprecationWarning: bind_textdomain_codeset() is deprecated
2022-05-25 10:59:12 +02:00
Jehan 58353a940a build, extensions, po-windows-installer: update gitignore. 2022-03-28 21:46:02 +02:00
Lukas Oberhuber 5ad5f67ad0 goat-exercises: fix vala build problem
Problem appeared on mac and also on debian unstable. This is autotools
only as `--disable-since-check` is present
in meson.build.

Fix suggested by @nielsdg.

```
make[3]: Entering directory '/Users/distiller/.cache/jhbuild/build/gimp/extensions/goat-exercises'
  CC       goat-exercise-c.o
/Users/distiller/gtk/inst/bin/intltool-merge /Users/distiller/gtk/source/gimp/po-plug-ins org.gimp.extension.goat-exercises.metainfo.xml.in org.gimp.extension.goat-exercises.metainfo.xml -x -u -c ../../po-plug-ins/.intltool-merge-cache
  VALAC    goat_exercise_vala_vala.stamp
Generating and caching the translation database
  CCLD     goat-exercise-c
/Users/distiller/gtk/source/gimp/extensions/goat-exercises/goat-exercise-vala.vala:28.10-28.18: error: `Gimp.main' is not available in gimp-3.0 2.99.9. Use gimp-3.0 >= 3.0
  return Gimp.main(typeof(Goat), args);
         ^^^^^^^^^
```
2022-02-08 15:24:15 +00:00
Jehan e0299ead94 extensions: fixing Vala goat-exercise build (Vala lib renamed). 2022-02-02 17:03:44 +01:00
Jehan edf0d081bd devel-docs, extensions: more gitignore updates. 2022-02-02 14:18:51 +01:00
Jehan 931f44e54a extensions: update the 5 goat-exercise extensions to multi-drawable API. 2021-04-06 01:55:52 +02:00
Jehan 353c73457a app, libgimp, libgimpconfig, extensions: image procedures now with…
… drawable array instead of a single drawable.

Instead of expecting a single drawable, GimpImageProcedure's run()
function will now have an array of drawable as parameter.
As a consequence, all existing plug-ins are broken again. I am going to
fix them in the next commit so that this change can be easily reviewed
and examined if needed later.

I only fix the Vala demo plug-in now (or rather, I just use the first
layer in the array for now) because otherwise the build fails.
2021-04-04 01:40:00 +02:00
Jehan 5c03dd1677 extensions: goat-exercise appdata depends on po files.
Make sure we regenerate the appdata file when po files are updated. It
should not be too much of a problem for release builds made from
scratch, but on incremental dev builds, the appdata was not regenerated
even when new translation got added.
2020-10-22 17:18:43 +02:00
Jehan 0d01567b61 extensions: flag labels and documentation strings for localization…
… with N_().
Also fix the domain in self.set_translation_domain() call.
Actually I'll have to dig deeper in this function which apparently is
only used for menu entries. Yet it does feel quite redundant with
calling textdomain() and other gettext calls ourselves. Probably we can
make plug-in localization more straightforward.
2020-10-18 11:55:52 +02:00
Jehan d4598ddefd extensions: fix localization of the Python 3 goat exercise.
We must set the correct gettext domain and bind it to the appropriate
directory for it to be localized appropriately.
2020-10-18 01:42:37 +02:00
Jehan 326b2feddb extensions: do not build Vala plug-in without GObject Introspection.
Though GObject Introspection is normally not an option, the only case we
don't build it yet is when cross-compiling (as we haven't found the
right way to do it). So let's not build the Goat Exercise plug-in in
Vala in such case as we needed the introspected libgimp.
2020-10-18 00:34:02 +02:00
Jehan 22b516a1cc extensions: Lua and Python 3 goat-exercise procedure name consistency.
All our plug-ins are named "plug-in-*", and in particular our goat
exercise plug-ins are all named "plug-in-goat-exercise-*". Only the
Python 3 and Lua were named differently. This fixes the inconsistency.
2020-10-17 21:48:12 +02:00
Jehan 228ad503ad extensions: update the remote URI for the up-to-date source code.
When moving the Goat Exercise plug-ins as extensions, I forgot to update
the remote URI which is opened when clicking the "Source" button.
2020-10-17 19:42:11 +02:00
Jehan a9a9bb7cc0 extensions: removing a bunch of useless semicolon on Python script.
Probably forgotten remnants from the C to Python port, as I copy-pasted
the C plug-in and converted each line of code to Python 3, one by one.
These semicolons are not breaking the plug-in, but that is still not
very "Python-style". Let's say it's valid, though useless in this case
and clearly not considered beautiful Python.
2020-10-17 19:35:41 +02:00
Jehan b9ad5d46cc extensions, po-plug-ins: fix localization of extension metadata.
The metadata format being appdata, I simply use standard intltool
merging on the XML templates.
For Automake, I use a custom rule instead of INTLTOOL_XML_RULE because
the m4 macro hardcoded $(top_srcdir)/po as translation source directory
(yet we want to use po-plug-ins/ for these). Meson on the other side
already used a custom command.
2020-10-10 14:04:59 +02:00
Jehan ecbc38f9e9 plug-ins, extension: goat-exercises becomes a GIMP extension.
This is an extension containing a few demo plug-ins. This is good to
demonstrate the extension format. It will also allow to disable these
plug-ins (if at some point, one doesn't want to show these demo
plug-ins anymore).

And finally it deals with the fact that our plug-in code is stupid, as
it just tries to find the first executable with the same name (minus
extension) as the plug-in folder. This doesn't go well on Windows, where
the permission system is non-existent. So our code just ends up trying
to run the first file with a similar name in a plug-in folder. As the C
goat-exercise contains both an exe and the C source (and the system
probably returns files in alphabetic order), GIMP under Windows tries to
run the C source instead of the executable (this obviously doesn't go
well).
We could try to do more complex logics, like not aborting if the first
file run fails and try the next one in the plug-in folder. Or maybe just
rename the C file to another name. But any of these is just in the end
the proof that our plug-in discovery right now is just bogus. The
extension system is explicit, not based on randomly trying out files.
Plug-ins entry points are explicitly listed in the metadata manifest.
2020-10-09 15:30:54 +02:00