Skip to content

Test updated glib vcpkg library#6890

Closed
AenBleidd wants to merge 1 commit intomasterfrom
vko_test_updated_glib_library
Closed

Test updated glib vcpkg library#6890
AenBleidd wants to merge 1 commit intomasterfrom
vko_test_updated_glib_library

Conversation

@AenBleidd
Copy link
Member

@AenBleidd AenBleidd commented Feb 25, 2026

Summary by cubic

Adds a custom vcpkg port for GLib 2.86.4 with a Meson build and proper Windows linking for intl/iconv. Packages GLib tools under tools/glib and fixes pkg-config and script paths.

  • New Features
    • Force libintl (intl) and link as -lintl in pkg-config files.
    • Use GNU libiconv on Windows; update Meson to find and link iconv.
    • Meson portfile: disable docs/tests/introspection, handle helper binaries, move CLI tools to tools/glib, and patch Python script paths.
    • Optional features: selinux and libmount (Linux only).
    • Dependencies: gettext (host tools), gettext-libintl, libiconv, libffi, pcre2, zlib, and vcpkg-tool-meson (host).

Written for commit 19e3eba. Summary will update on new commits.

Signed-off-by: Vitalii Koshura <lestat.de.lionkur@gmail.com>
Copilot AI review requested due to automatic review settings February 25, 2026 04:45
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a custom vcpkg port for GLib 2.86.4 and patches upstream build logic to use external libiconv and enforce libintl usage.

Changes:

  • Introduces a new glib port manifest (vcpkg.json) with dependencies/features for vcpkg.
  • Adds a portfile.cmake to build GLib via Meson and relocate tools/scripts into tools/glib.
  • Adds patches to (a) use libiconv on Windows and (b) require libintl in Meson.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.

File Description
3rdParty/vcpkg_ports/ports/glib/vcpkg.json Defines the glib port version, dependencies, and optional features.
3rdParty/vcpkg_ports/ports/glib/portfile.cmake Implements the Meson build/install flow and post-install fixups for tools/pkgconfig/scripts.
3rdParty/vcpkg_ports/ports/glib/use-libiconv-on-windows.patch Patches upstream to link against libiconv on Windows instead of bundled win_iconv.c.
3rdParty/vcpkg_ports/ports/glib/libintl.patch Patches upstream Meson to require libintl and adjust dependency handling.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

string(REGEX MATCH "^([0-9]*[.][0-9]*)" VERSION_MAJOR_MINOR "${VERSION}")
# https://github.com/GNOME/glib/blob/main/SECURITY.md#supported-versions
if(NOT VERSION_MAJOR_MINOR MATCHES "[02468]\$")
message("${Z_VCPKG_BACKCOMPAT_MESSAGE_LEVEL}" "glib ${VERSION_MAJOR_MINOR} is a not a \"stable release series\".")
Copy link

Copilot AI Feb 25, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Grammar in the message is incorrect (is a not a). This is user-facing output from the port build; please correct it to read naturally (e.g., is not a).

Suggested change
message("${Z_VCPKG_BACKCOMPAT_MESSAGE_LEVEL}" "glib ${VERSION_MAJOR_MINOR} is a not a \"stable release series\".")
message("${Z_VCPKG_BACKCOMPAT_MESSAGE_LEVEL}" "glib ${VERSION_MAJOR_MINOR} is not a \"stable release series\".")

Copilot uses AI. Check for mistakes.
Comment on lines +21 to +25
# We have a #include "win_iconv.c" in gconvert.c on Windows, so we don't need
# any external library for it
- libiconv = []
+ libiconv = [cc.find_library('iconv')]
+ found_iconv = true
Copy link

Copilot AI Feb 25, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

found_iconv = true is set unconditionally even though cc.find_library('iconv') can fail (returning an unusable/empty result). This can make Meson believe iconv is available and proceed, only to fail later at link time or during feature checks. Prefer making the lookup required (so Meson errors immediately) or set found_iconv based on the actual result of the lookup. Also, the comment above is now outdated since win_iconv.c is no longer included by this patch.

Suggested change
# We have a #include "win_iconv.c" in gconvert.c on Windows, so we don't need
# any external library for it
- libiconv = []
+ libiconv = [cc.find_library('iconv')]
+ found_iconv = true
# Use external libiconv on Windows
# Make iconv a required dependency so the build fails if it's missing
- libiconv = []
+ libiconv = cc.find_library('iconv', required : true)
+ found_iconv = libiconv.found()

Copilot uses AI. Check for mistakes.
-if libintl.found() and libintl.type_name() != 'internal'
+libintl = dependency('intl', required : true)
+libintl_deps = [libintl]
+if false
Copy link

Copilot AI Feb 25, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using if false to disable a block leaves dead code in the patched Meson file, making the port harder to maintain/debug when upstream changes. Instead of hard-disabling the block, prefer either removing the unreachable block in the patch or replacing it with a meaningful condition (e.g., driven by libintl.type_name() or platform/toolchain constraints) that documents when the logic should apply.

Suggested change
+if false
+if libintl.type_name() != 'internal'

Copilot uses AI. Check for mistakes.
string(REPLACE "elif os.path.basename(filedir) == 'bin':" "elif os.path.basename(filedir) == 'tools':" _contents "${_contents}")
string(REPLACE "path = os.path.join(filedir, '..', 'share', 'glib-2.0')" "path = os.path.join(filedir, '../..', 'share', 'glib-2.0')" _contents "${_contents}")
string(REPLACE "path = os.path.join(filedir, '..')" "path = os.path.join(filedir, '../../share/glib-2.0')" _contents "${_contents}")
string(REPLACE "path = os.path.join('${CURRENT_PACKAGES_DIR}/share', 'glib-2.0')" "path = os.path.join('unuseable/share', 'glib-2.0')" _contents "${_contents}")
Copy link

Copilot AI Feb 25, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Replacing the embedded absolute path with a hard-coded non-existent path (unuseable/share) risks breaking gdbus-codegen at runtime if that branch is executed. Instead, adjust the script to compute the correct share directory relative to its installed location (e.g., relative to the tools directory) rather than forcing an invalid fallback. (Also, if you keep a placeholder, the word appears misspelled.)

Copilot uses AI. Check for mistakes.
@AenBleidd AenBleidd closed this Feb 26, 2026
@AenBleidd AenBleidd deleted the vko_test_updated_glib_library branch February 26, 2026 00:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants