Commit 5c81e09b17ce85ca6d0a3d0b6d3684bb52d7e6df

Xavier Claessens 2020-10-26T11:26:04

* meson.build (bzip2_dep): Simplify. We remove `static:false` from `find_library('bz2')`. I don't know whether the previous code was a workaround for an old meson bug, but at least with version >=0.55.0 (which FreeType uses) it picks the shared library when both are available. With this commit, file `freetype2.pc` no longer contains the full path to file `libbz2.so`; instead, it correctly uses `-lbz2`. Note that this is a meson bug is still present in the current version (0.57.0).

diff --git a/ChangeLog b/ChangeLog
index d5521c3..57704cc 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,19 @@
 2021-02-09  Xavier Claessens  <xavier.claessens@collabora.com>
 
+	* meson.build (bzip2_dep): Simplify.
+
+	We remove `static:false` from `find_library('bz2')`.
+
+	I don't know whether the previous code was a workaround for an old
+	meson bug, but at least with version >=0.55.0 (which FreeType uses)
+	it picks the shared library when both are available.
+
+	File `freetype2.pc` still contains the full path to file `libbz2.so`
+	instead of `-lbz2` – that we need to do this is a meson bug even
+	present in the current version (0.57.0).
+
+2021-02-09  Xavier Claessens  <xavier.claessens@collabora.com>
+
 	* meson.build: Set project version.
 
 2021-02-04  Werner Lemberg  <wl@gnu.org>
diff --git a/meson.build b/meson.build
index dac0e6b..243046c 100644
--- a/meson.build
+++ b/meson.build
@@ -250,14 +250,7 @@ else
 endif
 
 # BZip2 support
-#
-# IMPORTANT NOTE: Without `static: false` here, Meson will find both the
-# static library version and the shared library version when they are
-# installed on the system, and will try to link them *both* to the final
-# library!
-bzip2_dep = meson.get_compiler('c').find_library('bz2',
-              static: false,
-              required: get_option('bzip2'))
+bzip2_dep = cc.find_library('bz2', required: get_option('bzip2'))
 if bzip2_dep.found()
   ftoption_command += ['--enable=FT_CONFIG_OPTION_USE_BZIP2']
   ft2_sources += files(['src/bzip2/ftbzip2.c',])