[gimp] meson, autotools, CI: simplify plug-in binding build options.



commit e77d9517f7d30aa1ab49bb8ecdc70a64858b2796
Author: Jehan <jehan girinstud io>
Date:   Mon Oct 12 22:02:46 2020 +0200

    meson, autotools, CI: simplify plug-in binding build options.
    
    For Python, Lua and Javascript, make the option boolean (with 'yes'
    being the default). No need of a warning when not installing the
    plug-ins as this would have been disabled explicitly anyway. When
    installing the plug-ins, only make interpreter checks as precautionnary
    verifications which don't actually change anything (except outputting
    some warnings if interpreters are not found). Basically for these 3
    bindings, the interpreters are only runtime dependencies anyway. So it
    doesn't matter if they are not available at build time. In particular,
    we get rid of the 'force' option.
    
    Vala rules do not change as the vala compiler is indeed needed at build
    time and current checks work correctly. I just add a "Vala plug-ins"
    line in the summary message of the meson configuration, as it was
    missing.

 .gitlab-ci.yml    |  20 ++---------
 configure.ac      | 103 +++++++++---------------------------------------------
 meson.build       |  93 ++++++------------------------------------------
 meson_options.txt |  15 +++-----
 4 files changed, 33 insertions(+), 198 deletions(-)
---
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index b43206b137..2597218e74 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -139,9 +139,6 @@ gimp-autotools-debian:
     - ../autogen.sh
         --prefix="${INSTALL_PREFIX}"
         --enable-debug
-        --with-python=force
-        --with-javascript=force
-        --with-lua=force
     - make -j "$(nproc)"
     - make check
 
@@ -153,9 +150,6 @@ gimp-distcheck-debian:
     - ../autogen.sh
         --prefix="${INSTALL_PREFIX}"
         --enable-debug
-        --with-python=force
-        --with-javascript=force
-        --with-lua=force
         --enable-gtk-doc
     - make -j "$(nproc)"
     - make -j "$(nproc)" distcheck
@@ -165,9 +159,6 @@ gimp-meson-debian:
   script:
     - meson _build
       --prefix="${INSTALL_PREFIX}"
-      -Dpython=always
-      -Djavascript=always
-      -Dlua=always
     - ninja -C _build
     - ninja -C _build test
 
@@ -182,9 +173,6 @@ gimp-clang-debian:
         clang libomp-dev
     - meson _build
       --prefix="${INSTALL_PREFIX}"
-      -Dpython=always
-      -Djavascript=always
-      -Dlua=always
     - ninja -C _build
     - ninja -C _build test
 
@@ -237,9 +225,7 @@ gimp-win64:
     - export PATH="`pwd`/.local/bin:$PATH"
     - mkdir _build && cd _build
     - echo 'crossroad meson ..
-              -Dgtk-doc=false
-              -Dpython=always -Dlua=always
-              -Djavascript=always && ninja install &&
+              -Dgtk-doc=false && ninja install &&
             cp -fr $CROSSROAD_PREFIX/ ../gimp-prefix/
             ' |
       crossroad w64 gimp --run="-"
@@ -298,9 +284,7 @@ gimp-win32:
     - export PATH="`pwd`/.local/bin:$PATH"
     - mkdir _build && cd _build
     - echo 'crossroad meson ..
-              -Dwmf=disabled  -Dgtk-doc=false
-              -Dpython=always -Dlua=always
-              -Djavascript=always && ninja install &&
+              -Dwmf=disabled  -Dgtk-doc=false && ninja install &&
             cp -fr $CROSSROAD_PREFIX/ ../gimp-prefix/
             ' |
       crossroad w32 gimp --run="-"
diff --git a/configure.ac b/configure.ac
index ba3556f3f5..3f97152394 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2275,21 +2275,11 @@ GOAT_EXERCISES="goat-exercise-c$BUILD_EXEEXT"
 # useful at build time.
 # --with-python=no won't install Python plug-ins. It is discouraged.
 AC_ARG_WITH(python,
-            [  --with-python=no|yes|force install Python 3 plug-ins (default=yes)], ,
+            [  --with-python=no|yes install Python 3 plug-ins (default=yes)], ,
             [with_python=yes])
 
