Commit Graph

166 Commits

Author SHA1 Message Date
Jehan 1993f7461a meson: API binding options transformed to features.
- Lua, Javascript and Python were boolean defaulting to true, which was
  installing them even when not available (and if not installed then, it
  would show warnings at each run). Instead I make them features with
  'auto' as default. In this default, we don't install when the
  interpreters are absent.
- These 3 options can still be forced by setting them to 'enabled' (the
  interpreters are not actually necessary during build).
- Vala behavior stay the same (and unlike other binding, you cannot
  force it since it has a build step); it's only renamed to just "vala"
  for consistency of option naming.
2023-04-05 16:46:10 +02:00
Alx Sa 6892ab0530 plug-ins: Add import/export support for QOI file
Allows users to import and export 8 bit, RGB/RGBA Quite Ok Images.
Inspired by Piotr Fusik's work on a plug-in for 2.10.
2023-03-30 18:41:56 +00:00
Jacob Boerema 078cccf4f5 build, meson: fix headless tests not being run with meson
I noticed that in our CI meson job certain tests were skipped, which didn't
happen with autotools.
On examination I noticed these tests check for HAVE_XVFB_RUN. Even though
meson checks for xvfb-run etc, it doesn't set HAVE_XVFB_RUN.

Adding HAVE_XVFB_RUN allows the tests to run without skipping certain parts.
2023-03-26 13:26:57 -04:00
Luca Bacci cfaaec6347 Use ExcHndlSetLogFileNameW ()
This is a Dr.MinGW function
2023-01-24 14:48:44 +00:00
Jehan 48c1d07600 meson: fix cross-building GIMP.
We don't want to fail the build configuration just because we can't test for
runtime dependencies. In such a case, just assume it's good as we at least have
libheif and we can compile.
Fixes:

> ../meson.build:756:2: ERROR: Can not run test applications in this cross environment.
2023-01-24 15:44:50 +01:00
Jehan e4ace369c1 meson: list both AVIF and HEIC mimetype support if the plug-in is built.
Even though, some format support might be missing, since codecs can be added at
runtime, it can always change later without having to touch GIMP. Yet we won't
be able to edit the desktop file when this happens.

See new comments in #9080.
2023-01-23 19:38:19 +01:00
Jehan 706cff2037 meson: VALA language is only needed for the build target.
Without this change, meson outputs this warning:

> meson.build:868: WARNING: add_languages is missing native:, assuming languages are wanted for both host and build
2023-01-23 19:19:10 +01:00
Jehan 7b0064107e Issue #9080: Checking for available libheif codecs at compile-time.
From libheif >= 1.14.0, the pkg-config variable will become bogus and always
return 'yes' so we now need to check for codec avaibility at compile time the
same way we look for these at runtime.

It may seem irrelevant to do these checks since these codecs can be added
anytime later, but it's still very good information for packagers to immediately
see that we have runtime package missing.
2023-01-23 19:01:38 +01:00
Jehan 704c868ca1 meson: add a 'name' arg to the IPC_RMID compile/run test.
It makes for easier to read logs and build files. Also fixing a typo in the
original text from autotools.
2023-01-23 18:33:12 +01:00
Jehan decdb2ba3f meson: Improve C99 compatibility of IPC_RMID check.
See previous commit and !810. Porting the autotools fix we made there to the
meson build too.
2023-01-23 18:13:18 +01:00
Alx Sa 74b32f7c86 build: Add support for OpenMP dependency
Enables general support for OpenMP.
Currently, only the DDS plug-in utilizes it.
2023-01-09 16:41:06 +00:00
Stanislav Grinkov fa9f4e6825 app, build: depend on GLib 2.70
Commit 52d17439 introduced use of g_thread_pool_new_full which is
available only since GLib 2.70
2023-01-09 14:20:21 +00:00
Jehan 8ab38eb883 meson: fix the shared object version.
The current code was wrong, hence was producing wrongly versioned shared
library files. This commit do it the same way as we do it on autotools build,
and additionally compute the library version (since "current:revision:age" gets
transformed into "(current - age).age.revision" by libtool, but meson doesn't
use libtool so we have to do this ourselves).

