diff options
Diffstat (limited to 'pkgs/development/libraries/glib')
6 files changed, 116 insertions, 98 deletions
diff --git a/pkgs/development/libraries/glib/default.nix b/pkgs/development/libraries/glib/default.nix index cd03315c0b3c6..a60ba9fae6bfd 100644 --- a/pkgs/development/libraries/glib/default.nix +++ b/pkgs/development/libraries/glib/default.nix @@ -9,17 +9,25 @@ , pkg-config , perl , python3 -, libiconv, zlib, libffi, pcre2, elfutils, gnome, libselinux, bash, gnum4, gtk-doc, docbook_xsl, docbook_xml_dtd_45, libxslt +, python3Packages +, libiconv, zlib, libffi, pcre2, elfutils, gnome, libselinux, bash, gnum4, libxslt +, docutils, gi-docgen # use util-linuxMinimal to avoid circular dependency (util-linux, systemd, glib) , util-linuxMinimal ? null , buildPackages # this is just for tests (not in the closure of any regular package) -, coreutils, dbus, libxml2, tzdata +, coreutils, dbus, tzdata , desktop-file-utils, shared-mime-info , darwin , makeHardcodeGsettingsPatch , testers +, gobject-introspection +, mesonEmulatorHook +, withIntrospection ? + stdenv.hostPlatform.emulatorAvailable buildPackages && + lib.meta.availableOn stdenv.hostPlatform gobject-introspection && + stdenv.hostPlatform.isLittleEndian == stdenv.buildPlatform.isLittleEndian }: assert stdenv.isLinux -> util-linuxMinimal != null; @@ -38,16 +46,26 @@ let ln -sr -t "''${!outputInclude}/include/" "''${!outputInclude}"/lib/*/include/* 2>/dev/null || true ''; - buildDocs = stdenv.hostPlatform == stdenv.buildPlatform && !stdenv.hostPlatform.isStatic; + gobject-introspection' = buildPackages.gobject-introspection.override { + propagateFullGlib = false; + # Avoid introducing cairo, which enables gobjectSupport by default. + x11Support = false; + }; + + librarySuffix = if (stdenv.hostPlatform.extensions.library == ".so") then "2.0.so.0" + else if (stdenv.hostPlatform.extensions.library == ".dylib") then "2.0.0.dylib" + else if (stdenv.hostPlatform.extensions.library == ".a") then "2.0.a" + else if (stdenv.hostPlatform.extensions.library == ".dll") then "2.0-0.dll" + else "2.0-0.lib"; in stdenv.mkDerivation (finalAttrs: { pname = "glib"; - version = "2.78.4"; + version = "2.80.2"; src = fetchurl { url = "mirror://gnome/sources/glib/${lib.versions.majorMinor finalAttrs.version}/glib-${finalAttrs.version}.tar.xz"; - sha256 = "sha256-JLjgZy3KEgzDLTlLzLhYROcy4E/nXRi7BXOy28dUj2M="; + hash = "sha256-uc+296W9WzEjj9XVbfImst2l6jdhFHW/ifag+UAP6L0="; }; patches = lib.optionals stdenv.isDarwin [ @@ -56,13 +74,28 @@ stdenv.mkDerivation (finalAttrs: { ./quark_init_on_demand.patch ./gobject_init_on_demand.patch ] ++ [ + # Fix double-free & segfault issues on menu and dbus connection action group export failures + # https://gitlab.gnome.org/GNOME/glib/-/merge_requests/4073 + # Remove when version > 2.80.2 (fetchpatch { - name = "GLib-against-PCRE2-10.43.patch"; - url = "https://gitlab.gnome.org/GNOME/glib/-/commit/cce3ae98a2c1966719daabff5a4ec6cf94a846f6.patch"; - hash = "sha256-vgKzb5hQmFQGD8zxRrXnuX9Gpg/TeSrzehlOH2vA1xU="; + name = "GLib-Fix-memory-problems-on-gmenuexporter-and-gactiongroupexporter-error-paths.patch"; + url = "https://gitlab.gnome.org/GNOME/glib/-/commit/b9490a499a004618c883f180b1081a166ff1a86b.patch"; + hash = "sha256-c6uZ9NEhg26/2RdgjQ4s5ErCDm5HH6T/tfJXTwh/H6o="; }) + # This patch lets GLib's GDesktopAppInfo API watch and notice changes + # to the Nix user and system profiles. That way, the list of available + # applications shown by the desktop environment is immediately updated + # when the user installs or removes any + # (see <https://issues.guix.gnu.org/35594>). + + # It does so by monitoring /nix/var/nix/profiles (for changes to the system + # profile) and /nix/var/nix/profiles/per-user/USER (for changes to the user + # profile) as well as /etc/profiles/per-user (for chanes to the user + # environment profile) and crawling their share/applications sub-directory when + # changes happen. ./glib-appinfo-watch.patch + ./schema-override-variable.patch # Add support for Pantheon’s terminal emulator. @@ -91,10 +124,6 @@ stdenv.mkDerivation (finalAttrs: { # 3. Tools for desktop environment that cannot go to $bin due to $out depending on them ($out) # * gio-launch-desktop ./split-dev-programs.patch - - # Disable flaky test. - # https://gitlab.gnome.org/GNOME/glib/-/issues/820 - ./skip-timer-test.patch ]; outputs = [ "bin" "out" "dev" "devdoc" ]; @@ -113,48 +142,44 @@ stdenv.mkDerivation (finalAttrs: { util-linuxMinimal # for libmount ] ++ lib.optionals stdenv.isDarwin (with darwin.apple_sdk.frameworks; [ AppKit Carbon Cocoa CoreFoundation CoreServices Foundation - ]) ++ lib.optionals buildDocs [ - # Note: this needs to be both in buildInputs and nativeBuildInputs. The - # Meson gtkdoc module uses find_program to look it up (-> build dep), but - # glib's own Meson configuration uses the host pkg-config to find its - # version (-> host dep). We could technically go and fix this in glib, add - # pkg-config to depsBuildBuild, but this would be a futile exercise since - # Meson's gtkdoc integration does not support cross compilation[1] anyway - # and this derivation disables the docs build when cross compiling. - # - # [1] https://github.com/mesonbuild/meson/issues/2003 - gtk-doc - ]; + ]); strictDeps = true; + depsBuildBuild = [ + pkg-config # required to find native gi-docgen + ]; + nativeBuildInputs = [ + docutils # for rst2man, rst2html5 meson ninja pkg-config perl python3 + python3Packages.packaging # mostly used to make meson happy + python3Packages.wrapPython # for patchPythonScript gettext libxslt - docbook_xsl - ] ++ lib.optionals buildDocs [ - gtk-doc - docbook_xml_dtd_45 - libxml2 + ] ++ lib.optionals withIntrospection [ + gi-docgen + gobject-introspection' + ] ++ lib.optionals (withIntrospection && !stdenv.buildPlatform.canExecute stdenv.hostPlatform) [ + mesonEmulatorHook ]; propagatedBuildInputs = [ zlib libffi gettext libiconv ]; mesonFlags = [ - # Avoid the need for gobject introspection binaries in PATH in cross-compiling case. - # Instead we just copy them over from the native output. - "-Dgtk_doc=${lib.boolToString buildDocs}" + "-Ddocumentation=true" # gvariant specification can be built without gi-docgen "-Dnls=enabled" "-Ddevbindir=${placeholder "dev"}/bin" + (lib.mesonEnable "introspection" withIntrospection) + # FIXME: Fails when linking target glib/tests/libconstructor-helper.so + # relocation R_X86_64_32 against hidden symbol `__TMC_END__' can not be used when making a shared object + "-Dtests=${lib.boolToString (!stdenv.hostPlatform.isStatic)}" ] ++ lib.optionals (!lib.meta.availableOn stdenv.hostPlatform elfutils) [ "-Dlibelf=disabled" - ] ++ lib.optionals (!stdenv.isDarwin) [ - "-Dman=true" # broken on Darwin ] ++ lib.optionals stdenv.isFreeBSD [ "-Db_lundef=false" "-Dxattr=false" @@ -168,14 +193,11 @@ stdenv.mkDerivation (finalAttrs: { ]; postPatch = '' - chmod +x gio/tests/gengiotypefuncs.py - patchShebangs gio/tests/gengiotypefuncs.py - chmod +x docs/reference/gio/concat-files-helper.py - patchShebangs docs/reference/gio/concat-files-helper.py patchShebangs glib/gen-unicode-tables.pl patchShebangs glib/tests/gen-casefold-txt.py patchShebangs glib/tests/gen-casemap-txt.py patchShebangs tools/gen-visibility-macros.py + patchShebangs tests # Needs machine-id, comment the test sed -e '/\/gdbus\/codegen-peer-to-peer/ s/^\/*/\/\//' -i gio/tests/gdbus-peer.c @@ -211,8 +233,11 @@ stdenv.mkDerivation (finalAttrs: { for i in $dev/bin/*; do moveToOutput "share/bash-completion/completions/''${i##*/}" "$dev" done - '' + lib.optionalString (!buildDocs) '' - cp -r ${buildPackages.glib.devdoc} $devdoc + ''; + + preFixup = lib.optionalString (!stdenv.hostPlatform.isStatic) '' + buildPythonPath ${python3Packages.packaging} + patchPythonScript "$dev/share/glib-2.0/codegen/utils.py" ''; # Move man pages to the same output as their binaries (needs to be @@ -222,10 +247,14 @@ stdenv.mkDerivation (finalAttrs: { for i in $dev/bin/*; do moveToOutput "share/man/man1/''${i##*/}.1.*" "$dev" done + + # Cannot be in postInstall, otherwise _multioutDocs hook in preFixup will move right back. + moveToOutput "share/doc" "$devdoc" ''; nativeCheckInputs = [ tzdata desktop-file-utils shared-mime-info ]; + # Conditional necessary to break infinite recursion with passthru.tests preCheck = lib.optionalString finalAttrs.finalPackage.doCheck or config.doCheckByDefault or false '' export LD_LIBRARY_PATH="$NIX_BUILD_TOP/glib-${finalAttrs.version}/glib/.libs''${LD_LIBRARY_PATH:+:}$LD_LIBRARY_PATH" export TZDIR="${tzdata}/share/zoneinfo" @@ -234,8 +263,26 @@ stdenv.mkDerivation (finalAttrs: { export HOME="$TMP" export XDG_DATA_DIRS="${desktop-file-utils}/share:${shared-mime-info}/share" export G_TEST_DBUS_DAEMON="${dbus}/bin/dbus-daemon" - export PATH="$PATH:$(pwd)/gobject" + + # pkg_config_tests expects a PKG_CONFIG_PATH that points to meson-private, wrapped pkg-config + # tries to be clever and picks up the wrong glib at the end. + export PATH="${buildPackages.pkg-config-unwrapped}/bin:$PATH:$(pwd)/gobject" echo "PATH=$PATH" + + # Our gobject-introspection patches make the shared library paths absolute + # in the GIR files. When running tests, the library is not yet installed, + # though, so we need to replace the absolute path with a local one during build. + # We are using a symlink that we will delete before installation. + mkdir -p $out/lib + ln -s $PWD/gobject/libgobject-${librarySuffix} $out/lib/libgobject-${librarySuffix} + ln -s $PWD/gio/libgio-${librarySuffix} $out/lib/libgio-${librarySuffix} + ln -s $PWD/glib/libglib-${librarySuffix} $out/lib/libglib-${librarySuffix} + ''; + + postCheck = '' + rm $out/lib/libgobject-${librarySuffix} + rm $out/lib/libgio-${librarySuffix} + rm $out/lib/libglib-${librarySuffix} ''; separateDebugInfo = stdenv.isLinux; diff --git a/pkgs/development/libraries/glib/elementary-terminal-support.patch b/pkgs/development/libraries/glib/elementary-terminal-support.patch index 34a56c8487aee..5178f9d016cae 100644 --- a/pkgs/development/libraries/glib/elementary-terminal-support.patch +++ b/pkgs/development/libraries/glib/elementary-terminal-support.patch @@ -1,8 +1,8 @@ diff --git a/gio/gdesktopappinfo.c b/gio/gdesktopappinfo.c -index 30fcb2937..a6a7163a7 100644 +index 87db7a97a..bf01fb6b6 100644 --- a/gio/gdesktopappinfo.c +++ b/gio/gdesktopappinfo.c -@@ -2704,6 +2704,7 @@ prepend_terminal_to_vector (int *argc, +@@ -2697,6 +2697,7 @@ prepend_terminal_to_vector (int *argc, { "gnome-terminal", "--" }, { "mate-terminal", "-x" }, { "xfce4-terminal", "-x" }, diff --git a/pkgs/development/libraries/glib/glib-appinfo-watch.patch b/pkgs/development/libraries/glib/glib-appinfo-watch.patch index cbd78a6db4a6f..43641301d3ef6 100644 --- a/pkgs/development/libraries/glib/glib-appinfo-watch.patch +++ b/pkgs/development/libraries/glib/glib-appinfo-watch.patch @@ -1,20 +1,8 @@ -This patch lets GLib's GDesktopAppInfo API watch and notice changes -to the Nix user and system profiles. That way, the list of available -applications shown by the desktop environment is immediately updated -when the user installs or removes any -(see <https://issues.guix.gnu.org/35594>). - -It does so by monitoring /nix/var/nix/profiles (for changes to the system -profile) and /nix/var/nix/profiles/per-user/USER (for changes to the user -profile) as well as /etc/profiles/per-user (for chanes to the user -environment profile) and crawling their share/applications sub-directory when -changes happen. - diff --git a/gio/gdesktopappinfo.c b/gio/gdesktopappinfo.c -index b779b30..31069f7 100644 +index 87db7a97a..2e1689ed7 100644 --- a/gio/gdesktopappinfo.c +++ b/gio/gdesktopappinfo.c -@@ -150,6 +150,7 @@ typedef struct +@@ -147,6 +147,7 @@ typedef struct gchar *alternatively_watching; gboolean is_config; gboolean is_setup; @@ -22,7 +10,7 @@ index b779b30..31069f7 100644 GFileMonitor *monitor; GHashTable *app_names; GHashTable *mime_tweaks; -@@ -181,6 +182,7 @@ desktop_file_dir_unref (DesktopFileDir *dir) +@@ -179,6 +180,7 @@ desktop_file_dir_unref (DesktopFileDir *dir) { desktop_file_dir_reset (dir); g_free (dir->path); @@ -30,7 +18,7 @@ index b779b30..31069f7 100644 g_free (dir); } } -@@ -205,6 +207,14 @@ desktop_file_dir_get_alternative_dir (DesktopFileDir *dir) +@@ -203,6 +205,14 @@ desktop_file_dir_get_alternative_dir (DesktopFileDir *dir) { gchar *parent; @@ -45,7 +33,7 @@ index b779b30..31069f7 100644 /* If the directory itself exists then we need no alternative. */ if (g_access (dir->path, R_OK | X_OK) == 0) return NULL; -@@ -250,11 +260,11 @@ desktop_file_dir_changed (GFileMonitor *monitor, +@@ -248,11 +258,11 @@ desktop_file_dir_changed (GFileMonitor *monitor, * * If this is a notification for a parent directory (because the * desktop directory didn't exist) then we shouldn't fire the signal @@ -59,7 +47,7 @@ index b779b30..31069f7 100644 { gchar *alternative_dir; -@@ -1556,6 +1566,40 @@ desktop_file_dirs_lock (void) +@@ -1650,6 +1660,40 @@ desktop_file_dirs_lock (void) for (i = 0; dirs[i]; i++) g_ptr_array_add (desktop_file_dirs, desktop_file_dir_new (dirs[i])); @@ -84,7 +72,7 @@ index b779b30..31069f7 100644 + user_data_dir = g_build_filename (profile_dir, "profile", "share", NULL); + user_profile_dir = desktop_file_dir_new (user_data_dir); + user_profile_dir->nix_profile_watch_dir = profile_dir; -+ ++ + env_dir = g_build_filename ("/etc/profiles/per-user", NULL); + env_data_dir = g_build_filename (env_dir, user, "share", NULL); + user_env_dir = desktop_file_dir_new (env_data_dir); diff --git a/pkgs/development/libraries/glib/schema-override-variable.patch b/pkgs/development/libraries/glib/schema-override-variable.patch index f98af04a7f245..84d3e93730a59 100644 --- a/pkgs/development/libraries/glib/schema-override-variable.patch +++ b/pkgs/development/libraries/glib/schema-override-variable.patch @@ -1,8 +1,8 @@ diff --git a/gio/gsettingsschema.c b/gio/gsettingsschema.c -index 1282c10a1..feadfe3aa 100644 +index b1918657d..504ff97c4 100644 --- a/gio/gsettingsschema.c +++ b/gio/gsettingsschema.c -@@ -360,6 +360,9 @@ initialise_schema_sources (void) +@@ -356,6 +356,9 @@ initialise_schema_sources (void) try_prepend_data_dir (g_get_user_data_dir ()); diff --git a/pkgs/development/libraries/glib/skip-timer-test.patch b/pkgs/development/libraries/glib/skip-timer-test.patch deleted file mode 100644 index 942f3e7864c4f..0000000000000 --- a/pkgs/development/libraries/glib/skip-timer-test.patch +++ /dev/null @@ -1,17 +0,0 @@ -Description: Skip test which performs some unreliable floating point comparisons -Forwarded: https://bugzilla.gnome.org/show_bug.cgi?id=722604 - -Index: b/glib/tests/timer.c -=================================================================== ---- a/glib/tests/timer.c -+++ b/glib/tests/timer.c -@@ -203,7 +203,7 @@ - { - g_test_init (&argc, &argv, NULL); - -- g_test_add_func ("/timer/basic", test_timer_basic); -+/* g_test_add_func ("/timer/basic", test_timer_basic);*/ -- g_test_add_func ("/timer/stop", test_timer_stop); -+/* g_test_add_func ("/timer/stop", test_timer_stop);*/ - g_test_add_func ("/timer/continue", test_timer_continue); - g_test_add_func ("/timer/reset", test_timer_reset); diff --git a/pkgs/development/libraries/glib/split-dev-programs.patch b/pkgs/development/libraries/glib/split-dev-programs.patch index 0333c5c9ca295..b32fccb8379f4 100644 --- a/pkgs/development/libraries/glib/split-dev-programs.patch +++ b/pkgs/development/libraries/glib/split-dev-programs.patch @@ -1,5 +1,5 @@ diff --git a/gio/gdbus-2.0/codegen/meson.build b/gio/gdbus-2.0/codegen/meson.build -index 65faae9b2..4297513d4 100644 +index 6d19cd4ba..0205e5074 100644 --- a/gio/gdbus-2.0/codegen/meson.build +++ b/gio/gdbus-2.0/codegen/meson.build @@ -20,7 +20,7 @@ gdbus_codegen_conf.set('DATADIR', glib_datadir) @@ -12,13 +12,13 @@ index 65faae9b2..4297513d4 100644 configuration : gdbus_codegen_conf ) diff --git a/gio/meson.build b/gio/meson.build -index 75686bb3e..2f1a73482 100644 +index 59c2b0fc0..87cbb8229 100644 --- a/gio/meson.build +++ b/gio/meson.build -@@ -882,14 +882,15 @@ pkg.generate(libgio, +@@ -885,14 +885,15 @@ pkg.generate(libgio, + variables : [ 'schemasdir=' + '${datadir}' / schemas_subdir, 'dtdsdir=' + '${datadir}' / dtds_subdir, - 'bindir=' + '${prefix}' / get_option('bindir'), + 'devbindir=' + get_option('devbindir'), 'giomoduledir=' + pkgconfig_giomodulesdir, 'gio=' + '${bindir}' / 'gio', @@ -36,7 +36,7 @@ index 75686bb3e..2f1a73482 100644 'gsettings=' + '${bindir}' / 'gsettings', ], version : glib_version, -@@ -992,6 +993,7 @@ executable('gio', gio_tool_sources, +@@ -995,6 +996,7 @@ gio_tool = executable('gio', gio_tool_sources, executable('gresource', 'gresource-tool.c', install : true, @@ -44,7 +44,7 @@ index 75686bb3e..2f1a73482 100644 install_tag : 'bin', # intl.lib is not compatible with SAFESEH link_args : noseh_link_args, -@@ -999,7 +1001,7 @@ executable('gresource', 'gresource-tool.c', +@@ -1002,7 +1004,7 @@ executable('gresource', 'gresource-tool.c', gio_querymodules = executable('gio-querymodules', 'gio-querymodules.c', 'giomodule-priv.c', install : true, @@ -53,7 +53,7 @@ index 75686bb3e..2f1a73482 100644 install_tag : 'bin', c_args : gio_c_args, # intl.lib is not compatible with SAFESEH -@@ -1009,7 +1011,7 @@ gio_querymodules = executable('gio-querymodules', 'gio-querymodules.c', 'giomodu +@@ -1012,7 +1014,7 @@ gio_querymodules = executable('gio-querymodules', 'gio-querymodules.c', 'giomodu glib_compile_schemas = executable('glib-compile-schemas', ['glib-compile-schemas.c'], install : true, @@ -62,7 +62,7 @@ index 75686bb3e..2f1a73482 100644 install_tag : 'bin', # intl.lib is not compatible with SAFESEH link_args : noseh_link_args, -@@ -1018,6 +1020,7 @@ glib_compile_schemas = executable('glib-compile-schemas', +@@ -1021,6 +1023,7 @@ glib_compile_schemas = executable('glib-compile-schemas', glib_compile_resources = executable('glib-compile-resources', [gconstructor_as_data_h, 'glib-compile-resources.c'], install : true, @@ -71,10 +71,10 @@ index 75686bb3e..2f1a73482 100644 c_args : gio_c_args, # intl.lib is not compatible with SAFESEH diff --git a/gio/tests/meson.build b/gio/tests/meson.build -index 4ef3343ab..2a0a6b56b 100644 +index 232ecca5e..e292927ac 100644 --- a/gio/tests/meson.build +++ b/gio/tests/meson.build -@@ -1131,16 +1131,18 @@ if have_bash and have_pkg_config +@@ -1182,16 +1182,18 @@ if have_bash and have_pkg_config gio_binaries = [ 'gio', @@ -97,7 +97,7 @@ index 4ef3343ab..2a0a6b56b 100644 foreach binary: gio_binaries pkg_config_tests += [ -@@ -1149,6 +1151,13 @@ if have_bash and have_pkg_config +@@ -1200,6 +1202,13 @@ if have_bash and have_pkg_config prefix / get_option('bindir') / binary) ] endforeach @@ -112,13 +112,13 @@ index 4ef3343ab..2a0a6b56b 100644 foreach binary: gio_multiarch_binaries pkg_config_tests += [ diff --git a/glib/meson.build b/glib/meson.build -index c26a35e42..38effe12a 100644 +index d2efebadc..eb9fa5b2f 100644 --- a/glib/meson.build +++ b/glib/meson.build @@ -447,9 +447,10 @@ pkg.generate(libglib, + subdirs : ['glib-2.0'], + extra_cflags : ['-I${libdir}/glib-2.0/include'] + win32_cflags, variables : [ - 'bindir=' + '${prefix}' / get_option('bindir'), - 'datadir=' + '${prefix}' / get_option('datadir'), - 'glib_genmarshal=' + '${bindir}' / 'glib-genmarshal', - 'gobject_query=' + '${bindir}' / 'gobject-query', - 'glib_mkenums=' + '${bindir}' / 'glib-mkenums', @@ -147,10 +147,10 @@ index c26a35e42..38effe12a 100644 configuration: report_conf, install_mode: 'rwxr-xr-x' diff --git a/glib/tests/meson.build b/glib/tests/meson.build -index 09ecd5ab3..9748d4122 100644 +index f6efc593a..5522dcb96 100644 --- a/glib/tests/meson.build +++ b/glib/tests/meson.build -@@ -508,9 +508,9 @@ if have_bash and have_pkg_config +@@ -568,9 +568,9 @@ if have_bash and have_pkg_config 'test "$(pkg-config --variable=datadir glib-2.0)" = "@0@"'.format( prefix / get_option('datadir')), 'test "$(pkg-config --variable=gobject_query glib-2.0)" = "@0@"'.format( @@ -184,7 +184,7 @@ index 2129aaf8a..da8462428 100644 dependencies : [libglib_dep, libgobject_dep]) diff --git a/meson_options.txt b/meson_options.txt -index 517d5757c..198cc1b3c 100644 +index 69a2135bc..cfe14bb09 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -4,6 +4,11 @@ option('runtime_libdir', |