|
root / base / glib2
glib2 Plain Text 135 lines 6.7 KB
  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
#!/bin/sh
# Build script for glib2 (Meson, Template B).
# Deps: pcre2 (ported, above), libffi + zlib (PRESENT in base, /usr/lib -
# not ported; their .pc files are picked up via the /usr/lib/pkgconfig
# entry below). iconv is provided by illumos libc - meson's builtin
# dependency('iconv') probe finds it there with no extra flag needed.
#
# GOTCHA (Task 6): illumos ships a native Sun/illumos `msgfmt` at
# /usr/bin/msgfmt that is NOT command-line compatible with GNU gettext's
# msgfmt (confirmed on alpha9: `msgfmt --version` errors with "Cannot open
# file --version" - it treats every arg as a filename to open, not an
# option). glib's po/meson.build calls i18n.gettext(), which requires a
# GNU-compatible msgfmt/xgettext. glib's own `nls` option defaults to
# 'auto' and gates the entire po/ subdir behind `find_program('xgettext',
# required: get_option('nls'))`, so passing -Dnls=disabled skips that
# subdir entirely (no msgfmt/xgettext ever invoked) without touching any
# core (non-translation) functionality. No devel/gettext port needed for
# this port.
#
# GOTCHA (Task 6): meson's dtrace/systemtap options default to 'auto' and
# both probe-detect true because /usr/sbin/dtrace exists on Hammerhead
# (illumos DTrace). But glib's meson dtrace codegen step assumes the
# Linux/systemtap-style two-pass workflow (compile objects with probes
# first, THEN `dtrace -G` against those objects); it invokes
# `dtrace -G -s glib_probes.d -o glib_probes.o` with ONLY the .d script
# and no object files, which illumos dtrace rejects: "failed to link
# script ...: No probe sites found for declared provider" - not an
# illumos/dtrace bug, just glib's meson dtrace glue not matching how
# illumos's -G-only invocation needs objects present. Static USDT probes
# are optional instrumentation, not core functionality - disable
# dtrace/systemtap explicitly rather than relying on 'auto' probing.
set -e
cd "$SRCDIR"

# GOTCHA (Task 6): meson's host_machine.system() comes straight from
# Python's platform.system().lower() at configure time, which on
# Hammerhead reports 'hammerhead' (confirmed: `uname -s` => "Hammerhead"
# post-SYSNAME_PLATFORM_RENAME), not 'sunos'. glib's meson.build has
# several `host_system == 'sunos'` branches specifically for illumos/
# Solaris correctness - none of them fire for us. The one that bites at
# build time: "if host_system != 'sunos': functions += ['sysinfo']" -
# meson then probes cc.has_function('sysinfo') (true - illumos HAS a
# sysinfo(), just the unrelated SVR4 systeminfo(2) one, not Linux's
# struct-sysinfo RAM-stats one) and sets HAVE_SYSINFO, so
# gio/gmemorymonitorbase.c compiles the Linux `struct sysinfo`
# code path instead of its already-present Solaris sysconf(_SC_PHYS_PAGES)
# fallback. Patch the guard to also exclude 'hammerhead' rather than
# disabling memory-monitor functionality outright.
if [ -f meson.build ]; then
    sed -i "s/if host_system != 'sunos'/if host_system != 'sunos' and host_system != 'hammerhead'/" meson.build
fi

