From 6c97186d8379efe7587d3c5fac75b0eb78d07bdc Mon Sep 17 00:00:00 2001 From: Floris Bruynooghe Date: Sun, 28 Apr 2019 22:40:06 +0300 Subject: [PATCH 1/2] Hack at libetpan --- meson.build | 84 ++++++++++++++++++++++++++--------------------------- 1 file changed, 42 insertions(+), 42 deletions(-) diff --git a/meson.build b/meson.build index 8f2040b0..1a84a8cd 100644 --- a/meson.build +++ b/meson.build @@ -63,50 +63,50 @@ else sqlite = sqlite_proj.get_variable('dep') endif -# Sadly libetpan does not use pkg-config. Use the system one if it's -# new enough, if not use a static-pic-lib regardless of -# default-library. -libetpan_config = find_program('libetpan-config', required: false) -libetpan_fallback = (get_option('monolith') - or get_option('force-etpan-fallback') - or not libetpan_config.found()) +etpan = dependency('etpan') +# # Sadly libetpan does not use pkg-config. Use the system one if it's +# # new enough, if not use a static-pic-lib regardless of +# # default-library. +# libetpan_config = find_program('libetpan-config', required: false) +# libetpan_fallback = (get_option('monolith') +# or get_option('force-etpan-fallback') +# or not libetpan_config.found()) -# If we want to use a found etpan version, we have to make sure it's compatible. -# Sadly libetpan doesn't use the same version accross all platforms, so we have -# to check this depending on the platform. -if libetpan_fallback == false - etpan_version = run_command(libetpan_config, ['--version']).stdout().strip() - message('Dependency libetpan found: @0@. Checking for compatibility.'.format(etpan_version)) - if (etpan_version.version_compare('>=1.8') - or build_machine.system() == 'darwin' - and etpan_version.version_compare('>=1.6')) - message('Check done. Installed libetpan version is compatible.') - libetpan_is_compatible = true - else - error('Check done. Installed libetpan version is NOT compatible. You need at least 1.9 for most platforms or 1.6 for Darwin/Mac') - endif -endif - -if libetpan_fallback == false - etpan_prefix = run_command(libetpan_config, ['--prefix']).stdout().strip() - etpan_cflags = run_command(libetpan_config, ['--cflags']).stdout().strip().split() - etpan_libs = run_command(libetpan_config, ['--libs']).stdout().strip().split() - etpan_inc_dir = join_paths(etpan_prefix, 'include') - etpan_inc = include_directories(etpan_inc_dir) - etpan = declare_dependency( - compile_args: etpan_cflags, - include_directories: etpan_inc, - link_args: etpan_libs, - ) -else - if build_machine.system() == 'darwin' - error('Fallback libetpan not (yet) supported on OSX') - endif - message('Using libetpan fallback...') - etpan_proj = subproject('libetpan', default_options: ['static-pic-lib=true']) - etpan = etpan_proj.get_variable('dep') -endif +# # If we want to use a found etpan version, we have to make sure it's compatible. +# # Sadly libetpan doesn't use the same version accross all platforms, so we have +# # to check this depending on the platform. +# if libetpan_fallback == false +# etpan_version = run_command(libetpan_config, ['--version']).stdout().strip() +# message('Dependency libetpan found: @0@. Checking for compatibility.'.format(etpan_version)) +# if (etpan_version.version_compare('>=1.8') +# or build_machine.system() == 'darwin' +# and etpan_version.version_compare('>=1.6')) +# message('Check done. Installed libetpan version is compatible.') +# libetpan_is_compatible = true +# else +# error('Check done. Installed libetpan version is NOT compatible. You need at least 1.9 for most platforms or 1.6 for Darwin/Mac') +# endif +# endif +# if libetpan_fallback == false +# etpan_prefix = run_command(libetpan_config, ['--prefix']).stdout().strip() +# etpan_cflags = run_command(libetpan_config, ['--cflags']).stdout().strip().split() +# etpan_libs = run_command(libetpan_config, ['--libs']).stdout().strip().split() +# etpan_inc_dir = join_paths(etpan_prefix, 'include') +# etpan_inc = include_directories(etpan_inc_dir) +# etpan = declare_dependency( +# compile_args: etpan_cflags, +# include_directories: etpan_inc, +# link_args: etpan_libs, +# ) +# else +# if build_machine.system() == 'darwin' +# error('Fallback libetpan not (yet) supported on OSX') +# endif +# message('Using libetpan fallback...') +# etpan_proj = subproject('libetpan', default_options: ['static-pic-lib=true']) +# etpan = etpan_proj.get_variable('dep') +# endif if get_option('rpgp') # The rpgp pkg-config file is currently incorrect, so just try From fd60e43d7293d0e6bce2e4ccae6d5998e749306b Mon Sep 17 00:00:00 2001 From: Floris Bruynooghe Date: Fri, 10 May 2019 21:42:25 +0200 Subject: [PATCH 2/2] Support new libetpan via pkg-config The newest libetpan switched to pkg-config. If it's present use it, no further questions asked. --- meson.build | 88 ++++++++++++++++++++++++++++------------------------- 1 file changed, 46 insertions(+), 42 deletions(-) diff --git a/meson.build b/meson.build index 1a84a8cd..78a523db 100644 --- a/meson.build +++ b/meson.build @@ -63,50 +63,54 @@ else sqlite = sqlite_proj.get_variable('dep') endif -etpan = dependency('etpan') -# # Sadly libetpan does not use pkg-config. Use the system one if it's -# # new enough, if not use a static-pic-lib regardless of -# # default-library. -# libetpan_config = find_program('libetpan-config', required: false) -# libetpan_fallback = (get_option('monolith') -# or get_option('force-etpan-fallback') -# or not libetpan_config.found()) -# # If we want to use a found etpan version, we have to make sure it's compatible. -# # Sadly libetpan doesn't use the same version accross all platforms, so we have -# # to check this depending on the platform. -# if libetpan_fallback == false -# etpan_version = run_command(libetpan_config, ['--version']).stdout().strip() -# message('Dependency libetpan found: @0@. Checking for compatibility.'.format(etpan_version)) -# if (etpan_version.version_compare('>=1.8') -# or build_machine.system() == 'darwin' -# and etpan_version.version_compare('>=1.6')) -# message('Check done. Installed libetpan version is compatible.') -# libetpan_is_compatible = true -# else -# error('Check done. Installed libetpan version is NOT compatible. You need at least 1.9 for most platforms or 1.6 for Darwin/Mac') -# endif -# endif +# Newer libetpan uses pkg-config, otherwise use the old crazy logic. +etpan = dependency('libetpan', required: false) +if not etpan.found() + # Sadly libetpan does not use pkg-config. Use the system one if it's + # new enough, if not use a static-pic-lib regardless of + # default-library. + libetpan_config = find_program('libetpan-config', required: false) + libetpan_fallback = (get_option('monolith') + or get_option('force-etpan-fallback') + or not libetpan_config.found()) -# if libetpan_fallback == false -# etpan_prefix = run_command(libetpan_config, ['--prefix']).stdout().strip() -# etpan_cflags = run_command(libetpan_config, ['--cflags']).stdout().strip().split() -# etpan_libs = run_command(libetpan_config, ['--libs']).stdout().strip().split() -# etpan_inc_dir = join_paths(etpan_prefix, 'include') -# etpan_inc = include_directories(etpan_inc_dir) -# etpan = declare_dependency( -# compile_args: etpan_cflags, -# include_directories: etpan_inc, -# link_args: etpan_libs, -# ) -# else -# if build_machine.system() == 'darwin' -# error('Fallback libetpan not (yet) supported on OSX') -# endif -# message('Using libetpan fallback...') -# etpan_proj = subproject('libetpan', default_options: ['static-pic-lib=true']) -# etpan = etpan_proj.get_variable('dep') -# endif + # If we want to use a found etpan version, we have to make sure it's compatible. + # Sadly libetpan doesn't use the same version accross all platforms, so we have + # to check this depending on the platform. + if libetpan_fallback == false + etpan_version = run_command(libetpan_config, ['--version']).stdout().strip() + message('Dependency libetpan found: @0@. Checking for compatibility.'.format(etpan_version)) + if (etpan_version.version_compare('>=1.8') + or build_machine.system() == 'darwin' + and etpan_version.version_compare('>=1.6')) + message('Check done. Installed libetpan version is compatible.') + libetpan_is_compatible = true + else + error('Check done. Installed libetpan version is NOT compatible. You need at least 1.9 for most platforms or 1.6 for Darwin/Mac') + endif + endif + + if libetpan_fallback == false + etpan_prefix = run_command(libetpan_config, ['--prefix']).stdout().strip() + etpan_cflags = run_command(libetpan_config, ['--cflags']).stdout().strip().split() + etpan_libs = run_command(libetpan_config, ['--libs']).stdout().strip().split() + etpan_inc_dir = join_paths(etpan_prefix, 'include') + etpan_inc = include_directories(etpan_inc_dir) + etpan = declare_dependency( + compile_args: etpan_cflags, + include_directories: etpan_inc, + link_args: etpan_libs, + ) + else + if build_machine.system() == 'darwin' + error('Fallback libetpan not (yet) supported on OSX') + endif + message('Using libetpan fallback...') + etpan_proj = subproject('libetpan', default_options: ['static-pic-lib=true']) + etpan = etpan_proj.get_variable('dep') + endif +endif if get_option('rpgp') # The rpgp pkg-config file is currently incorrect, so just try