about summary refs log tree commit diff
path: root/pkgs/development/libraries/glib/default.nix
diff options
context:
space:
mode:
Diffstat (limited to 'pkgs/development/libraries/glib/default.nix')
-rw-r--r--pkgs/development/libraries/glib/default.nix60
1 files changed, 28 insertions, 32 deletions
diff --git a/pkgs/development/libraries/glib/default.nix b/pkgs/development/libraries/glib/default.nix
index 22df229d47cc..d12b1be1b5b4 100644
--- a/pkgs/development/libraries/glib/default.nix
+++ b/pkgs/development/libraries/glib/default.nix
@@ -2,7 +2,6 @@
 , lib
 , stdenv
 , fetchurl
-, fetchpatch
 , gettext
 , meson
 , ninja
@@ -23,6 +22,8 @@
 , makeHardcodeGsettingsPatch
 , testers
 , gobject-introspection
+, libsystemtap
+, libsysprof-capture
 , mesonEmulatorHook
 , withIntrospection ?
   stdenv.hostPlatform.emulatorAvailable buildPackages &&
@@ -30,22 +31,9 @@
   stdenv.hostPlatform.isLittleEndian == stdenv.buildPlatform.isLittleEndian
 }:
 
-assert stdenv.isLinux -> util-linuxMinimal != null;
+assert stdenv.hostPlatform.isLinux -> util-linuxMinimal != null;
 
 let
