Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

glib: Build static libraries. #5974

Merged
merged 3 commits into from
Dec 11, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 24 additions & 13 deletions G/Glib/build_tarballs.jl
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,13 @@ script = raw"""
cd $WORKSPACE/srcdir/glib-*/
install_license COPYING

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)
# 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

# 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:
Expand All @@ -29,16 +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}" \
--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: <https://github.com/mesonbuild/meson/issues/10823>. Let's remove
Expand Down