Skip to content

Commit d7478e4

Browse files
authored
feat(glib): GLib 2.82.5 as three packages — glib, gobject, gmodule (#319)
* feat(glib): GLib 2.82.5 as three packages — glib, gobject, gmodule Upstream ships one source tree producing four separate shared libraries, and this index follows that split, because that is what a consumer links. WHY A FORK: six generators, and build.mcpp reimplements all of them, so the tree carries no sh and no python. gen-visibility-macros.py versions-macros glib/gversionmacros.h gen-visibility-macros.py visibility-macros three *-visibility.h configure_file glibconfig.h configure_file gmodule/gmoduleconf.h gobject/glib-mkenums (816 lines of Python) glib-enumtypes.{h,c} configure_file config.h glib-mkenums is reproduced FOR THE ONE INPUT this build points it at — glib/gunicode.h, four enums — rather than wholesale. It reads upstream's .template files from the tree so a template change is picked up, and exits non-zero if that header stops yielding four enums: a silent drop would produce a library missing g_unicode_script_get_type, and the failure would land in a consumer rather than in CI. NO MODULE, DELIBERATELY. glib's API is macro-heavy — G_DEFINE_TYPE, G_OBJECT, g_signal_connect are all macros — and macros do not cross a module boundary, so an `import` would hand a consumer the declarations and withhold the half that makes them usable. Compare wlroots.wlroots in this same index, where the module is the ONLY way in because the headers are not valid C++ at all. The shape follows what upstream's headers are. WHAT THE TESTS ASSERT. Not "it linked" — each reads back a value a generator decided: G_BYTE_ORDER against what the bytes actually say; G_GSIZE_FORMAT by printing a gsize; GLIB_VERSION_2_82 against G_ENCODE_VERSION; g_utf8_strup of "straße" giving STRASSE, i.e. real case tables; \p{Han} through GRegex, which is the one place this package and compat.pcre2 have to agree; and g_unicode_script_get_type() registering a GType whose value nick is "han" — the fiddly half of mkenums, and the only evidence the generator produced REGISTERABLE code rather than a header that compiles. gobject registers a derived type at run time with a property and a signal, emits it, and binds two objects together. gmodule opens a module and checks what its generated header decided — but does NOT dlsym into itself, because glib is kind = "lib" and there is no shared object in the link map to find one in; that assertion would be measuring the link line. ⚠️ gio IS NOT HERE, AND THAT BLOCKS pango. Two of gio's six generators are gdbus-codegen, an 8,351-line Python program turning D-Bus interface XML into GObject skeletons; seven gio sources include its output and two more reference those. pango uses GListModel, which lives in gio. Every other pango dependency — harfbuzz, fribidi, fontconfig, cairo — is already in this index. Measured and recorded rather than left as an unexplained gap. Fork CI green on both toolchains; the three examples pass here against the published index. * fix(glib): re-cut 2.82.5 — gmoduleconf.h goes flat CI failed on a fresh extraction with gmodule.c:52: fatal error: gmoduleconf.h: No such file or directory while every warm tree passed — the signature of the trap this fork already documents for `include/` itself. mcpp builds the compiler command line from `include_dirs` BEFORE running the build program and SILENTLY DROPS an entry naming a directory that does not exist yet. `include/.gitkeep` makes `include/` exist; it does not make `include/gmodule/` exist, and that was the entry gmodule needed. Writing gmoduleconf.h flat removes the entry and the problem together. Fork CI green on both toolchains; the three examples pass here against the re-cut release. CN container moves to 2.82.5-1: gitcode will not replace an asset of the same name.
1 parent c8e21ab commit d7478e4

10 files changed

Lines changed: 822 additions & 0 deletions

File tree

mcpp.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,9 @@ members = [
104104
"tests/examples/wlroots",
105105
"tests/examples/pcre2",
106106
"tests/examples/fribidi",
107+
"tests/examples/glib",
108+
"tests/examples/gobject",
109+
"tests/examples/gmodule",
107110
"tests/examples/libgbm",
108111
"tests/examples/libpng",
109112
"tests/examples/libwebp",

pkgs/g/gnome.glib.lua

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
-- gnome.glib — part of GLib 2.82.5.
2+
--
3+
-- Upstream ships glib as one source tree producing FOUR separate shared
4+
-- libraries, and this index follows that split: `gnome.glib`,
5+
-- `gnome.gobject` and `gnome.gmodule` are three packages from one fork,
6+
-- because that is what a consumer links. (The fourth, gio, is absent — see
7+
-- below.)
8+
--
9+
-- ─────────────────────────────────────────────────────────────────────────
10+
-- WHY A FORK
11+
--
12+
-- Generators, not line count. GLib has six, and `build.mcpp` reimplements all
13+
-- of them, so the tree carries no `sh` and no `python`:
14+
--
15+
-- gen-visibility-macros.py versions-macros glib/gversionmacros.h
16+
-- gen-visibility-macros.py visibility-macros three *-visibility.h
17+
-- configure_file glibconfig.h
18+
-- configure_file gmodule/gmoduleconf.h
19+
-- gobject/glib-mkenums (816 lines of Python) glib-enumtypes.{h,c}
20+
-- configure_file config.h
21+
--
22+
-- glib-mkenums is reproduced FOR THE ONE INPUT this build points it at —
23+
-- `glib/gunicode.h`, four enums — rather than wholesale. It reads upstream's
24+
-- `.template` files from the tree so a template change is picked up, and
25+
-- exits non-zero if that header stops yielding four enums: a silent drop
26+
-- would produce a library missing `g_unicode_script_get_type` and the failure
27+
-- would land in a consumer.
28+
--
29+
-- https://github.com/mcpplibs/glib
30+
--
31+
-- ─────────────────────────────────────────────────────────────────────────
32+
-- ⚠️ C++ CONSUMERS MUST WRAP THE INCLUDES
33+
--
34+
-- glib's headers carry their own `G_BEGIN_DECLS`, so this is usually fine —
35+
-- but the generated `glib-enumtypes.h` comes from a template, and wrapping
36+
-- costs nothing:
37+
--
38+
-- extern "C" {
39+
-- #include <glib-object.h>
40+
-- }
41+
--
42+
-- There is no module. glib's API is macro-heavy — `G_DEFINE_TYPE`,
43+
-- `G_OBJECT`, `g_signal_connect` are all macros — and macros do not cross a
44+
-- module boundary, so an `import` would hand a consumer the declarations and
45+
-- withhold the half of the API that makes them usable. Compare
46+
-- `wlroots.wlroots`, where the module is the ONLY way in because the headers
47+
-- are not valid C++ at all: the shape follows what upstream's headers are,
48+
-- not a house style.
49+
--
50+
-- ─────────────────────────────────────────────────────────────────────────
51+
-- ⚠️ gio IS NOT IN THIS INDEX, AND THAT BLOCKS pango
52+
--
53+
-- Two of gio's six generators are `gdbus-codegen`, an 8,351-line Python
54+
-- program that turns D-Bus interface XML into GObject skeletons. Seven gio
55+
-- sources include its output and two more reference those, so it cannot be
56+
-- dropped without changing what gio is, and reimplementing it in
57+
-- `build.mcpp` is not proportionate.
58+
--
59+
-- pango uses `GListModel`, which lives in gio, so the text-layout line stops
60+
-- here. Measured and recorded rather than left as an unexplained gap.
61+
--
62+
-- ─────────────────────────────────────────────────────────────────────────
63+
-- LINUX ONLY
64+
--
65+
-- The generated `glibconfig.h` fixes `G_OS_UNIX`, the POSIX thread
66+
-- implementation and the poll constants, and `build.mcpp` refuses to run
67+
-- anywhere else rather than emitting a header that is quietly wrong. The
68+
-- upstream tree also contains two `COPYING` symlinks, which a Windows
69+
-- extraction would not survive — one more reason the descriptor offers
70+
-- `linux` alone.
71+
package = {
72+
spec = "1",
73+
namespace = "gnome",
74+
name = "glib",
75+
description = "GLib 2.82.5 — data structures, the main loop, Unicode, GVariant and GRegex",
76+
licenses = {"LGPL-2.1-or-later"},
77+
repo = "https://github.com/mcpplibs/glib",
78+
type = "package",
79+
80+
xpm = {
81+
linux = {
82+
["2.82.5"] = {
83+
url = {
84+
GLOBAL = "https://github.com/mcpplibs/glib/archive/refs/tags/2.82.5.tar.gz",
85+
-- ⚠️ The container tag is `2.82.5-1`, not `2.82.5`. The fork's
86+
-- tag was re-cut once while this descriptor was still
87+
-- unpublished — safe only because nothing had extracted it
88+
-- yet — and gitcode refuses to REPLACE an asset of the same
89+
-- name in an existing release. Verified: this URL's sha256
90+
-- equals the GLOBAL tarball's.
91+
CN = "https://gitcode.com/mcpp-res/glib/releases/download/2.82.5-1/glib-2.82.5.tar.gz",
92+
},
93+
sha256 = "98118dacf3ebc9d5aefba340e9248385f1643b76ca672b864c37a3e4fb71caf6",
94+
},
95+
},
96+
},
97+
98+
mcpp = "*/mcpp/glib/mcpp.toml",
99+
}

pkgs/g/gnome.gmodule.lua

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
-- gnome.gmodule — part of GLib 2.82.5.
2+
--
3+
-- Upstream ships glib as one source tree producing FOUR separate shared
4+
-- libraries, and this index follows that split: `gnome.glib`,
5+
-- `gnome.gobject` and `gnome.gmodule` are three packages from one fork,
6+
-- because that is what a consumer links. (The fourth, gio, is absent — see
7+
-- below.)
8+
--
9+
-- ─────────────────────────────────────────────────────────────────────────
10+
-- WHY A FORK
11+
--
12+
-- Generators, not line count. GLib has six, and `build.mcpp` reimplements all
13+
-- of them, so the tree carries no `sh` and no `python`:
14+
--
15+
-- gen-visibility-macros.py versions-macros glib/gversionmacros.h
16+
-- gen-visibility-macros.py visibility-macros three *-visibility.h
17+
-- configure_file glibconfig.h
18+
-- configure_file gmodule/gmoduleconf.h
19+
-- gobject/glib-mkenums (816 lines of Python) glib-enumtypes.{h,c}
20+
-- configure_file config.h
21+
--
22+
-- glib-mkenums is reproduced FOR THE ONE INPUT this build points it at —
23+
-- `glib/gunicode.h`, four enums — rather than wholesale. It reads upstream's
24+
-- `.template` files from the tree so a template change is picked up, and
25+
-- exits non-zero if that header stops yielding four enums: a silent drop
26+
-- would produce a library missing `g_unicode_script_get_type` and the failure
27+
-- would land in a consumer.
28+
--
29+
-- https://github.com/mcpplibs/glib
30+
--
31+
-- ─────────────────────────────────────────────────────────────────────────
32+
-- ⚠️ C++ CONSUMERS MUST WRAP THE INCLUDES
33+
--
34+
-- glib's headers carry their own `G_BEGIN_DECLS`, so this is usually fine —
35+
-- but the generated `glib-enumtypes.h` comes from a template, and wrapping
36+
-- costs nothing:
37+
--
38+
-- extern "C" {
39+
-- #include <glib-object.h>
40+
-- }
41+
--
42+
-- There is no module. glib's API is macro-heavy — `G_DEFINE_TYPE`,
43+
-- `G_OBJECT`, `g_signal_connect` are all macros — and macros do not cross a
44+
-- module boundary, so an `import` would hand a consumer the declarations and
45+
-- withhold the half of the API that makes them usable. Compare
46+
-- `wlroots.wlroots`, where the module is the ONLY way in because the headers
47+
-- are not valid C++ at all: the shape follows what upstream's headers are,
48+
-- not a house style.
49+
--
50+
-- ─────────────────────────────────────────────────────────────────────────
51+
-- ⚠️ gio IS NOT IN THIS INDEX, AND THAT BLOCKS pango
52+
--
53+
-- Two of gio's six generators are `gdbus-codegen`, an 8,351-line Python
54+
-- program that turns D-Bus interface XML into GObject skeletons. Seven gio
55+
-- sources include its output and two more reference those, so it cannot be
56+
-- dropped without changing what gio is, and reimplementing it in
57+
-- `build.mcpp` is not proportionate.
58+
--
59+
-- pango uses `GListModel`, which lives in gio, so the text-layout line stops
60+
-- here. Measured and recorded rather than left as an unexplained gap.
61+
--
62+
-- ─────────────────────────────────────────────────────────────────────────
63+
-- LINUX ONLY
64+
--
65+
-- The generated `glibconfig.h` fixes `G_OS_UNIX`, the POSIX thread
66+
-- implementation and the poll constants, and `build.mcpp` refuses to run
67+
-- anywhere else rather than emitting a header that is quietly wrong. The
68+
-- upstream tree also contains two `COPYING` symlinks, which a Windows
69+
-- extraction would not survive — one more reason the descriptor offers
70+
-- `linux` alone.
71+
package = {
72+
spec = "1",
73+
namespace = "gnome",
74+
name = "gmodule",
75+
description = "GModule 2.82.5 — portable dynamic module loading over dlopen",
76+
licenses = {"LGPL-2.1-or-later"},
77+
repo = "https://github.com/mcpplibs/glib",
78+
type = "package",
79+
80+
xpm = {
81+
linux = {
82+
["2.82.5"] = {
83+
url = {
84+
GLOBAL = "https://github.com/mcpplibs/glib/archive/refs/tags/2.82.5.tar.gz",
85+
-- ⚠️ The container tag is `2.82.5-1`, not `2.82.5`. The fork's
86+
-- tag was re-cut once while this descriptor was still
87+
-- unpublished — safe only because nothing had extracted it
88+
-- yet — and gitcode refuses to REPLACE an asset of the same
89+
-- name in an existing release. Verified: this URL's sha256
90+
-- equals the GLOBAL tarball's.
91+
CN = "https://gitcode.com/mcpp-res/glib/releases/download/2.82.5-1/glib-2.82.5.tar.gz",
92+
},
93+
sha256 = "98118dacf3ebc9d5aefba340e9248385f1643b76ca672b864c37a3e4fb71caf6",
94+
},
95+
},
96+
},
97+
98+
mcpp = "*/mcpp/gmodule/mcpp.toml",
99+
}

pkgs/g/gnome.gobject.lua

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
-- gnome.gobject — part of GLib 2.82.5.
2+
--
3+
-- Upstream ships glib as one source tree producing FOUR separate shared
4+
-- libraries, and this index follows that split: `gnome.glib`,
5+
-- `gnome.gobject` and `gnome.gmodule` are three packages from one fork,
6+
-- because that is what a consumer links. (The fourth, gio, is absent — see
7+
-- below.)
8+
--
9+
-- ─────────────────────────────────────────────────────────────────────────
10+
-- WHY A FORK
11+
--
12+
-- Generators, not line count. GLib has six, and `build.mcpp` reimplements all
13+
-- of them, so the tree carries no `sh` and no `python`:
14+
--
15+
-- gen-visibility-macros.py versions-macros glib/gversionmacros.h
16+
-- gen-visibility-macros.py visibility-macros three *-visibility.h
17+
-- configure_file glibconfig.h
18+
-- configure_file gmodule/gmoduleconf.h
19+
-- gobject/glib-mkenums (816 lines of Python) glib-enumtypes.{h,c}
20+
-- configure_file config.h
21+
--
22+
-- glib-mkenums is reproduced FOR THE ONE INPUT this build points it at —
23+
-- `glib/gunicode.h`, four enums — rather than wholesale. It reads upstream's
24+
-- `.template` files from the tree so a template change is picked up, and
25+
-- exits non-zero if that header stops yielding four enums: a silent drop
26+
-- would produce a library missing `g_unicode_script_get_type` and the failure
27+
-- would land in a consumer.
28+
--
29+
-- https://github.com/mcpplibs/glib
30+
--
31+
-- ─────────────────────────────────────────────────────────────────────────
32+
-- ⚠️ C++ CONSUMERS MUST WRAP THE INCLUDES
33+
--
34+
-- glib's headers carry their own `G_BEGIN_DECLS`, so this is usually fine —
35+
-- but the generated `glib-enumtypes.h` comes from a template, and wrapping
36+
-- costs nothing:
37+
--
38+
-- extern "C" {
39+
-- #include <glib-object.h>
40+
-- }
41+
--
42+
-- There is no module. glib's API is macro-heavy — `G_DEFINE_TYPE`,
43+
-- `G_OBJECT`, `g_signal_connect` are all macros — and macros do not cross a
44+
-- module boundary, so an `import` would hand a consumer the declarations and
45+
-- withhold the half of the API that makes them usable. Compare
46+
-- `wlroots.wlroots`, where the module is the ONLY way in because the headers
47+
-- are not valid C++ at all: the shape follows what upstream's headers are,
48+
-- not a house style.
49+
--
50+
-- ─────────────────────────────────────────────────────────────────────────
51+
-- ⚠️ gio IS NOT IN THIS INDEX, AND THAT BLOCKS pango
52+
--
53+
-- Two of gio's six generators are `gdbus-codegen`, an 8,351-line Python
54+
-- program that turns D-Bus interface XML into GObject skeletons. Seven gio
55+
-- sources include its output and two more reference those, so it cannot be
56+
-- dropped without changing what gio is, and reimplementing it in
57+
-- `build.mcpp` is not proportionate.
58+
--
59+
-- pango uses `GListModel`, which lives in gio, so the text-layout line stops
60+
-- here. Measured and recorded rather than left as an unexplained gap.
61+
--
62+
-- ─────────────────────────────────────────────────────────────────────────
63+
-- LINUX ONLY
64+
--
65+
-- The generated `glibconfig.h` fixes `G_OS_UNIX`, the POSIX thread
66+
-- implementation and the poll constants, and `build.mcpp` refuses to run
67+
-- anywhere else rather than emitting a header that is quietly wrong. The
68+
-- upstream tree also contains two `COPYING` symlinks, which a Windows
69+
-- extraction would not survive — one more reason the descriptor offers
70+
-- `linux` alone.
71+
package = {
72+
spec = "1",
73+
namespace = "gnome",
74+
name = "gobject",
75+
description = "GObject 2.82.5 — the GLib type system: GType, signals, properties, closures and GValue",
76+
licenses = {"LGPL-2.1-or-later"},
77+
repo = "https://github.com/mcpplibs/glib",
78+
type = "package",
79+
80+
xpm = {
81+
linux = {
82+
["2.82.5"] = {
83+
url = {
84+
GLOBAL = "https://github.com/mcpplibs/glib/archive/refs/tags/2.82.5.tar.gz",
85+
-- ⚠️ The container tag is `2.82.5-1`, not `2.82.5`. The fork's
86+
-- tag was re-cut once while this descriptor was still
87+
-- unpublished — safe only because nothing had extracted it
88+
-- yet — and gitcode refuses to REPLACE an asset of the same
89+
-- name in an existing release. Verified: this URL's sha256
90+
-- equals the GLOBAL tarball's.
91+
CN = "https://gitcode.com/mcpp-res/glib/releases/download/2.82.5-1/glib-2.82.5.tar.gz",
92+
},
93+
sha256 = "98118dacf3ebc9d5aefba340e9248385f1643b76ca672b864c37a3e4fb71caf6",
94+
},
95+
},
96+
},
97+
98+
mcpp = "*/mcpp/gobject/mcpp.toml",
99+
}

tests/examples/glib/mcpp.toml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# gnome.glib — the generated headers, and the subsystems that depend on them.
2+
[indices]
3+
gnome = { path = "../../.." }
4+
5+
[package]
6+
name = "glib-tests"
7+
version = "0.1.0"
8+
standard = "c++23"
9+
10+
[target.'cfg(linux)'.dependencies.gnome]
11+
glib = "2.82.5"

0 commit comments

Comments
 (0)