From 6ccd956fd4e8dd81ebf7ed4a4d0515f276668aa0 Mon Sep 17 00:00:00 2001 From: Guillaume Girol Date: Sat, 11 May 2024 12:00:00 +0000 Subject: [PATCH] glib: fix installing gdb scripts the disk space cost is less than 20Kb They provide pretty printers for datascructures likes hash tables in gdb. To check that the scripts are loaded: run gdb on any glib application (for example gio from the bin output) run info auto-load python-scripts observe scripts whose filename is libglib-...-gdb.py --- pkgs/development/libraries/glib/default.nix | 7 ++++++ .../libraries/glib/gdb_script.patch | 23 +++++++++++++++++++ 2 files changed, 30 insertions(+) create mode 100644 pkgs/development/libraries/glib/gdb_script.patch diff --git a/pkgs/development/libraries/glib/default.nix b/pkgs/development/libraries/glib/default.nix index d5202e113764..dedafafd1c50 100644 --- a/pkgs/development/libraries/glib/default.nix +++ b/pkgs/development/libraries/glib/default.nix @@ -111,6 +111,12 @@ 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 + + # Tell Meson to install gdb scripts next to the lib + # GDB only looks there and in ${gdb}/share/gdb/auto-load, + # and by default meson installs in to $out/share/gdb/auto-load + # which does not help + ./gdb_script.patch ]; outputs = [ "bin" "out" "dev" "devdoc" ]; @@ -208,6 +214,7 @@ stdenv.mkDerivation (finalAttrs: { postInstall = '' moveToOutput "share/glib-2.0" "$dev" + moveToOutput "share/glib-2.0/gdb" "$out" substituteInPlace "$dev/bin/gdbus-codegen" --replace "$out" "$dev" sed -i "$dev/bin/glib-gettextize" -e "s|^gettext_dir=.*|gettext_dir=$dev/share/glib-2.0/gettext|" diff --git a/pkgs/development/libraries/glib/gdb_script.patch b/pkgs/development/libraries/glib/gdb_script.patch new file mode 100644 index 000000000000..c1e5d22e085b --- /dev/null +++ b/pkgs/development/libraries/glib/gdb_script.patch @@ -0,0 +1,23 @@ +diff --git a/glib/meson.build b/glib/meson.build +index b2dd569e1..b013991a1 100644 +--- a/glib/meson.build ++++ b/glib/meson.build +@@ -541,7 +540,7 @@ configure_file( + input: 'libglib-gdb.py.in', + output: 'libglib-2.0.so.@0@-gdb.py'.format(library_version), + configuration: gdb_conf, +- install_dir: gdb_install_dir, ++ install_dir: glib_libdir, + install_tag: 'devel', + install: gdb_install, + ) +diff --git a/gobject/meson.build b/gobject/meson.build +@@ -185,7 +184,7 @@ configure_file( + input: 'libgobject-gdb.py.in', + output: 'libgobject-2.0.so.@0@-gdb.py'.format(library_version), + configuration: gdb_conf, +- install_dir: gdb_install_dir, ++ install_dir: glib_libdir, + install_tag: 'devel', + install: gdb_install, + )