mirror of
https://gitlab.gnome.org/GNOME/gimp.git
synced 2025-07-03 09:23:24 +00:00
build, plug-ins, gitlab: make GIMP runnable from build directory without…
… being installed. There is already most of the main code logic for this, though now plug-ins need to be in their own subdirectories, which breaks for plug-ins/common/ and plug-ins/python/, while I needed plug-ins in both these categories to generate the Windows installer welcome images (file-png, and python-fu-eval in particular). Once again, meson was not very helpful, since all its functions still refuse to output generated files in subdirectories, so I end up duplicating plug-in files with a custom Python script. This should fix the CI. It was working on my machine as GIMP was installed, but such a build rule should work even without GIMP installed. This will also be useful in the future when we'll want to run unit tests of plug-ins through the finale GIMP binary itself.
This commit is contained in:
parent
9ccdd56a36
commit
9e9fe1435a
5 changed files with 76 additions and 4 deletions
32
.gitlab/cp-plug-in-subfolder.py
Normal file
32
.gitlab/cp-plug-in-subfolder.py
Normal file
|
@ -0,0 +1,32 @@
|
|||
#!/usr/bin/python3
|
||||
|
||||
# Equivalent to:
|
||||
# configure_file(input: src,
|
||||
# output: name / src,
|
||||
# copy: true,
|
||||
# install_dir: gimpplugindir / 'plug-ins' / name,
|
||||
# install_mode: 'rwxr-xr-x')
|
||||
# Except that configure_file() does not accept output in a subdirectory. So we
|
||||
# use this wrapper for now.
|
||||
# See: https://github.com/mesonbuild/meson/issues/2320
|
||||
import os
|
||||
import shutil
|
||||
import stat
|
||||
import sys
|
||||
|
||||
src_file = sys.argv[1]
|
||||
dir_name = sys.argv[2]
|
||||
dummy_path = None
|
||||
if len(sys.argv) > 3:
|
||||
dummy_path = sys.argv[3]
|
||||
|
||||
os.makedirs(dir_name, exist_ok=True)
|
||||
|
||||
file_name = os.path.basename(src_file)
|
||||
dst_file = os.path.join(dir_name, file_name)
|
||||
shutil.copyfile(src_file, dst_file)
|
||||
os.chmod(dst_file, stat.S_IRWXU | stat.S_IRGRP | stat.S_IXGRP | stat.S_IROTH | stat.S_IXOTH)
|
||||
|
||||
if dummy_path is not None:
|
||||
# Just touch the dummy file.
|
||||
open(dummy_path, mode='w').close()
|
|
@ -1,6 +1,27 @@
|
|||
subdir('lang')
|
||||
|
||||
source_splash=meson.project_source_root() + '/data/images/gimp-splash.png'
|
||||
|
||||
# make GIMP runnable without being installed.
|
||||
env=environment()
|
||||
|
||||
menu_paths=meson.project_build_root() / 'menus:' + meson.project_source_root() / 'menus'
|
||||
env.set('GIMP_TESTING_MENUS_PATH', menu_paths)
|
||||
|
||||
env.set('GIMP_TESTING_PLUGINDIRS', meson.project_build_root() / 'plug-ins:')
|
||||
env.append('GIMP_TESTING_PLUGINDIRS', meson.project_build_root() / 'plug-ins/python')
|
||||
env.append('GIMP_TESTING_PLUGINDIRS', meson.project_build_root() / 'plug-ins/common/test-plug-ins/')
|
||||
|
||||
env.append('GI_TYPELIB_PATH', meson.project_build_root() / 'libgimp')
|
||||
env.append('LD_LIBRARY_PATH', meson.project_build_root() / 'libgimp')
|
||||
env.append('LD_LIBRARY_PATH', meson.project_build_root() / 'libgimpbase')
|
||||
env.append('LD_LIBRARY_PATH', meson.project_build_root() / 'libgimpcolor')
|
||||
env.append('LD_LIBRARY_PATH', meson.project_build_root() / 'libgimpconfig')
|
||||
env.append('LD_LIBRARY_PATH', meson.project_build_root() / 'libgimpmath')
|
||||
env.append('LD_LIBRARY_PATH', meson.project_build_root() / 'libgimpmodule')
|
||||
env.append('LD_LIBRARY_PATH', meson.project_build_root() / 'libgimpthumb')
|
||||
env.append('LD_LIBRARY_PATH', meson.project_build_root() / 'libgimpwidgets')
|
||||
|
||||
installsplash = custom_target('installsplash-devel.bmp',
|
||||
input : [ 'splash2installer.py' ],
|
||||
depend_files: [ source_splash ],
|
||||
|
@ -9,5 +30,6 @@ installsplash = custom_target('installsplash-devel.bmp',
|
|||
'--batch-interpreter', 'python-fu-eval',
|
||||
'-b', '-', '--quit'],
|
||||
feed: true,
|
||||
build_by_default: true
|
||||
build_by_default: true,
|
||||
env: env
|
||||
)
|
||||
|
|
|
@ -213,7 +213,7 @@ foreach plugin : common_plugins_list
|
|||
)
|
||||
endif
|
||||
|
||||
executable(plugin_name,
|
||||
plugin_exe = executable(plugin_name,
|
||||
plugin_sources,
|
||||
include_directories: [ rootInclude, ],
|
||||
link_with : [
|
||||
|
@ -230,4 +230,15 @@ foreach plugin : common_plugins_list
|
|||
install: true,
|
||||
install_dir: gimpplugindir / 'plug-ins' / plugin_name,
|
||||
)
|
||||
|
||||
# Ugly trick to copy executables into subfolders so that we can run GIMP from
|
||||
# the build directory without installing it.
|
||||
custom_target('test-' + plugin_name,
|
||||
input: [ plugin_exe ],
|
||||
output: [ plugin_name + '.dummy' ],
|
||||
command: [ python, meson.project_source_root() / '.gitlab/cp-plug-in-subfolder.py',
|
||||
plugin_exe, meson.current_build_dir() / 'test-plug-ins' / plugin_name,
|
||||
meson.current_build_dir() / 'test-plug-ins' / plugin_name + '.dummy' ],
|
||||
build_by_default: true,
|
||||
)
|
||||
endforeach
|
||||
|
|
|
@ -25,10 +25,17 @@ subdir('python-console')
|
|||
|
||||
foreach plugin : plugins
|
||||
name = plugin.get('name')
|
||||
srcs = plugin.get('srcs', name + '.py')
|
||||
srcs = plugin.get('srcs', [name + '.py'])
|
||||
|
||||
install_data(srcs, install_dir: gimpplugindir / 'plug-ins' / name,
|
||||
install_mode: 'rwxr-xr-x')
|
||||
|
||||
foreach src : srcs
|
||||
# Ugly trick to copy Python plug-ins into subfolders so that we can run GIMP
|
||||
# from the build directory without installing it.
|
||||
run_command(python, meson.project_source_root() / '.gitlab/cp-plug-in-subfolder.py',
|
||||
meson.current_source_dir() / src, meson.current_build_dir() / name, check: true)
|
||||
endforeach
|
||||
endforeach
|
||||
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
|
||||
plugins += {
|
||||
'name': 'python-console',
|
||||
'srcs': files('pyconsole.py', 'python-console.py'),
|
||||
'srcs': [ 'python-console/pyconsole.py', 'python-console/python-console.py' ],
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue