From 9ce27be989882c262f38f58629f1f96865c29d98 Mon Sep 17 00:00:00 2001 From: Jehan Date: Mon, 29 Aug 2022 12:39:49 +0200 Subject: [PATCH] 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. --- app-tools/meson.build | 10 ++++++++-- app/meson.build | 4 ++-- meson.build | 2 +- meson_options.txt | 2 +- plug-ins/script-fu/interpreter/meson.build | 2 +- tools/meson.build | 4 ++-- 6 files changed, 15 insertions(+), 9 deletions(-) diff --git a/app-tools/meson.build b/app-tools/meson.build index 1803dd37db..d6ae993176 100644 --- a/app-tools/meson.build +++ b/app-tools/meson.build @@ -1,3 +1,9 @@ +if platform_windows or platform_osx + gimp_debug_tool_dir = get_option('bindir') +else + gimp_debug_tool_dir = get_option('libexecdir') +endif + gimp_debug_tool = executable('gimp-debug-tool-' + gimp_app_version, 'gimp-debug-tool.c', @@ -14,12 +20,12 @@ gimp_debug_tool = executable('gimp-debug-tool-' + gimp_app_version, libgimpbase, ], install: true, - install_dir: exec_dir + install_dir: gimp_debug_tool_dir ) if enable_default_bin and meson.version().version_compare('>=0.61.0') install_symlink('gimp-debug-tool' + exec_ext, pointing_to: 'gimp-debug-tool-' + gimp_app_version + exec_ext, - install_dir: exec_dir + install_dir: gimp_debug_tool_dir ) endif diff --git a/app/meson.build b/app/meson.build index acc86be4b2..4d7935e9f4 100644 --- a/app/meson.build +++ b/app/meson.build @@ -221,12 +221,12 @@ gimpmain_exe = executable('gimp-'+gimp_app_version, if enable_default_bin and meson.version().version_compare('>=0.61.0') install_symlink('gimp' + exec_ext, pointing_to: 'gimp-' + gimp_app_version + exec_ext, - install_dir: exec_dir + install_dir: get_option('bindir') ) if enable_console_bin install_symlink('gimp-console' + exec_ext, pointing_to: 'gimp-console-' + gimp_app_version + exec_ext, - install_dir: exec_dir + install_dir: get_option('bindir') ) endif endif diff --git a/meson.build b/meson.build index 9d4f2b37f1..2efdfe3f3b 100644 --- a/meson.build +++ b/meson.build @@ -92,7 +92,6 @@ cc = meson.get_compiler('c') cxx = meson.get_compiler('cpp') prefix = get_option('prefix') buildtype = get_option('buildtype') -exec_dir = prefix + '/' + get_option('bindir') exec_ext = '' compiler_args = [] @@ -1807,6 +1806,7 @@ final_message = [ ''' Default ICC directory: @0@'''.format(icc_directory), ''' 32-bit DLL folder (Win32): @0@'''.format(get_option('win32-32bits-dll-folder')), ''' Detailed backtraces: @0@'''.format(detailed_backtraces), +''' Binary symlinks: @0@'''.format(enable_default_bin), '', '''Optional Plug-Ins:''', ''' Ascii Art: @0@'''.format(libaa.found()), diff --git a/meson_options.txt b/meson_options.txt index 6558c65e49..1d7194c847 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -2,7 +2,7 @@ option('ansi', type: 'boolean', value: false, description: 'Turn on strict ansi') option('enable-console-bin',type: 'boolean', value: true, description: 'Build a console-only binary which does not link GTK') option('win32-debug-console',type:'boolean', value: true, description: 'Open a console when starting the program') -option('enable-default-bin',type: 'boolean', value: true, description: 'Install default app links pointing to the executables') +option('enable-default-bin',type: 'boolean', value: true, description: 'Install unversioned symlinks pointing to versioned executables') option('enable-multiproc', type: 'boolean', value: true, description: 'Support for multiple processors') option('profiling', type: 'boolean', value: false, description: 'Enable profiling') option('windows-installer', type: 'boolean', value: false, description: 'Generate files needed for the Windows installer') diff --git a/plug-ins/script-fu/interpreter/meson.build b/plug-ins/script-fu/interpreter/meson.build index 33f7afcf2a..c57e61100c 100644 --- a/plug-ins/script-fu/interpreter/meson.build +++ b/plug-ins/script-fu/interpreter/meson.build @@ -44,6 +44,6 @@ executable(executable_name, if enable_default_bin and meson.version().version_compare('>=0.61.0') install_symlink('gimp-script-fu-interpreter' + exec_ext, pointing_to: executable_name + exec_ext, - install_dir: exec_dir + install_dir: get_option('bindir') ) endif diff --git a/tools/meson.build b/tools/meson.build index 02d9cd8ab2..2ae0fc9bc2 100644 --- a/tools/meson.build +++ b/tools/meson.build @@ -33,11 +33,11 @@ executable('gimp-test-clipboard-' + gimp_app_version, if enable_default_bin and meson.version().version_compare('>=0.61.0') install_symlink('gimptool' + exec_ext, pointing_to: 'gimptool-' + gimp_app_version + exec_ext, - install_dir: exec_dir + install_dir: get_option('bindir') ) install_symlink('gimp-test-clipboard' + exec_ext, pointing_to: 'gimp-test-clipboard-' + gimp_app_version + exec_ext, - install_dir: exec_dir + install_dir: get_option('bindir') ) endif