Do not try to link with ctpp2-st.

ctpp2-st is not a standard name, all other projects use the same base name
for dynamic and static libs.

Debian already patch the lib name in the ctpp2 package.
As we also patch it in kiwix-build, we can ignore ctpp2-st and always
try to link on ctpp2.

This is even necessary if we use the ctpp2-install-prefix. As we ctpp2 is
in a custom directory, meson fails in the foreach loop as it cannot find
ctpp2.
We could fix, the ctpp2 lib search to also search ctpp2-st in standard
directory AND the custom one but it seems to be a lot of work for nothing
as ctpp2-st is not used at all in our usecases.
This commit is contained in:
Matthieu Gautier 2017-01-30 17:58:29 +01:00
parent 7a03cb7712
commit 50071d1053
1 changed files with 8 additions and 19 deletions

View File

@ -10,28 +10,17 @@ libzim_dep = dependency('libzim')
pugixml_dep = dependency('pugixml') pugixml_dep = dependency('pugixml')
find_library_in_compiler = meson.version().version_compare('>=0.31.0') find_library_in_compiler = meson.version().version_compare('>=0.31.0')
libname = ''
libnames = ['ctpp2', 'ctpp2-st']
foreach tmplibname : libnames
required = tmplibname == libnames[-1]
if find_library_in_compiler
found = libname == '' and compiler.find_library(tmplibname, required: required).found()
else
found = libname == '' and find_library(tmplibname, required: required).found()
endif
if found
libname = tmplibname
endif
endforeach
ctpp2_prefix_install = get_option('ctpp2-install-prefix') ctpp2_prefix_install = get_option('ctpp2-install-prefix')
if ctpp2_prefix_install == '' if ctpp2_prefix_install == ''
if not compiler.has_header('ctpp2/CTPP2Logger.hpp') if not compiler.has_header('ctpp2/CTPP2Logger.hpp')
error('ctpp2/CTPP2Logger.hppnot found') error('ctpp2/CTPP2Logger.hppnot found')
endif endif
if find_library_in_compiler
link_args = ['-l'+libname] ctpp2_lib = compiler.find_library('ctpp2')
else
ctpp2_lib = find_library('ctpp2')
endif
link_args = ['-lctpp2']
if meson.is_cross_build() if meson.is_cross_build()
if host_machine.system() == 'windows' if host_machine.system() == 'windows'
link_args += ['-liconv'] link_args += ['-liconv']
@ -49,8 +38,8 @@ else
endif endif
ctpp2_include_path = include_directories(ctpp2_include_path, is_system:true) ctpp2_include_path = include_directories(ctpp2_include_path, is_system:true)
ctpp2_lib_path = ctpp2_prefix_install+'/lib' ctpp2_lib_path = ctpp2_prefix_install+'/lib'
ctpp2_lib = compiler.find_library(libname, dirs:ctpp2_lib_path) ctpp2_lib = compiler.find_library('ctpp2', dirs:ctpp2_lib_path)
link_args = ['-L'+ctpp2_lib_path, '-l'+libname] link_args = ['-L'+ctpp2_lib_path, '-lctpp2']
if meson.is_cross_build() if meson.is_cross_build()
if host_machine.system() == 'windows' if host_machine.system() == 'windows'
link_args += ['-liconv'] link_args += ['-liconv']