-if test "x$with_python" = xno; then
-  warning_python="
-WARNING: you disabled the installation of core Python plug-ins. This is
-         discouraged as it won't provide the full GIMP experience.
-         Note that you may install the Python plug-ins even if you have
-         no Python interpreter at build-time by passing the configure
-         option --with-python=force.
-         Just make sure that a Python python3_required_version or newer
-         interpreter is available at run-time."
-elif test "x$with_python" = xforce; then
-  with_python="yes"
-  warning_python=
+warning_python=
+if test "x$with_python" = xyes; then
   AM_PATH_PYTHON3(python3_required_version, ,
                   warning_python="Python python3_required_version or newer not found")
   if test "x$warning_python" = "x"; then
@@ -2305,28 +2295,7 @@ WARNING: ${warning_python}
          be usable."
     with_python="yes (see warning below)"
   fi
-else
-  with_python="yes"
-  error_python=
-  AM_PATH_PYTHON3(python3_required_version,,
-                  error_python="- Python python3_required_version or newer not found")
-  if test "x$error_python" = "x"; then
-    AM_PYTHON_CHECK_PYGOBJECT("$PYTHON", , ,
-                              error_python="PyGObject 3.0 not found")
-  fi
-  if test "x$error_python" != "x"; then
-    required_deps="$required_deps
-    $error_python
-        *** Please install Python 3 and PyGObject 3.
-        *** Note that you may install the Python plug-ins even if you have
-        *** no Python interpreter at build-time by passing the configure
-        *** option --with-python=force.
-        *** Just make sure that the Python dependencies are available at run-time."
-    with_python="no"
-  fi
-fi
 
-if test "x$with_python" = "xyes"; then
   if test "x$platform_win32" = "xyes"; then
     PYBIN_PATH="$py_exec_prefix\pythonw.exe"
   else
@@ -2335,7 +2304,10 @@ if test "x$with_python" = "xyes"; then
   AC_SUBST(PYBIN_PATH)
 
   GOAT_EXERCISES="$GOAT_EXERCISES:goat-exercise-py3.py"
+else
+  with_python="no (disabled)"
 fi
+
 AM_CONDITIONAL(HAS_PYTHON_INTERP, test "x$PYBIN_PATH" != "x")
 AM_CONDITIONAL(BUILD_PYTHON, test "x$with_python" != xno)
 
@@ -2344,20 +2316,12 @@ AM_CONDITIONAL(BUILD_PYTHON, test "x$with_python" != xno)
 ###########################################
 
 AC_ARG_WITH(javascript,
-            [  --with-javascript=no|yes|force install JavaScript plug-ins (default=yes)], ,
+            [  --with-javascript=no|yes install JavaScript plug-ins (default=yes)], ,
             [with_javascript=yes])
 
-if test "x$with_javascript" = xno; then
-  warning_javascript="
-WARNING: you disabled the installation of core JavaScript plug-ins. This
-         is discouraged as it won't provide the full GIMP experience.
-         Note that you may install the JavaScript plug-ins even if the
-         GJS interpreter is not installed at build-time by passing the
-         configure option --with-javascript=force.
-         Just make sure that GJS is available at run-time."
-elif test "x$with_javascript" = xforce; then
+warning_javascript=
+if test "x$with_javascript" = xyes; then
   with_javascript="yes"
-  warning_javascript=
   AC_CHECK_PROGS(GJS, gjs, no)
   if test "x$GJS" = xno; then
     warning_javascript="
@@ -2367,23 +2331,10 @@ WARNING: GJS not found.
          installation, otherwise installed plug-ins won't be usable."
     with_javascript="yes (see warning below)"
   fi
-else
-  with_javascript="yes"
-  AC_CHECK_PROGS(GJS, gjs, no)
-  if test "x$GJS" = xno; then
-    required_deps="$required_deps
-    - GJS not found.
-        *** Please install the JavaScript interpreter GJS.
-        *** Note that you may install the JavaScript plug-ins even if
-        *** GJS is not installed at build-time by passing the configure
-        *** option --with-javascript=force.
-        *** Just make sure that GJS is available at run-time."
-    with_javascript="no"
-  fi
-fi
 
-if test "x$with_javascript" = "xyes"; then
   GOAT_EXERCISES="$GOAT_EXERCISES:goat-exercise-gjs.js"
+else
+  with_javascript="no (disabled)"
 fi
 
 AM_CONDITIONAL(HAS_JAVASCRIPT_INTERP, test "x$GJS" != "xno")
@@ -2394,20 +2345,11 @@ AM_CONDITIONAL(BUILD_JAVASCRIPT, test "x$with_javascript" != xno)
 ####################################
 
 AC_ARG_WITH(lua,
-            [  --with-lua=no|yes|force install Lua plug-ins (default=yes)], ,
+            [  --with-lua=no|yes install Lua plug-ins (default=yes)], ,
             [with_lua=yes])
 
