The previous patch was overly complex and finally wrong.
We should simply use `@XAPIAN_LIBS` as `Libs.private`.
Next release of xapian will integrate this
(https://trac.xapian.org/ticket/751), but for now, we still a patch
on our side.
As we are compiling `ctpp2c` in static native and install it with a simple
`cp`, the default compilation of ctpp2 library should not install ctpp2c.
Else we would have a wrong `ctpp2c` in the path and later compilation will
fail.
We are using `ctpp2c` when building kiwix-lib to compile embedded resources.
As `ctpp2c` will be used in the host machine, it always need to be
compiled for the host (native).
But we still want tho ctpp2 library compiled for the target platform.
As we don't want handle the conflict between two dynamic lib with the same
name but for two different platforms, we build ctpp2c statically.
We don't need all the ICU data and we need to reduce binaries' size
(Especially for android where we have a limit of 50Mo per APK).
By removing unwanted ICU data, we reduce a lot the data size and so
the final binaries' size.
There is also some "problems" to compile the `ja.txt` collfiles,
the "resource compiler" crashes.
As we don't need it, we also remove it.
It seems that last meson version (0.40.0) do not pass cross compilation
extra_args to compiler when checking for headers.
Thus, the kiwix-lib check for ctpp2 headers fails because the WIN32
define is not present. So kiwix-lib is compiled without CTPP2 but
kiwix-tool compile as if kiwix-lib where compile with CTPP2 and fails.
By making CTPP2 headers check for `__WINGW32__` we workaround this problem.
I don't know if this is a bug in meson, ctpp2 or kiwix-lib but this small
fix allow to compile correctly with last meson version.
AC_SEARCH_LIBS try to compile and use a symbol (timer_create) using
a lib (rt).
But, in fact, it also try to use the symbol but without using the lib.
If it's work, it consider that the libs is found and set the ac_res
variable to "none required".
So, we must check the value of ac_res to know if we must add '-lrt' to
the pkg-config file.
On recent version of the NDK (r13b), `exec_elf.h` has been removed for
API level >= 20. On 64 bits, we need the API level 21, and then,
a defined (ELF64_ST_INFO) is missing.
We readd it where (and if) we need it.
Use a standard name libz.(so|a) if we are using mingw (as we do on linux).
This patch somehow deprecate the previous commit (patch) but both patches
are the right thing to do.
We need this one especially for others dependencies using pkg-config.
The generated .pc always use the '-lz' option and so, we need the correct
names for the lib.
zlib may be installed under the libzlibstatic.a or libzlib.dll.so names.
xapian correctly detect those name but use '-lz' option for xapian_inspec
binary.
This script download and compile all depedencies and subproject for
kiwix-tools.
Ideally it should be as simple as run the script with the install dir as
argument.
This script compile a dynamic or a static build of kiwix-tools (kiwix-serve)
This as been tested on Fedora.