From 4a71fa682788956f09f00afe1e8a6f0872e53435 Mon Sep 17 00:00:00 2001 From: Tim Besard Date: Sun, 11 Dec 2022 15:24:16 +0100 Subject: [PATCH 1/3] glib: also generate static libraries. --- G/Glib/build_tarballs.jl | 1 + 1 file changed, 1 insertion(+) diff --git a/G/Glib/build_tarballs.jl b/G/Glib/build_tarballs.jl index 1b7acc36401..f19a175dae0 100644 --- a/G/Glib/build_tarballs.jl +++ b/G/Glib/build_tarballs.jl @@ -35,6 +35,7 @@ atomic_patch -p1 ../patches/utimensat-macos.patch mkdir build_glib && cd build_glib meson --cross-file="${MESON_TARGET_TOOLCHAIN}" \ + --default-library both \ --buildtype=release \ -Dman=false \ "${MESON_FLAGS[@]}" \ From aa545b70c609747e5fbc8ab094f601736fe9a352 Mon Sep 17 00:00:00 2001 From: Tim Besard Date: Sun, 11 Dec 2022 16:25:33 +0100 Subject: [PATCH 2/3] Hack around meson breaking our build. --- G/Glib/build_tarballs.jl | 3 +++ 1 file changed, 3 insertions(+) diff --git a/G/Glib/build_tarballs.jl b/G/Glib/build_tarballs.jl index f19a175dae0..9cb72219a49 100644 --- a/G/Glib/build_tarballs.jl +++ b/G/Glib/build_tarballs.jl @@ -15,6 +15,9 @@ script = raw""" cd $WORKSPACE/srcdir/glib-*/ install_license COPYING +# meson shouldn't be so opinionated (mesonbuild/meson#4542 is incomplete) +sed -i '/Werror=unused-command-line-argument/d' /usr/lib/python3.9/site-packages/mesonbuild/compilers/mixins/clang.py + if [[ "${target}" == *-freebsd* ]]; then # Our FreeBSD libc has `environ` as undefined symbol, so the linker will # complain if this symbol is used in the built library, even if this won't From cbc4770b9e441f5d412829e1d011a36befee9fba Mon Sep 17 00:00:00 2001 From: Tim Besard Date: Sun, 11 Dec 2022 16:45:53 +0100 Subject: [PATCH 3/3] Don't build static lib on Windows. --- G/Glib/build_tarballs.jl | 35 +++++++++++++++++++++-------------- 1 file changed, 21 insertions(+), 14 deletions(-) diff --git a/G/Glib/build_tarballs.jl b/G/Glib/build_tarballs.jl index 9cb72219a49..beb901b2303 100644 --- a/G/Glib/build_tarballs.jl +++ b/G/Glib/build_tarballs.jl @@ -18,12 +18,10 @@ install_license COPYING # meson shouldn't be so opinionated (mesonbuild/meson#4542 is incomplete) sed -i '/Werror=unused-command-line-argument/d' /usr/lib/python3.9/site-packages/mesonbuild/compilers/mixins/clang.py -if [[ "${target}" == *-freebsd* ]]; then - # Our FreeBSD libc has `environ` as undefined symbol, so the linker will - # complain if this symbol is used in the built library, even if this won't - # be a problem at runtim. This flag allows having undefined symbols. - MESON_FLAGS=(-Db_lundef=false) +# Backport https://gitlab.gnome.org/GNOME/glib/-/merge_requests/2914 +atomic_patch -p1 ../patches/utimensat-macos.patch +if [[ "${target}" == *-freebsd* ]]; then # Adapt patch relative to `xattr` from # http://cvsweb.netbsd.org/bsdweb.cgi/pkgsrc/devel/glib2/patches/patch-meson.build?rev=1.2&content-type=text/x-cvsweb-markup. # Quoting the comment: @@ -32,17 +30,26 @@ if [[ "${target}" == *-freebsd* ]]; then atomic_patch -p1 ../patches/freebsd-have_xattr.patch fi -# Backport https://gitlab.gnome.org/GNOME/glib/-/merge_requests/2914 -atomic_patch -p1 ../patches/utimensat-macos.patch - mkdir build_glib && cd build_glib -meson --cross-file="${MESON_TARGET_TOOLCHAIN}" \ - --default-library both \ - --buildtype=release \ - -Dman=false \ - "${MESON_FLAGS[@]}" \ - .. +MESON_FLAGS=(--cross-file="${MESON_TARGET_TOOLCHAIN}") +MESON_FLAGS+=(--buildtype=release) +MESON_FLAGS+=(-Dman=false) + +if [[ "${target}" == *-freebsd* ]]; then + # Our FreeBSD libc has `environ` as undefined symbol, so the linker will + # complain if this symbol is used in the built library, even if this won't + # be a problem at runtim. This flag allows having undefined symbols. + MESON_FLAGS+=(-Db_lundef=false) +fi + +if [[ "${target}" != *-mingw* ]]; then + # on Windows, we can't build both static and shared libraries at the same time, + # so stick to the shared one until we have a need for a static build + MESON_FLAGS+=(--default-library both) +fi + +meson "${MESON_FLAGS[@]}" .. # Meson beautifully forces thin archives, without checking whether the dynamic linker # actually supports them: . Let's remove