-if test "x$with_lua" = xno; then
-  warning_lua="
-WARNING: you disabled the installation of core Lua plug-ins. This
-         is discouraged as it won't provide the full GIMP experience.
-         Note that you may install the Lua plug-ins even if Lua LGI
-         is not installed at build-time by passing the configure option
-         --with-lua=force.
-         Just make sure that it is available at run-time."
-elif test "x$with_lua" = xforce; then
-  with_lua="yes"
-  warning_lua=
+warning_lua=
+if test "x$with_lua" = xyes; then
   AC_CHECK_PROGS(LUA, luajit, no)
   if test "x$LUA" = xno; then
     warning_lua="
@@ -2417,23 +2359,10 @@ WARNING: luajit not found.
          otherwise installed plug-ins won't be usable."
     with_lua="yes (see warning below)"
   fi
-else
-  with_lua="yes"
-  AC_CHECK_PROGS(LUA, luajit, no)
-  if test "x$LUA" = xno; then
-    required_deps="$required_deps
-    - luajit not found.
-        *** Please install the Lua interpreter luajit.
-        *** Note that you may install the Lua plug-ins even if luajit
-        *** is not installed at build-time by passing the configure
-        *** option --with-lua=force.
-        *** Just make sure that luajit and LGI are available at run-time."
-    with_lua="no"
-  fi
-fi
 
-if test "x$with_lua" = "xyes"; then
   GOAT_EXERCISES="$GOAT_EXERCISES:goat-exercise-lua.lua"
+else
+  with_lua="no (disabled)"
 fi
 
 AM_CONDITIONAL(HAS_LUA_INTERP, test "x$LUA" != "xno")
diff --git a/meson.build b/meson.build
index a12f4a9451..3f9e9a12d9 100644
--- a/meson.build
+++ b/meson.build
@@ -908,22 +908,9 @@ perl = find_program('perl5', 'perl', 'perl5.005', 'perl5.004', 'perl')
 
 python3_minver = '>=3.6'
 
-if get_option('python') == 'never'
-  python_warning = '''
-    You disabled the installation of core Python plug-ins. This is discouraged
-    as it won't provide the full GIMP experience.
-    Note that you may install the Python plug-ins even if you have no Python
-    interpreter at build-time by passing the configure option -Dpython=always.
-    Just make sure that a Python >=@0@ interpreter is available at run-time.
-  '''.format(python3_minver)
-  warning(python_warning)
-  warnings += python_warning
-
-  have_python = false
-
-else
-  always_install = get_option('python') == 'always'
+have_python = get_option('python')
 
+if have_python
   python = pythonmod.find_installation('python3', required: false)
   message('Found Python @0@'.format(python.language_version()))
 
@@ -944,16 +931,7 @@ else
     python_found = python_found and pygobject_found
   endif
 
-  if (not python_found) and (not always_install)
-    error('''
-    Python @0@ or PyGObject was not found.
-    Note that you may install the Python plug-ins even if you have no Python
-    interpreter at build-time by passing the configure option -Dpython=always.
-    Just make sure that a Python @0@ interpreter is available at run-time.
-    '''.format(python3_minver))
-  endif
-
-  if (not python_found) and (always_install)
+  if not python_found
     python_warning = '''
     Python @0@ or PyGObject was not found.
     Python plug-ins will be installed anyway but you should make sure that
@@ -963,39 +941,14 @@ else
     warning(python_warning)
     warnings += python_warning
   endif
-
-  have_python = python_found or always_install
 endif
 
 ## Javascript
 
-if get_option('javascript') == 'never'
-  js_warning = '''
-    You disabled the installation of core Javascript plug-ins. This is
-    discouraged as it won't provide the full GIMP experience.
-    Note that you may install the Javascript plug-ins even if you have no GJS
-    interpreter at build-time by passing the configure option -Djavascript=always.
-    Just make sure that the GJS interpreter is available at run-time.
-  '''
-  warning(js_warning)
-  warnings += js_warning
-  have_javascript = false
-
-else
-  always_install = get_option('javascript') == 'always'
-
+have_javascript = get_option('javascript')
+if have_javascript
   gjs = find_program('gjs', required: false)
-
-  if (not gjs.found()) and (not always_install)
-    error('''
-    GJS was not found.
-    Note that you may install the Javascript plug-ins even if you have no GJS
-    interpreter at build-time by passing the configure option -Djavascript=always.
-    Just make sure that the GJS interpreter is available at run-time.
-    ''')
-  endif
-
-  if (not gjs.found()) and (always_install)
+  if not gjs.found()
     js_warning = '''
     GJS was not found.
     JavaScript plug-ins will be installed anyway but you should make sure that
