1
1
mirror of https://gitlab.gnome.org/GNOME/gimp.git synced 2025-10-06 01:12:40 +02:00

Issue #7327: Cannot build GIMP3 on MSYS2 using Meson.

This is untested on my side, because the bug only happens on native
builds with meson (our CI has cross-builds with meson and native builds
with autotools and I only do cross-builds locally) but I think/hope it
will work.

Basically we were using .full_path() because these rc files were also
used as input of some configure_file() calls which doesn't like custom
target objects as input (it wants strings or file objects). Yet a bug
in meson didn't like the colon used in native Windows full paths ('C:'
and such) when used in windows.compile_resources(). This has been fixed
by Luca Bacci in: https://github.com/mesonbuild/meson/pull/9368
Yet we just cannot depend on very early meson (or worse dev meson code).

On the other hand, if the input is a custom_tgt object, it uses the
object ID which we give as first parameter of custom_target() so we know
it's appropriately named without colons (such as 'gimp_plugins_rc').
Thus we should not bump into this issue again.

For the few usage in configure_file(), I just add a .full_path() only
when needed at call time.

Last but not least, I replace the bogus `meson --version` call by a
`python3 -c 'exit()'` as advised by Eli Schwartz:
2afa019c70 (note_1284951)

The reason is that it is apparently possible (or will be when some
reimplementation of meson will be done) that the `meson` executable
itself does not exist. On the other hand, `python3` should always be
there, as a mandatory dependency of the build tool.

In order to use an appropriate `python3`, I made the
pythonmod.find_installation() check required in our build (which should
not be a problem since it's a meson requirement as well), even when the
-Dpython option is false (this one depends on other requirements too
anyway, such as version and pygobject). This way I can call this meson
variable of discovered python in my bogus call, instead of calling a
(potentially different) python from PATH environment.
This commit is contained in:
Jehan
2021-10-12 16:00:33 +02:00
parent e43d6217fa
commit 52928e04a5
6 changed files with 16 additions and 18 deletions

View File

@@ -161,7 +161,7 @@ app_gui_links = [
if platform_windows
console_rc_name = 'gimp-console-'+ gimp_app_version
gimp_app_console_rc = configure_file(
input : gimp_plugins_rc,
input : gimp_plugins_rc.full_path(),
output: console_rc_name + '.rc',
copy: true,
)
@@ -179,7 +179,7 @@ if platform_windows
gui_rc_name = 'gimp-'+ gimp_app_version
gimp_app_gui_rc = configure_file(
input : gimp_plugins_rc,
input : gimp_plugins_rc.full_path(),
output: gui_rc_name + '.rc',
copy: true,
)

View File

@@ -12,26 +12,24 @@ configure_file(
configuration: versionconfig,
)
# Basically, the build rules below do nothing (a mere `meson --version` call).
# Basically, the build rules below do nothing (a mere `python -c 'exit()'` call).
# But because they depends on `git-version.h`, meson ensure that it gets built first,
# Then the result of this targets is used in 35+ resource compiler build rules.
#
# Nasty trick indeed, but it fixes race condition issue described in GNOME/GIMP#6257.
meson_command = find_program('meson')
gimp_plugins_rc = custom_target('git-version.h build-time-dependency for gimp_plugins_rc',
gimp_plugins_rc = custom_target('gimp_plugins_rc',
build_by_default: true,
build_always_stale: true,
command: [meson_command, '--version'],
command: [python, '-c', 'exit()'],
depends: [gitversion_h],
output: ['gimp-plug-ins.rc']
).full_path()
)
gimp_app_rc = custom_target('git-version.h build-time-dependency for gimp.rc',
gimp_app_rc = custom_target('gimp_app_rc',
build_by_default: true,
build_always_stale: true,
command: [meson_command, '--version'],
command: [python, '-c', 'exit()'],
depends: [gitversion_h],
output: ['gimp.rc']
).full_path()
)

View File

@@ -918,12 +918,12 @@ perl = find_program('perl5', 'perl', 'perl5.005', 'perl5.004', 'perl')
python3_minver = '>=3.6'
python = pythonmod.find_installation('python3')
message('Found Python @0@'.format(python.language_version()))
have_python = get_option('python')
if have_python
python = pythonmod.find_installation('python3', required: false)
message('Found Python @0@'.format(python.language_version()))
python_found = (
python.found() and
python.language_version().version_compare(python3_minver)

View File

@@ -164,7 +164,7 @@ foreach plugin : common_plugins_list
if platform_windows
plugin_rc = configure_file(
input : gimp_plugins_rc,
input : gimp_plugins_rc.full_path(),
output: plugin_name + '.rc',
copy: true,
)

View File

@@ -14,7 +14,7 @@ foreach plugin_name : file_raw_exes
if platform_windows
plugin_rc = configure_file(
input : gimp_plugins_rc,
input : gimp_plugins_rc.full_path(),
output: plugin_name + '.rc',
copy: true,
)

View File

@@ -10,7 +10,7 @@ plugin_sources = [
if platform_windows
plugin_rc = configure_file(
input : gimp_plugins_rc,
input : gimp_plugins_rc.full_path(),
output: plugin_name + '.rc',
copy: true,
)
@@ -48,7 +48,7 @@ plugin_sources = [
if platform_windows
plugin_rc = configure_file(
input : gimp_plugins_rc,
input : gimp_plugins_rc.full_path(),
output: plugin_name + '.rc',
copy: true,
)