-  # Some packages don't get "Cflags" from pkg-config correctly
-  # and then fail to build when directly including like <glib/...>.
-  # This is intended to be run in postInstall of any package
-  # which has $out/include/ containing just some disjunct directories.
-  flattenInclude = ''
-    for dir in "''${!outputInclude}"/include/*; do
-      cp -r "$dir"/* "''${!outputInclude}/include/"
-      rm -r "$dir"
-      ln -s . "$dir"
-    done
-    ln -sr -t "''${!outputInclude}/include/" "''${!outputInclude}"/lib/*/include/* 2>/dev/null || true
-  '';
-
   gobject-introspection' = buildPackages.gobject-introspection.override {
     propagateFullGlib = false;
     # Avoid introducing cairo, which enables gobjectSupport by default.
@@ -57,24 +45,25 @@ let
                   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";
+
+  systemtap' = buildPackages.linuxPackages.systemtap.override { withStap = false; };
+  withDtrace =
+    lib.meta.availableOn stdenv.buildPlatform systemtap' &&
+    # dtrace support requires sys/sdt.h header
+    lib.meta.availableOn stdenv.hostPlatform libsystemtap;
 in
 
 stdenv.mkDerivation (finalAttrs: {
   pname = "glib";
-  version = "2.80.4";
+  version = "2.82.1";
 
   src = fetchurl {
     url = "mirror://gnome/sources/glib/${lib.versions.majorMinor finalAttrs.version}/glib-${finalAttrs.version}.tar.xz";
-    hash = "sha256-JOApxd/JtE5Fc2l63zMHipgnxIk4VVAEs7kJb6TqA08=";
+    hash = "sha256-R4Y0RAv1LuTsRCjVWHhzmMC+awQ8UhvrMIM0s9tEiaY=";
   };
 
-  patches = lib.optionals stdenv.isDarwin [
+  patches = lib.optionals stdenv.hostPlatform.isDarwin [
     ./darwin-compilation.patch
-    # FIXME: remove when https://gitlab.gnome.org/GNOME/glib/-/merge_requests/4088 is merged and is in the tagged release
-    (fetchpatch {
-      url = "https://gitlab.gnome.org/GNOME/glib/-/commit/9d0988ca62ee96e09aa76abbd65ff192cfce6858.patch";
-      hash = "sha256-JrR3Ba6L+3M0Nt8DgHmPG8uKtx7hOgUp7np08ATIzjA=";
-    })
   ] ++ lib.optionals stdenv.hostPlatform.isMusl [
     ./quark_init_on_demand.patch
     ./gobject_init_on_demand.patch
@@ -99,9 +88,12 @@ stdenv.mkDerivation (finalAttrs: {
 
     # GLib contains many binaries used for different purposes;
     # we will install them to different outputs:
-    # 1. Tools for desktop environment ($bin)
+    # 1. Tools for desktop environment and introspection ($bin)
     #    * gapplication (non-darwin)
     #    * gdbus
+    #    * gi-compile-repository
+    #    * gi-decompile-typelib
+    #    * gi-inspect-typelib
     #    * gio
     #    * gio-launch-desktop (symlink to $out)
     #    * gsettings
@@ -126,9 +118,6 @@ stdenv.mkDerivation (finalAttrs: {
     # and by default meson installs in to $out/share/gdb/auto-load
     # which does not help
     ./gdb_script.patch
-
-    # glib assumes that `RTLD_LOCAL` is defined to `0`, which is true on Linux and FreeBSD but not on Darwin.
-    ./gmodule-rtld_local.patch
   ];
 
   outputs = [ "bin" "out" "dev" "devdoc" ];
@@ -137,15 +126,18 @@ stdenv.mkDerivation (finalAttrs: {
 
   buildInputs = [
     finalAttrs.setupHook
+    libsysprof-capture
     pcre2
   ] ++ lib.optionals (!stdenv.hostPlatform.isWindows) [
     bash gnum4 # install glib-gettextize and m4 macros for other apps to use
   ] ++ lib.optionals (lib.meta.availableOn stdenv.hostPlatform elfutils) [
     elfutils
-  ] ++ lib.optionals stdenv.isLinux [
+  ] ++ lib.optionals withDtrace [
+    libsystemtap
+  ] ++ lib.optionals stdenv.hostPlatform.isLinux [
     libselinux
     util-linuxMinimal # for libmount
-  ] ++ lib.optionals stdenv.isDarwin (with darwin.apple_sdk.frameworks; [
+  ] ++ lib.optionals stdenv.hostPlatform.isDarwin (with darwin.apple_sdk.frameworks; [
     AppKit Carbon Cocoa CoreFoundation CoreServices Foundation
   ]);
 
@@ -171,12 +163,17 @@ stdenv.mkDerivation (finalAttrs: {
     gobject-introspection'
   ] ++ lib.optionals (withIntrospection && !stdenv.buildPlatform.canExecute stdenv.hostPlatform) [
     mesonEmulatorHook
+  ] ++ lib.optionals withDtrace [
+    systemtap' # for dtrace
   ];
 
   propagatedBuildInputs = [ zlib libffi gettext libiconv ];
 
   mesonFlags = [
+    "-Dglib_debug=disabled" # https://gitlab.gnome.org/GNOME/glib/-/issues/3421#note_2206315
     "-Ddocumentation=true" # gvariant specification can be built without gi-docgen
+    (lib.mesonEnable "dtrace" withDtrace)
+    (lib.mesonEnable "systemtap" withDtrace) # requires dtrace option to be enabled
     "-Dnls=enabled"
     "-Ddevbindir=${placeholder "dev"}/bin"
     (lib.mesonEnable "introspection" withIntrospection)
@@ -185,7 +182,7 @@ stdenv.mkDerivation (finalAttrs: {
     "-Dtests=${lib.boolToString (!stdenv.hostPlatform.isStatic)}"
   ] ++ lib.optionals (!lib.meta.availableOn stdenv.hostPlatform elfutils) [
     "-Dlibelf=disabled"
-  ] ++ lib.optionals stdenv.isFreeBSD [
+  ] ++ lib.optionals stdenv.hostPlatform.isFreeBSD [
     "-Db_lundef=false"
     "-Dxattr=false"
   ];
@@ -291,7 +288,7 @@ stdenv.mkDerivation (finalAttrs: {
     rm $out/lib/libglib-${librarySuffix}
   '';
 
-  separateDebugInfo = stdenv.isLinux;
+  separateDebugInfo = stdenv.hostPlatform.isLinux;
 
   passthru = rec {
     gioModuleDir = "lib/gio/modules";
@@ -306,7 +303,6 @@ stdenv.mkDerivation (finalAttrs: {
       pkg-config = testers.testMetaPkgConfig finalAttrs.finalPackage;
     };
 
-    inherit flattenInclude;
     updateScript = gnome.updateScript {
       packageName = "glib";
       versionPolicy = "odd-unstable";