@@ -1005,39 +958,14 @@ else
     warning(js_warning)
     warnings += js_warning
   endif
-
-  have_javascript = gjs.found() or always_install
 endif
 
 ## Lua
 
-if get_option('lua') == 'never'
-  lua_warning = '''
-    You disabled the installation of core Lua plug-ins. This is discouraged
-    as it won't provide the full GIMP experience.
-    Note that you may install the Lua plug-ins even if you have no Lua LGI
-    interpreter at build-time by passing the configure option -Dlua=always.
-    Just make sure that the Lua LGI interpreter is available at run-time.
-  '''
-  warning(lua_warning)
-  warnings += lua_warning
-  have_lua = false
-
-else
-  always_install = get_option('lua') == 'always'
-
+have_lua = get_option('lua')
+if have_lua
   lua = find_program('luajit', required: false)
-
-  if (not lua.found()) and (not always_install)
-    error('''
-    Luajit was not found.
-    Note that you may install the Lua plug-ins even if you have no Lua LGI
-    interpreter at build-time by passing the configure option -Dlua=always.
-    Just make sure that the Lua LGI interpreter is available at run-time.
-    ''')
-  endif
-
-  if (not lua.found()) and always_install
+  if not lua.found()
     lua_warning = '''
     Luajit was not found.
     Lua plug-ins will be installed anyway but you should make sure that
@@ -1047,8 +975,6 @@ else
     warning(lua_warning)
     warnings += lua_warning
   endif
-
-  have_lua = lua.found() or always_install
 endif
 
 
@@ -1834,6 +1760,7 @@ final_message = [
 '''  Python 3 plug-ins:   @0@'''.format(have_python),
 '''  Javascript plug-ins: @0@'''.format(have_javascript),
 '''  Lua plug-ins:        @0@'''.format(have_lua),
+'''  Vala plug-ins:       @0@'''.format(have_vala),
 '''  TWAIN (Win32):       @0@'''.format(platform_windows),
 '''  Webpage:             @0@'''.format(webkit.found()),
 '''  WMF:                 @0@'''.format(wmf.found()),
diff --git a/meson_options.txt b/meson_options.txt
index 6c648e804b..e6cfe13db5 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -44,7 +44,6 @@ option('openexr',           type: 'feature', value: 'auto', description: 'Openex
 option('png',               type: 'feature', value: 'auto', description: 'PNG support')
 option('print',             type: 'boolean', value: true,   description: 'Print support')
 option('tiff',              type: 'feature', value: 'auto', description: 'TIFF support')
-option('vala-plugins',      type: 'feature', value: 'auto', description: 'Build VAPI and Vala plugins')
 option('webkit',            type: 'feature', value: 'auto', description: 'Help browser and webpage plugins')
 option('webp',              type: 'feature', value: 'auto', description: 'Webp support')
 option('wmf',               type: 'feature', value: 'auto', description: 'Wmf support')
@@ -58,12 +57,8 @@ option('gtk-doc-app',       type: 'boolean', value: false,  description: 'Build
 option('linux-input',       type: 'feature', value: 'auto', description: 'Linux input event controller 
module')
 option('vec-icons',         type: 'boolean', value: true,   description: 'Use vector icons rather than 
raster ones')
 
-option('javascript',        type: 'combo',   value:'error', description: 'Install Javascript plug-ins',
-  choices: [ 'never', 'always', 'error' ],
-)
-option('lua',               type: 'combo',   value:'error', description: 'Install Lua plug-ins',
-  choices: [ 'never', 'always', 'error' ],
-)
-option('python',            type: 'combo',   value:'error', description: 'Install Python 3 plug-ins',
-  choices: [ 'never', 'always', 'error' ],
-)
+option('vala-plugins',      type: 'feature', value: 'auto', description: 'Build VAPI and Vala plugins')
+
+option('javascript',        type: 'boolean', value: true,   description: 'Install Javascript plug-ins')
+option('lua',               type: 'boolean', value: true,   description: 'Install Lua plug-ins')
+option('python',            type: 'boolean', value: true,   description: 'Install Python 3 plug-ins')


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