[gimp] Issue #8546: Meson options fixes



commit 879f7b48de84d65ae515c8c5c5c55d08683a3eab
Author: Hanabishi <40605-Hanabishi users noreply gitlab gnome org>
Date:   Mon Aug 29 13:41:08 2022 +0000

    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

 app-tools/meson.build                      |  9 +++++-
 app/meson.build                            | 47 ++++++++++++++++++---------
 docs/meson.build                           | 52 ++++++++++++++----------------
 meson.build                                |  6 ++++
 meson_options.txt                          |  2 +-
 plug-ins/script-fu/interpreter/meson.build |  7 ++++
 tools/meson.build                          | 11 +++++++
 7 files changed, 89 insertions(+), 45 deletions(-)
---
diff --git a/app-tools/meson.build b/app-tools/meson.build
index c66ac7c6cb..1803dd37db 100644
--- a/app-tools/meson.build
+++ b/app-tools/meson.build
@@ -14,5 +14,12 @@ gimp_debug_tool = executable('gimp-debug-tool-' + gimp_app_version,
     libgimpbase,
   ],
   install: true,
-  install_dir: get_option('libexecdir')
+  install_dir: exec_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
+  )
+endif
diff --git a/app/meson.build b/app/meson.build
index fbb352d95a..acc86be4b2 100644
--- a/app/meson.build
+++ b/app/meson.build
@@ -182,22 +182,24 @@ else
   gui_rc_file = []
 endif
 
-gimpconsole_exe = executable('gimp-console-'+gimp_app_version,
-  'main.c',
-  libapp_sources,
-  console_rc_file,
-  c_args: [
-    '-DG_LOG_DOMAIN="Gimp"',
-    '-DGIMP_APP_GLUE_COMPILATION',
-    '-DGIMP_CONSOLE_COMPILATION',
-    psapi_cflags,
-  ],
-  dependencies: libapp_dep,
-  link_with: [
-    app_links,
-  ],
-  install: true,
-)
+if enable_console_bin
+  gimpconsole_exe = executable('gimp-console-'+gimp_app_version,
+    'main.c',
+    libapp_sources,
+    console_rc_file,
+    c_args: [
+      '-DG_LOG_DOMAIN="Gimp"',
+      '-DGIMP_APP_GLUE_COMPILATION',
+      '-DGIMP_CONSOLE_COMPILATION',
+      psapi_cflags,
+    ],
+    dependencies: libapp_dep,
+    link_with: [
+      app_links,
+    ],
+    install: true,
+  )
+endif
 
 gimpmain_exe = executable('gimp-'+gimp_app_version,
   'main.c',
@@ -215,3 +217,16 @@ gimpmain_exe = executable('gimp-'+gimp_app_version,
   ],
   install: true,
 )
+
+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
+  )
+  if enable_console_bin
+    install_symlink('gimp-console' + exec_ext,
+      pointing_to: 'gimp-console-' + gimp_app_version + exec_ext,
+      install_dir: exec_dir
+    )
+  endif
+endif
diff --git a/docs/meson.build b/docs/meson.build
index 522e78c7af..68538446ec 100644
--- a/docs/meson.build
+++ b/docs/meson.build
@@ -16,22 +16,11 @@ man_files = [
     output: 'gimptool-' + gimp_app_version + '.1',
     configuration: manconf,
   ),
-  configure_file(
-    input : 'gimptool.1.in',
-    output: 'gimptool.1',
-    configuration: manconf,
-  ),
-
   configure_file(
     input : 'gimprc.5.in',
     output: 'gimprc-' + gimp_app_version + '.5',
     configuration: manconf,
   ),
-  configure_file(
-    input : 'gimprc.5.in',
-    output: 'gimprc.5',
-    configuration: manconf,
-  ),
 ]
 
 if enable_console_bin
@@ -40,24 +29,33 @@ if enable_console_bin
     output: 'gimp-console-' + gimp_app_version + '.1',
     configuration: manconf,
   )
