Revert "build-style/meson.sh: drop unneeded AR export"

This reverts commit 2163ca2d03.

Removing `export AR=gcc-ar` was apparently done based on the assumption
that the linked issue (https://github.com/mesonbuild/meson/issues/1646)
had been solved completely on meson's side.

Instead, their solution, seen in
https://github.com/void-linux/void-packages/pull/2815, had been to force
gcc-ar for linking static libraries; by exporting `AR=ar`, we were
accidentally breaking static libraries when LTO is enabled. This was
noticed by leah while we were trying to build qemu-user-static using the
normal libglib-devel package (built with meson, which for us defaults to
enabling LTO).

Unfortunately, while correct, this change wasn't enough to fix the
static glib build, which had to resort to disabling LTO.
This commit is contained in:
Érico Rolim 2021-01-13 17:37:28 -03:00 committed by Érico Nogueira Rolim
parent cb3ce111fe
commit 84a5c1ef7c

View file

@ -92,6 +92,14 @@ do_configure() {
configure_args+=" --cross-file=${meson_crossfile}"
fi
# binutils ar needs a plugin when LTO is used on static libraries, so we
# have to use the gcc-ar wrapper that calls the correct plugin.
# As seen in https://github.com/mesonbuild/meson/issues/1646 (and its
# solution, https://github.com/mesonbuild/meson/pull/1649), meson fixed
# issues with static libraries + LTO by defaulting to gcc-ar themselves.
# We also force gcc-ar usage in the crossfile above.
export AR="gcc-ar"
${meson_cmd} \
--prefix=/usr \
--libdir=/usr/lib${XBPS_TARGET_WORDSIZE} \