build, tools, gimp-data: removing gimp_exe_config_dir from the root meson.build.

Creating a temporary config directory for the in-build GIMP (run as a tool or
for unit-testing) is not done as a build target anymore, but in the
in-build-gimp.sh script as a unique temp directory, then cleaned out on exit.
This has a few advantages:

- It is properly cleaned out once the build ends (instead of leaving a full
  config dir as trash inside the build dir).
- It is not reused from one build to another (with risk of carrying bugs and
  issues over).
- Every use of the in-build GIMP will have its own config directory, and in
  particular when they are called in parallel.

As a side update, make sure that all `gimp_exe` runs depend on
`gimp_exe_depends`.
This commit is contained in:
Jehan 2024-04-21 22:37:45 +02:00 committed by Bruno Lopes
parent a54253db04
commit 2f9881c03f
6 changed files with 60 additions and 39 deletions

View file

@ -278,7 +278,9 @@ gimp-debian-x64:
# and appstream-cli get confused with our exotic naming and fails # and appstream-cli get confused with our exotic naming and fails
- cd .. - cd ..
- git apply -v build/linux/appimage/patches/0001-desktop-po-Use-reverse-DNS-naming.patch - git apply -v build/linux/appimage/patches/0001-desktop-po-Use-reverse-DNS-naming.patch
- git apply -v build/linux/appimage/patches/0001-images-logo-Use-reverse-DNS-naming.patch - cd gimp-data
- git apply -v ../build/linux/appimage/patches/0001-images-logo-Use-reverse-DNS-naming.patch
- cd ..
- meson configure _build${ARTIFACTS_SUFFIX} -Drelocatable-bundle=yes -Dvector-icons=true - meson configure _build${ARTIFACTS_SUFFIX} -Drelocatable-bundle=yes -Dvector-icons=true
- cd _build${ARTIFACTS_SUFFIX} - cd _build${ARTIFACTS_SUFFIX}
- ninja - ninja

View file

@ -1,16 +1,16 @@
From f84e5cdc3e671491e45ec839af97f61e2272d78c Mon Sep 17 00:00:00 2001 From dfd4f599b80883a649175dd76a2f2ea71388cc18 Mon Sep 17 00:00:00 2001
From: Bruno Lopes <brunolopesdsilv@outlook.com> From: Bruno Lopes <brunolopesdsilv@outlook.com>
Date: Sat, 30 Mar 2024 16:13:10 -0300 Date: Sun, 21 Apr 2024 20:22:35 -0300
Subject: [PATCH] images/logo: Use reverse DNS naming Subject: [PATCH] images/logo: Use reverse DNS naming
--- ---
gimp-data/images/logo/meson.build | 8 ++++---- images/logo/meson.build | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-) 1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/gimp-data/images/logo/meson.build b/gimp-data/images/logo/meson.build diff --git a/images/logo/meson.build b/images/logo/meson.build
index bf0a5ea..4ec96a1 100644 index 394a9a3..8af98eb 100644
--- a/gimp-data/images/logo/meson.build --- a/images/logo/meson.build
+++ b/gimp-data/images/logo/meson.build +++ b/images/logo/meson.build
@@ -57,21 +57,21 @@ desktop_sizes = [ @@ -57,21 +57,21 @@ desktop_sizes = [
foreach size : desktop_sizes foreach size : desktop_sizes
sizedir = size + 'x' + size sizedir = size + 'x' + size
@ -35,7 +35,7 @@ index bf0a5ea..4ec96a1 100644
- rename: 'gimp.svg') - rename: 'gimp.svg')
+ rename: 'org.gimp.GIMP.svg') + rename: 'org.gimp.GIMP.svg')
## gimp.ico (Windows) ## ## gimp.ico and fileicon.ico (Windows) ##
-- --
2.44.0.windows.1 2.44.0.windows.1

View file