Now meson and autotools builds produce the same result at least. There are still
some points I'm wondering and which we should handle before GIMP 3.0 release:

* Since meson doesn't use libtool (and no .la files are created), should we
  actually stick to libtool version scheme? It seems like some projects would
  use semver instead. On the other hand libtool version gives a bit more info.
* Also it raises the question on whether we want the API version to be semver at
  all or simply follow GIMP version? It used not to be much of a problem as we
  wouldn't add features (hence new API) on micro version, yet now we can. So
  GIMP program's version could not pass as semantic versioning. On the other
  hand, having a diverging API version (whose minor version would increment
  faster in particular, with regular micro version resets) would be confusing
  too.
* If we keep libtool versioning, I'm thinking we should do it manually. It's
  actually pretty easy with a good docs (or even just following GNU docs:
  https://www.gnu.org/software/libtool/manual/html_node/Updating-version-info.html),
  and simple to understand whereas the current code logic is very weird and we
  end up with huge current and age values with complicated computation.

Note also that I raise the "Libtool versioning" section near meson.build top and
updated gimp_interface_age to be the same as on autotools currently.
2022-12-12 19:58:17 +01:00
Jehan 04a78154e1 meson: take into account babl's pkg-config name change.
See babl!52 (babl commit b8da847) and gimp#8912.
2022-12-05 14:34:48 +01:00
Jehan 8c5e3887f9 configure.ac, meson.build: post-release version bump to 2.99.15. 2022-11-14 01:20:27 +01:00
Jehan a0811ff614 Release development version GIMP 2.99.14. 2022-11-13 23:04:38 +00:00
Øyvind Kolås 06b481a3ec meson, configure, app: depend on babl 0.1.98 2022-11-13 17:31:32 +01:00
Øyvind Kolås b85032d8b6 meson, configure, app: depend on GEGL 0.4.40 2022-11-13 17:16:49 +01:00
Daniel Novomeský eac694905f plug-ins: metadata import/export for JPEG XL format
Changes require libjxl 0.7.0
2022-10-05 14:15:26 +00:00
Jehan 646bc3e43b Issue #8604: NetBSD does not provide libdl.
The dl*() functions are in libc directly. This probably applies to all
*BSD too. And from what I read, it should even apply to macOS, even
though a libdl is present there (is it bogus?).

So let's make the libdl check proper by only make it mandatory on Linux
(on Windows it was already unchecked too).
2022-09-10 17:42:28 +02:00
Jehan a78651aca4 Issue #8604: Linux Input is enabled even though it is not Linux.
Fix the Linux Input test to correctly only depend on whether or not the
header is present. Having X11 target is not enough (e.g. it breaks the
build for NetBSD and probably on all BSDs).
2022-09-10 14:50:38 +02:00
Jehan fbb5b40345 app, autotools, meson: new GIMP_RELEASE macro.
We were using GIMP_UNSTABLE extensively to differentiate development
from stable code. But there is actually another level of development
code. Basically GIMP_UNSTABLE tells you are on the development branch,
e.g. for current branches, that you are on 2.99.* versions (vs. 2.10).
This depends on the minor version oddness.

GIMP_RELEASE will tell you if it's a release or a in-between-releases
code. This works with the micro version which must be even on release.
Any odd number means you are basically using random git code.

There can be any combination of GIMP_RELEASE and GIMP_UNSTABLE. For
instance 2.99.12 is a release of the unstable branch, whereas 2.10.33 is
development code of the stable branch.

I use this first in the update code as we were using GIMP_UNSTABLE for
both concepts but it made it harder to test. Now:

* GIMP_DEV_VERSIONS_JSON environment variable is only available on
  development code, not on release (whether stable or unstable).
* The weekly check limitation is also only for releases (dev code just
  check at every startup to quickly detect issues and regressions).
* Whether to look on testing website or public website json file depends
  on the code being a release or not.
* Finally only whether to check "DEVELOPMENT" or "STABLE" sections in
  the json file depends on whether we are on stable or unstable
  branches.
2022-09-05 22:16:56 +02:00
Jehan d4f12a843a Issue #8561: unrecognized command-line options '-mmx', '-sse'.
Fixes:

> gcc: error: unrecognized command-line options '-mmx'; did you mean '-mmmx'?
> gcc: error: unrecognized command-line options '-sse'; did you mean '-msse'?
2022-08-31 15:31:00 +02:00
Hanabishi 358ba0991f Cleanup meson symlinks
More elegant solution to avoid platform-dependent executable extension detection
2022-08-31 13:10:13 +00:00
Jehan 99d16a6f31 meson: fix one more deprecation warning when cross-building.
This meson warning was only showing when configuring a cross-compilation
project.

Fixes:

> WARNING: Project targets '>=0.56.0' but uses feature deprecated since '0.55.0': meson.has_exe_wrapper. use meson.can_run_host_binaries instead.
2022-08-31 12:42:08 +02:00
Jehan a791151ed0 meson: update the end WARNING about meson being experimental.
Now we call it "extensive testing phase" and encourage packagers to use
meson and report bugs.
2022-08-31 01:40:12 +02: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
Jehan dd53de0f0b meson: bump our requirement to meson 0.56.0.
For meson, I want to be particularly careful and not follow the "Debian
testing" rule as it bit us by the past for babl.
But this bump is probably OK:

* Debian stable has meson 0.56.2.
* meson 0.56.0 was released on 2020-10-30.
* GIMP 2.99 is a dev branch with no end release date yet.

This should also fix this warning at configuration time:

> WARNING: Project specifies a minimum meson_version '>=0.53.0' but uses features which were added in newer versions:
>  * 0.55.0: {'Calling "add_dist_script" with File, CustomTarget, Index of CustomTarget, Executable, or ExternalProgram'}

We missed it until now because it was only happening with tarball builds
where gitversion_h could be a files() object, unlike in git builds.
2022-08-31 00:15:36 +02:00
Jehan 9ce27be989 meson: improve/fix previous commit from MR !725.
- Setting an exec_dir variable is an error. As meson docs says, if
  relative, it is installed relatively to prefix anyway: "If this is a
  relative path, it is assumed to be relative to the prefix."
  On the other hand, it would make problems if someone tried to set an
  absolute bindir.
  Moreover it is a lot clearer now. When we want to install in the
  binary directory unconditionally, then get_option('bindir') is the
  meson way, hence the way to go.
- On the other hand, the `gimp-debug-tool` is installed either in bindir
  for Windows or macOS and libexecdir for all other platforms, at least
  that's how it's set in the autotools build. So let's keep both builds
  consistent.
- Make a hopefully clearer description for enable-default-bin option.
  Let's clarify this is just about creating unversionning links pointing
  to versionned files.
- Adding an item in the "Optional Features" part of the summary listing
  during meson configure, for better discovery.

For the ".exe" extension on Windows, I wished we had an $(EXEEXT)
equivalent on meson rather than trying to set it ourselves (are there
other platforms where we must set a different extension?). But I could
not find any.
2022-08-29 15:43:25 +02:00
Hanabishi 879f7b48de Issue #8546: Meson options fixes
- Implement `enable-console-bin` meson option
- Fix wrong `enable-default-bin` behavior in docs
- Implement `enable-default-bin` meson option
2022-08-29 13:41:08 +00:00
Jehan ba83b30c21 configure.ac, meson.build: post-release version bump to 2.99.13. 2022-08-22 01:44:45 +02:00
Jehan b1e13b5a15 Release development version GIMP 2.99.12. 2022-08-21 21:21:38 +02:00
Jehan ef85c51a58 Issue #7907: work around possible outdated data in meson tarball.
`meson dist` don't imply a reconfigure or a rebuild which is actually
not great as it means a wrong order of commands may create tarballs with
outdated data (typically: build, then pull new code, then dist).

Of course for our official tarballs, it should be fine as we don't
generate tarballs manually anymore, but through the CI. Yet, just to be
on the safe side, force-trigger a reconfigure then a build (which would
likely be very fast anyway in the common use case where we just did a
build right before).

Additionally the INSTALL.in file is not copied anymore in the tarball
and INSTALL will only be generated in git repositories.
2022-08-02 16:06:51 +02:00
Jehan f5751ec687 libgimp: don't run defcheck.py on Windows.
Ironically, it is a test for the Windows platform but it cannot run on
Windows. First, because it expects a .so (which could be easily fixed),
but even more because from web search, it looks like the nm tool may not
exist on Windows (though I haven't checked).

Anyway we only ever ran it from Linux machines and up to now, it worked
just fine and was useful anyway. So let's go with it.

Also clean a bit remnants from older attempts to run this script.
2022-08-01 23:34:50 +02:00
Jehan 106f2a061d 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
2022-08-01 19:59:53 +02:00
Jehan 2ac483f9e3 meson: make run_command() calls future-proof.
Some of our calls to run_command() would have failed with future
versions of meson if we didn't set the "check" parameter. In particular,
in various calls, we don't want to fail the whole build configuration
when the command does (as it's an optional feature check). In such a
case, it is important to be explicit as future will default to fail
then.

Fixes:

> WARNING: You should add the boolean check kwarg to the run_command call.
>          It currently defaults to false,
>          but it will default to true in future releases of meson.
>          See also: https://github.com/mesonbuild/meson/issues/9300
2022-07-31 18:23:00 +02:00
Lukas Oberhuber 831623f33f meson, macos: missing libraries and directories
These changes make it possible to build against homebrew for mac
libraries. Homebrew stores it's libraries in seperate folders and so
blanket includes were not working.

PYTHONPATH is not needed and interferes with homebrew build.
2022-07-21 13:25:22 +00:00
Øyvind Kolås 6cc1e035f1 app, configure, meson: depend on GEGL-0.4.38 2022-07-13 23:31:24 +02:00
Jehan 25e35e17fe app: detect system language with a more robust logic.
langinfo.h is not on all systems apparently and/or the locale item we
test for may not be available everywhere. Actually even on Linux, after
testing more deeply, I could create cases where nl_langinfo() would not
return a result (if the locale is broken through environment variable
for instance). setlocale() seems to always return usable value so far,
so I fallback on it. As a last resort, I look at environment variables
(even though these may contain invalid contents.

As for Windows and macOS, I try to use more platform-specific methods.
In macOS in particular, as I understood from reports, GIMP follows
correctly the language preference order, which means we should not look
at a single (top) lang, but at the whole list of prefered languages as a
single settings to determine whether the language was changed or not.

Should fix on Windows:

> fatal error: langinfo.h: No such file or directory

and on macOS:

> error: use of undeclared identifier '_NL_IDENTIFICATION_LANGUAGE'
2022-07-07 18:58:50 +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
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 19204d7f97 meson: test version of appstreamcli.
Since the new AppStream URL types are only available since appstream
0.15.3.

Thanks to Eli Schwartz for notification of the availability of the
'version' option, even in find_program().
2022-05-05 14:38:31 +02:00
Jehan 73f1f944c5 desktop: use appstreamcli for testing instead of appstream-util.
As told to us, this is the reference AppStream file testing tool, and it
understands more of the spec.

Also since commit 73e2e701da, appstream-util chokes on newer url types
from the spec. These tags are now supported both in appstream-util and
appstreamcli source code, except that appstreamcli had release 0.15.3,
available in Debian testing, whereas there were apparently no recent
appstream-glib/util release (and none since 2020). So for these various
reasons, let's go with the appstreamcli tool.

The only downside is that appstream package (where appstreamcli lives)
is not available on MSYS2, but since it's only an optional test tool for
XML files which should be common on all platforms, it's probably
acceptable.
2022-05-03 21:48:28 +02:00
Jehan 2cfe18fcf7 meson: not discouraged anymore on Windows. 2022-04-01 20:02:46 +02:00
Jehan b83450f9e2 configure, meson: the build tool depends on very old glib.
For the build tool, we really don't need a recent GLib. Checking the few
function docs, GLib 2.2 is fine, which (looking at git logs) means any
version after 2002. At this point, it's nearly unneeded to add a minimum
required version, but let's be thorough.

Anyway really no need to block a build if we have an old build GLib,
which is completely enough, as long we have the recent host GLib.
2022-04-01 18:11:55 +02:00
Jehan 1c730ce141 meson, plug-ins: further fix the no-pkg-config test for libmng.
As suggested by jeremyd2019 and Biswa96 of MSYS2 project, defining the
MNG_USE_DLL macro would trigger libmng header code to fix the calling
convention. This way, even the old detection code now works with Windows
32-bit.

The reason why we still stick to this old detection code is that the
pkg-config is likely not everywhere (e.g. in Debian package libmng-dev,
there is no `.pc` file). So the pkg-config test is good but we still
definitely need to keep our fallback more old-school test for this
dependency.

See this comment in particular:
https://github.com/msys2/MINGW-packages/issues/11136#issuecomment-1084627263

Note: I am unsure yet how to apply the same trick on the autotools test
because AC_CHECK_LIB() would allow us to tweak the cflags to define a
macro, but we also need to include libmng.h header, otherwise the
calling convention tweak is not run. It doesn't look to be feasible with
the autoconf macro, or at least I haven't found how yet.
2022-04-01 18:11:55 +02:00
Jehan c9a34b88a6 meson: fix libmng test.
The main problem was that file-mng would fail to build on Windows 32-bit
even though the lib was detected. Actually this is because there are
several possible calling conventions and this can be handled by defining
the proper macro. This macro is well defined in the pkg-config file, but
our build was not using it.

So let's change the test to use pkg-config first. If this fails, we
fallback to more basic method of finding the library. Additionally we
augment this fallback test with a function check (as we do already in
autotools) so that our configure test is reliable: we verify that the
lib is there **and** that symbols are visible. Otherwise we'd end up
with a successful configure test followed by a broken build (as until
now in meson).

See the nice explanation here and in next messages:
https://github.com/msys2/MINGW-packages/issues/11136#issuecomment-1083711452
2022-04-01 17:33:38 +02:00
Jehan b27dd3ddaa meson: fix broken directx declare_dependency().
The `link_with` arg only accept library targets which are the libraries
we build ourselves, whereas dependency objects (such as returned by
cc.find_library()) must be in the `dependencies` arg.

Yes me too, making a difference here kind of stun me a bit and I don't
get why it's needed, but so be it. Since this code dates back from the
original commit, I assume it means the directx option just never worked
with meson on Windows.

Fixes:

> ../meson.build:847:2: ERROR: Entries in "link_with" may only be self-built targets,
> external dependencies (including libraries) must go to "dependencies".
2022-04-01 17:33:38 +02:00
Jehan 79615541d9 Issue #4291: meson: pdbgen not working.
The build now successfully build the PDB files into the source folder
itself. Unfortunately it seems I can't get meson dependencies to work
properly, once more! I added a "sources" argument to the relevant
library() or static_library() but it still uses old versions to build
these. E.g. if I add an error on purpose to a pdb file, the next build
still passes, yet the second-next fails (as it should have before).

Note that I even tested a declare_dependency() with just the "sources"
arguments, because it says "sources to add to targets (or generated
header files that should be built before sources including them are
built)" (so I assume it means that it should be trigger a rebuild,
otherwise it's useless) but it's just not working. I'll investigate
more.

Still going with this for now, because at least generating the PDB
source was a big miss until now. But we should
2022-03-27 22:18:44 +02:00
Jan Tojnar 0c7a980bc1 meson: Fix dist script 2022-03-18 16:05:58 +00:00