[almanah/wip/jtojnar/meson-bump: 1/2] build: Use find gpgme using Meson



commit a887ecc0c719989d42718d4e36f5c8e7a1b7d133
Author: Jan Tojnar <jtojnar gmail com>
Date:   Tue May 5 03:59:09 2020 +0200

    build: Use find gpgme using Meson
    
    Meson supports this since 0.51 so we can now use this.
    
    This also fixes incorrect parsing of versions like 1.13.1-unknown:
    
            Traceback (most recent call last):
              File "/home/jtojnar/Projects/almanah/build-aux/gpg_check_version.py", line 39, in <module>
                if check_version(gpg_version, accepted_version, is_gpgme):
              File "/home/jtojnar/Projects/almanah/build-aux/gpg_check_version.py", line 19, in check_version
                return int(gpg_major) == int(acc_major) and int(gpg_minor) >= int(acc_minor) and 
int(gpg_micro) >= int(acc_micro)
            ValueError: invalid literal for int() with base 10: '1-unknown'

 build-aux/gpg_check_version.py | 42 ------------------------------------------
 meson.build                    | 16 ++--------------
 2 files changed, 2 insertions(+), 56 deletions(-)
---
diff --git a/meson.build b/meson.build
index ce9b024..ae54474 100644
--- a/meson.build
+++ b/meson.build
@@ -6,7 +6,7 @@ project(
   default_options: [
     'b_ndebug=if-release',
   ],
-  meson_version: '>= 0.47',
+  meson_version: '>= 0.51',
 )
 
 cc = meson.get_compiler('c')
@@ -44,20 +44,8 @@ cryptui = dependency('cryptui-0.0')
 evolution_support = get_option('evolution')
 spell_checking_support = get_option('spell_checking')
 
-# Check for GPGME, which doesn't provide a pkgconfig file
-# This code courtesy of seahorse
-# TODO: replace this with native meson checking after
-# https://github.com/mesonbuild/meson/pull/5213 is merged
 min_gpgme_version = '1.0.0'
-gpgme = cc.find_library('gpgme')
-gpgme_config = find_program('gpgme-config')
-gpg_check_version = find_program(join_paths('build-aux', 'gpg_check_version.py'))
-gpgme_version_check = run_command([python, gpg_check_version, gpgme_config.path(), 'true', min_gpgme_version 
])
-gpgme_version = gpgme_version_check.stdout()
-message('GPGME version: @0@'.format(gpgme_version))
-if gpgme_version_check.returncode() != 0
-  error('Incompatible version of GPGME. Minimal version required is @0@'.format(min_gpgme_version))
-endif
+gpgme = dependency('gpgme', version: '>= @0@'.format(min_gpgme_version))
 
 libecal = dependency('libecal-2.0', version: '>= 3.33.2', required: evolution_support)
 libedataserver = dependency('libedataserver-1.2', version: '>= 2.28', required: evolution_support)


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