@ -130,6 +130,7 @@ foreach scale : scales
med_tile = custom_target(icon_name, med_tile = custom_target(icon_name,
input : [ gen_medtile_py ], input : [ gen_medtile_py ],
depend_files: [ wilber_path ], depend_files: [ wilber_path ],
depends: [ gimp_exe_depends ],
output: [ icon_name ], output: [ icon_name ],
command: [ gimp_exe, '-nidfs', command: [ gimp_exe, '-nidfs',
'--batch-interpreter', 'python-fu-eval', '--batch-interpreter', 'python-fu-eval',
@ -167,6 +168,7 @@ foreach scale : scales
small_tile = custom_target(icon_name, small_tile = custom_target(icon_name,
input : [ gen_smalltile_py ], input : [ gen_smalltile_py ],
depend_files: [ wilber_path ], depend_files: [ wilber_path ],
depends: [ gimp_exe_depends ],
output: [ icon_name ], output: [ icon_name ],
command: [ gimp_exe, '-nidfs', command: [ gimp_exe, '-nidfs',
'--batch-interpreter', 'python-fu-eval', '--batch-interpreter', 'python-fu-eval',
@ -202,6 +204,7 @@ foreach scale : scales
large_tile = custom_target(icon_name, large_tile = custom_target(icon_name,
input : [ gen_largetile_py ], input : [ gen_largetile_py ],
depend_files: [ wilber_path ], depend_files: [ wilber_path ],
depends: [ gimp_exe_depends ],
output: [ icon_name ], output: [ icon_name ],
command: [ gimp_exe, '-nidfs', command: [ gimp_exe, '-nidfs',
'--batch-interpreter', 'python-fu-eval', '--batch-interpreter', 'python-fu-eval',
@ -240,6 +243,7 @@ foreach scale : scales
wide_tile = custom_target(icon_name, wide_tile = custom_target(icon_name,
input : [ gen_widetile_py ], input : [ gen_widetile_py ],
depend_files: [ wilber_path ], depend_files: [ wilber_path ],
depends: [ gimp_exe_depends ],
output: [ icon_name ], output: [ icon_name ],
command: [ gimp_exe, '-nidfs', command: [ gimp_exe, '-nidfs',
'--batch-interpreter', 'python-fu-eval', '--batch-interpreter', 'python-fu-eval',
@ -273,6 +277,7 @@ foreach scale : scales
custom_target(icon_name, custom_target(icon_name,
input : [ gen_fileicon_py ], input : [ gen_fileicon_py ],
depend_files: [ wilber_path, fileicon_path ], depend_files: [ wilber_path, fileicon_path ],
depends: [ gimp_exe_depends ],
output: [ icon_name ], output: [ icon_name ],
command: [ gimp_exe, '-nidfs', command: [ gimp_exe, '-nidfs',
'--batch-interpreter', 'python-fu-eval', '--batch-interpreter', 'python-fu-eval',
@ -294,6 +299,7 @@ foreach size : sizes
custom_target(icon_name, custom_target(icon_name,
input : [ gen_fileicon_py ], input : [ gen_fileicon_py ],
depend_files: [ wilber_path, fileicon_path ], depend_files: [ wilber_path, fileicon_path ],
depends: [ gimp_exe_depends ],
output: [ icon_name ], output: [ icon_name ],
command: [ gimp_exe, '-nidfs', command: [ gimp_exe, '-nidfs',
'--batch-interpreter', 'python-fu-eval', '--batch-interpreter', 'python-fu-eval',
@ -316,11 +322,11 @@ gen_new_xcf_py = configure_file(
xcf_file = custom_target('New_GIMP_Project.xcf', xcf_file = custom_target('New_GIMP_Project.xcf',
input : [ gen_new_xcf_py ], input : [ gen_new_xcf_py ],
depend_files: [ wilber_path ], depend_files: [ wilber_path ],
depends: [ gimp_exe_depends ],
output: [ 'New_GIMP_Project.xcf', ], output: [ 'New_GIMP_Project.xcf', ],
command: [ gimp_exe, '-nidfs', command: [ gimp_exe, '-nidfs',
'--batch-interpreter', 'python-fu-eval', '--batch-interpreter', 'python-fu-eval',
'-b', '-', '--quit'], '-b', '-', '--quit'],
feed: true, feed: true,
build_by_default: true, build_by_default: true,
env: gimp_run_env env: gimp_run_env)
)

@ -1 +1 @@
Subproject commit d77c9c4c2d3d44c181b1aac1fffeafb0c44f6626 Subproject commit e9762d29e2730786b313663dfba491b8da348e89

View file

@ -1850,6 +1850,7 @@ subdir('app-tools')
# tool. # tool.
gimp_run_env=environment() gimp_run_env=environment()
gimp_run_env.set('GIMP_GLOBAL_BUILD_ROOT', meson.global_build_root())
if meson.can_run_host_binaries() if meson.can_run_host_binaries()
if enable_console_bin if enable_console_bin
@ -1899,8 +1900,6 @@ if meson.can_run_host_binaries()
elif platform_osx elif platform_osx
gimp_exe_depends += [gimp_exe_typelib] gimp_exe_depends += [gimp_exe_typelib]
gimp_run_env.set('GIMP_GLOBAL_BUILD_ROOT', meson.global_build_root())
gimp_run_env.set('GIMP_GI_DIR', gi.get_variable('libdir')) gimp_run_env.set('GIMP_GI_DIR', gi.get_variable('libdir'))
gimp_run_env.set('GIMP_TEMP_UPDATE_RPATH', gimp_real_exe.full_path()) gimp_run_env.set('GIMP_TEMP_UPDATE_RPATH', gimp_real_exe.full_path())
@ -1932,19 +1931,6 @@ endif
gimp_exe = find_program('tools'/'in-build-gimp.sh') gimp_exe = find_program('tools'/'in-build-gimp.sh')
# Use a temporary config directory in the top build root for 2 reasons: first
# because we don't want to pollute any existing user config folder; second
# because the default directory may not be writable (we have the case in macOS
# CI), but the build dir always is.
# XXX We might also want to delete this directory before every use, especially
# when using the binary for testing (ensuring we always start from a fresh
# config). But for now, let's keep it as-is.
gimp_exe_config_dir = custom_target('gimp_exe_config_dir',
output: [ '.tmp-config' ],
command: [ 'mkdir', '-p', '@OUTDIR@' + '/.tmp-config' ],
build_by_default: true)
gimp_run_env.set('GIMP3_DIRECTORY', gimp_exe_config_dir.full_path())
################################################################################ ################################################################################
# Subdirs: part 2 # Subdirs: part 2

View file

@ -2,6 +2,9 @@
set -e set -e
export GIMP3_DIRECTORY=$(mktemp -d ${GIMP_GLOBAL_BUILD_ROOT}/.GIMP3-build-config-XXX)
echo INFO: temporary GIMP configuration directory: $GIMP3_DIRECTORY
if [ -n "$GIMP_TEMP_UPDATE_RPATH" ]; then if [ -n "$GIMP_TEMP_UPDATE_RPATH" ]; then
# Earlier code used to set DYLD_LIBRARY_PATH environment variable instead, but # Earlier code used to set DYLD_LIBRARY_PATH environment variable instead, but
# it didn't work on contributor's builds because of System Integrity # it didn't work on contributor's builds because of System Integrity
@ -38,3 +41,27 @@ if [ -n "$GIMP_TEMP_UPDATE_RPATH" ]; then
done; done;
unset IFS unset IFS
fi fi
# Clean-up the temporary config directory after each usage, yet making sure we
# don't get tricked by weird redirections or anything of the sort. In particular
# we check that this is a directory with user permission, not a symlink, and
# that it's inside inside the project build's root.
if [ -n "$GIMP3_DIRECTORY" ] && [ -d "$GIMP3_DIRECTORY" ] && [ -O "$GIMP3_DIRECTORY" ]; then
if [ -L "$GIMP3_DIRECTORY" ]; then
echo "ERROR: \$GIMP3_DIRECTORY ($GIMP3_DIRECTORY) should not be a symlink."
exit 1
fi
used_dir_prefix=$(realpath "$GIMP3_DIRECTORY")
used_dir_prefix=${used_dir_prefix%???}
tmpl_dir_prefix=$(realpath "$GIMP_GLOBAL_BUILD_ROOT/.GIMP3-build-config-")
if [ "$used_dir_prefix" != "$tmpl_dir_prefix" ]; then
echo "ERROR: \$GIMP3_DIRECTORY ($GIMP3_DIRECTORY) should be under the build directory with a specific prefix."
echo " \"$used_dir_prefix\" != \"$tmpl_dir_prefix\""
exit 1
fi
echo INFO: Running: rm -fr --preserve-root --one-file-system \"$GIMP3_DIRECTORY\"
rm -fr --preserve-root --one-file-system "$GIMP3_DIRECTORY"
else
echo "ERROR: \$GIMP3_DIRECTORY ($GIMP3_DIRECTORY) is not a directory or does not belong to the user"
exit 1
fi