export PKG_CONFIG_PATH="$PREFIX/lib/pkgconfig:$PREFIX/share/pkgconfig:/usr/lib/pkgconfig:$PKG_CONFIG_PATH"
# GOTCHA (Task 6): illumos libc's iconv(3) takes `const char **` for the
# input-buffer argument (POSIX-conformant), but glib/gconvert.c's g_iconv()
# wrapper takes plain `char **` and passes it straight through (glib has no
# configure-time ICONV_CONST detection - it assumes the glibc signature).
# GCC 14 promoted -Wincompatible-pointer-types from a warning to a hard
# error by default in C mode, so this one call site now fails the build.
# Rather than patching upstream glib source, demote it back to a warning.
# GOTCHA (Task 6): illumos's <pwd.h> (and <grp.h>) gate the POSIX.1c
# 5-arg reentrant getpwnam_r()/getpwuid_r() prototypes (returning int,
# via a 'struct passwd **' result out-param) behind
# `_POSIX_C_SOURCE >= 199506L || defined(_POSIX_PTHREAD_SEMANTICS)`.
# __EXTENSIONS__ alone is NOT enough - without one of those two also
# defined, the header falls back to the legacy SVR4 4-arg form (returning
# 'struct passwd *' directly), which is what glib/gutils.c's
# g_get_user_database_entry() gets miscompiled against ("too many
# arguments to function 'getpwnam_r'"). Define _POSIX_PTHREAD_SEMANTICS
# to select the POSIX form glib expects (also fixes the same class of
# issue for getgrnam_r/getgrgid_r if pango/harfbuzz/cairo ever probe them).
# GOTCHA (Task 6): glib's meson.build has a `host_system == 'sunos'`
# block (unreached here, same host_system-name mismatch as above) that
# probes and sets the highest working `_XOPEN_SOURCE` (800/700/600) plus
# __EXTENSIONS__ specifically so illumos's <sys/socket.h> exposes the
# XPG4v2 struct msghdr fields (msg_control/msg_controllen/msg_flags -
# gated behind `#if defined(_XPG4_2)`, which /usr/include/sys/
# feature_tests.h only #defines once _XOPEN_SOURCE is set to 500+).
# Without it, gio/gsocket.c's msghdr-based recvmsg/sendmsg ancillary-data
# code fails ("struct msghdr has no member named msg_control"). Set
# _XOPEN_SOURCE=700 directly (cascades to _XPG4_2 in feature_tests.h);
# __EXTENSIONS__ is still required alongside it so the XOPEN-strict mode
# doesn't hide the non-standard extensions glib also needs elsewhere.
export CFLAGS="${CFLAGS} -D__EXTENSIONS__ -D_XOPEN_SOURCE=700 -D_POSIX_PTHREAD_SEMANTICS -Wno-error=incompatible-pointer-types"
export LDFLAGS="${LDFLAGS} -Wl,-R,$PREFIX/lib"

meson setup build \
    --prefix="$PREFIX" \
    --libdir=lib \
    --sysconfdir="$SYSCONFDIR" \
    --buildtype=release \
    -Ddefault_library=shared \
    -Dtests=false \
    -Dselinux=disabled \
    -Dxattr=false \
    -Dman-pages=disabled \
    -Dintrospection=disabled \
    -Dnls=disabled \
    -Ddtrace=disabled \
    -Dsystemtap=disabled

ninja -C build -j${JOBS:-1}
DESTDIR="$PKGDIR" ninja -C build install
# glib2 - core low-level cross-platform library (Openbox render-stack dep)
# https://download.gnome.org/sources/glib/
#
# VERSION NOTE (Task 6): the phase1a manifest listed 2.89.2, but GNOME's
# glib versioning is even-minor=stable / odd-minor=development (2.89.x is
# the development cycle leading to 2.90). Verified against
# download.gnome.org/sources/glib/cache.json: the highest STABLE
# (even-minor) release is 2.88.2 (2.86.x and earlier are older stable
# lines). Using 2.88.2.

[package]
name = "glib2"
version = "2.88.2"
release = 1
description = "Core low-level cross-platform library (GLib/GObject/GIO)"
url = "https://www.gtk.org/"
license = "LGPL-2.1-or-later"
maintainer = "Chris Tusa <chris.tusa@leafscale.com>"
arch = "x86_64"

[dependencies]
runtime = ["pcre2"]
build = ["pcre2"]

[[source]]
file = "glib-2.88.2.tar.xz"
urls = ["https://download.gnome.org/sources/glib/2.88/glib-2.88.2.tar.xz"]
checksum = "cf3f215a640c8a4257f14317586b8f1fdd25a10a93cb4bdda147c0f9ad88e74f"

[build]
parallel = true