libzim icon indicating copy to clipboard operation
libzim copied to clipboard

Build both dyn & static libraries (per default)

Open kelson42 opened this issue 7 years ago • 7 comments
trafficstars

Currently, we build the dynamic library per default, and we need to add --default-library=static to get the static library (but then not the .so. To my opinion both library should be built and installed per default in an attempt to simplify usage of the library.

kelson42 avatar Jun 09 '18 09:06 kelson42

This seems technically feasible with meson 0.46, see https://github.com/mesonbuild/meson/issues/484. That said it seems that our own compilation stuff should be adapted too.

kelson42 avatar Jun 09 '18 10:06 kelson42

@legoktm Does that make sense to you? How do we secure that for the deb package?

kelson42 avatar Jun 09 '20 12:06 kelson42

Based on a quick glance the meson ticket it looks possible. I can look more in-depth and try it out once the PPA stuff is in place.

legoktm avatar Jun 11 '20 00:06 legoktm

@legoktm We are so far and as far I know this is what you (should) do already for the deb package?

kelson42 avatar Jul 23 '20 09:07 kelson42

Care should be taken that it doesn't break the kiwix-build compilation. kiwix-build assume projects and dependencies build either statically or dynamically, not both. We must ensure that link is correctly done if both static and dynamic libraries are present.

And on a optimization side, if the build is correct, we may also change kiwix-build to take profit of the "double" compilation and avoid to compile twice the same project.

mgautierfr avatar Jul 23 '20 12:07 mgautierfr

The Debian packages are just building dynamic libraries right now. I haven't looked into it since we talked about this in June and it's lower on my priority list right now (still need to get zim-tools and kiwix-desktop added to the PPA).

legoktm avatar Jul 23 '20 22:07 legoktm

This should already work now, right? Just configure meson with -Ddefault_library=both if you want both. You can change the default per-project setting using default_options: ['default_library=both'] in the project() function.

eli-schwartz avatar Mar 16 '23 01:03 eli-schwartz