If the user what to make a custom_app locally, he will need to download
the zim file before. As he has already the zim, it is better to give
the zim_path instead of give the zim_url and have `build_custom_app.py`
download a second time the zim.
Not all target platform can be compiled on all platform.
For instance, all `static` target or `win32`, `armhf` and `android` targets
cannot be compiled on macOS.
Simply check that the current host is supported by TargetInfo and exit
nicely if needed.
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.
"PIE" option is for executable and we don't build a executable.
Using a combination of "pie", "pic", shared and static libraries makes the
compilation of `kiwix-lib` fails with a "undefined symbol main".
Removing the pie option solve the problem.
The `cross_path_only` option used in `cmake` and `meson` builder where
mainly here to avoid kiwix-build to set the env with `CC` and `CXX`
variable set.
This is needed as `cmake` and `meson` will find the correct compiler
from the cross-config file.
However, even for them, we need to set some environment variables
(especially PKG_CONFIG_LIBDIR)
So we need another level a configuration to be able to set a cross_env
without setting the compiler's env variables.
Those option should be set by build system, not by kiwix-build.
Moreover, this impact other libraries (as icu) and generate pretty big
library binaries.
On android platform, we load the ICU data as external data, not embeded
in the kiwix-lib.
So we need to generate correctly the dat file and use it in kiwix-android.
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.
ICU doesn't provide data sources in their release archives but directly
pre-compiled data.
As we need to compile ourselves our data to remove unwanted data, we need
to get the sources directly from the SVN.
The custom app to build must be specified as an option when running
kiwix-build.
In the same way, the zim file to download must be specified in the
`info.json` (`zim_url` key) or given as option.