-  man_files += configure_file(
-    input : 'gimp.1.in',
-    output: 'gimp-console.1',
-    configuration: manconf,
-  )
 endif
 
-if enable_default_bin
-  man_files +=  configure_file(
-    input : 'gimp.1.in',
-    output: 'gimp-' + gimp_app_version + '.1',
-    configuration: manconf,
+man_files +=  configure_file(
+  input : 'gimp.1.in',
+  output: 'gimp-' + gimp_app_version + '.1',
+  configuration: manconf,
+)
+
+install_man(man_files)
+
+if enable_default_bin and meson.version().version_compare('>=0.61.0')
+  install_symlink('gimptool.1',
+    pointing_to: 'gimptool-' + gimp_app_version + '.1',
+    install_dir: get_option('mandir') + '/man1'
   )
-  man_files +=  configure_file(
-    input : 'gimp.1.in',
-    output: 'gimp.1',
-    configuration: manconf,
+  install_symlink('gimprc.5',
+    pointing_to: 'gimprc-' + gimp_app_version + '.5',
+    install_dir: get_option('mandir') + '/man5'
+  )
+  if enable_console_bin
+    install_symlink('gimp-console.1',
+      pointing_to: 'gimp-console-' + gimp_app_version + '.1',
+      install_dir: get_option('mandir') + '/man1'
+    )
+  endif
+  install_symlink('gimp.1',
+    pointing_to: 'gimp-' + gimp_app_version + '.1',
+    install_dir: get_option('mandir') + '/man1'
   )
 endif
-
-install_man(man_files)
diff --git a/meson.build b/meson.build
index a3a83bb171..9d4f2b37f1 100644
--- a/meson.build
+++ b/meson.build
@@ -92,6 +92,8 @@ 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 = []
 linker_args = []
@@ -145,6 +147,7 @@ endif
 
 if platform_windows
   windows = import('windows')
+  exec_ext = '.exe'
   # AC_CHECK_PROG(ms_librarian, lib.exe, yes, no)
   # AM_CONDITIONAL(MS_LIB_AVAILABLE, test "x$ms_librarian" = xyes)
   # compiler_args += '-Wl,--large-address-aware'
@@ -1160,6 +1163,9 @@ conf.set_quoted('COLOR_PROFILE_DIRECTORY', icc_directory)
 enable_default_bin = get_option('enable-default-bin')
 enable_console_bin = get_option('enable-console-bin')
 
+if enable_default_bin and meson.version().version_compare('<0.61.0')
+  error('"enable-default-bin" build option requires meson 0.61 or later. Please disable the option or update 
meson.')
+endif
 
 # Possibly change default gimpdir from $XDG_CONFIG_HOME/GIMP/gimp_user_version
 gimpdir = get_option('gimpdir')
diff --git a/meson_options.txt b/meson_options.txt
index 3e8943ee46..6558c65e49 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: 'Build default Gtk binary')
+option('enable-default-bin',type: 'boolean', value: true,   description: 'Install default app links pointing 
to the 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 b02523d104..33f7afcf2a 100644
--- a/plug-ins/script-fu/interpreter/meson.build
+++ b/plug-ins/script-fu/interpreter/meson.build
@@ -40,3 +40,10 @@ executable(executable_name,
   link_with : libscriptfu,
   install: true,
 )
+
+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
+  )
+endif
diff --git a/tools/meson.build b/tools/meson.build
index 0a18d66080..02d9cd8ab2 100644
--- a/tools/meson.build
+++ b/tools/meson.build
@@ -30,6 +30,17 @@ executable('gimp-test-clipboard-' + gimp_app_version,
   install: true,
 )
 
+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_symlink('gimp-test-clipboard' + exec_ext,
+    pointing_to: 'gimp-test-clipboard-' + gimp_app_version + exec_ext,
+    install_dir: exec_dir
+  )
+endif
+
 executable('kernelgen',
   'kernelgen.c',
   include_directories: rootInclude,


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]