1
0
Fork 0
mirror of https://github.com/deltachat/deltachat-core.git synced 2025-10-04 18:29:19 +02:00

Merge pull request #677 from flub/flub/etpan-pc

support newest libetpan using pkg-config
This commit is contained in:
björn petersen 2019-05-10 22:15:40 +02:00 committed by GitHub
commit deefd24fc1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -63,51 +63,55 @@ 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())
# 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
# 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 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
error('Check done. Installed libetpan version is NOT compatible. You need at least 1.9 for most platforms or 1.6 for Darwin/Mac')
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 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
# linking it instead for now.