diff options
Diffstat (limited to 'nixpkgs/pkgs/development/libraries/glib')
10 files changed, 772 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/development/libraries/glib/darwin-compilation.patch b/nixpkgs/pkgs/development/libraries/glib/darwin-compilation.patch new file mode 100644 index 000000000000..f215eef798af --- /dev/null +++ b/nixpkgs/pkgs/development/libraries/glib/darwin-compilation.patch @@ -0,0 +1,24 @@ +Fix compilation on Mac OS X with gcc 4.8. + +diff -ru glib-2.40.0-orig/gio/gdummyfile.c glib-2.40.0/gio/gdummyfile.c +--- glib-2.40.0-orig/gio/gdummyfile.c 2014-02-03 18:40:41.000000000 +0100 ++++ glib-2.40.0/gio/gdummyfile.c 2014-07-15 10:58:31.000000000 +0200 +@@ -454,7 +454,8 @@ + result = g_malloc (escaped_string_end - escaped_string + 1); + + out = result; +- for (in = escaped_string; in < escaped_string_end; in++) ++ in = escaped_string; ++ for (; in < escaped_string_end; in++) + { + character = *in; + if (*in == '%') +@@ -551,6 +552,7 @@ + + decoded->scheme = g_malloc (p - uri); + out = decoded->scheme; +- for (in = uri; in < p - 1; in++) ++ in = uri; ++ for (; in < p - 1; in++) + *out++ = g_ascii_tolower (*in); + *out = 0; diff --git a/nixpkgs/pkgs/development/libraries/glib/default.nix b/nixpkgs/pkgs/development/libraries/glib/default.nix new file mode 100644 index 000000000000..a2e4ad8f47cf --- /dev/null +++ b/nixpkgs/pkgs/development/libraries/glib/default.nix @@ -0,0 +1,292 @@ +{ config +, lib +, stdenv +, fetchurl +, gettext +, meson +, ninja +, pkg-config +, perl +, python3 +, libiconv, zlib, libffi, pcre2, libelf, gnome, libselinux, bash, gnum4, gtk-doc, docbook_xsl, docbook_xml_dtd_45, libxslt +# 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 +, desktop-file-utils, shared-mime-info +, darwin +, makeHardcodeGsettingsPatch +, testers +}: + +assert stdenv.isLinux -> util-linuxMinimal != null; + +/* + * TODO: + * Use --enable-installed-tests for GNOME-related packages, + and use them as a separately installed tests run by Hydra + (they should test an already installed package) + https://wiki.gnome.org/Initiatives/GnomeGoals/InstalledTests + * Support org.freedesktop.Application, including D-Bus activation from desktop files +*/ +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 + ''; + + buildDocs = stdenv.hostPlatform == stdenv.buildPlatform && !stdenv.hostPlatform.isStatic; +in + +stdenv.mkDerivation (finalAttrs: { + pname = "glib"; + version = "2.78.1"; + + src = fetchurl { + url = "mirror://gnome/sources/glib/${lib.versions.majorMinor finalAttrs.version}/glib-${finalAttrs.version}.tar.xz"; + sha256 = "kVvD0PhQfWUOrTgy4vj7Zw/OWarE13VKfatvHm/teLI="; + }; + + patches = lib.optionals stdenv.isDarwin [ + ./darwin-compilation.patch + ] ++ lib.optionals stdenv.hostPlatform.isMusl [ + ./quark_init_on_demand.patch + ./gobject_init_on_demand.patch + ] ++ [ + ./glib-appinfo-watch.patch + ./schema-override-variable.patch + + # Add support for Pantheon’s terminal emulator. + ./elementary-terminal-support.patch + + # GLib contains many binaries used for different purposes; + # we will install them to different outputs: + # 1. Tools for desktop environment ($bin) + # * gapplication (non-darwin) + # * gdbus + # * gio + # * gio-launch-desktop (symlink to $out) + # * gsettings + # 2. Development/build tools ($dev) + # * gdbus-codegen + # * gio-querymodules + # * glib-compile-resources + # * glib-compile-schemas + # * glib-genmarshal + # * glib-gettextize + # * glib-mkenums + # * gobject-query + # * gresource + # * gtester + # * gtester-report + # 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" ]; + + setupHook = ./setup-hook.sh; + + buildInputs = [ + libelf + finalAttrs.setupHook + pcre2 + ] ++ lib.optionals (!stdenv.hostPlatform.isWindows) [ + bash gnum4 # install glib-gettextize and m4 macros for other apps to use + ] ++ lib.optionals stdenv.isLinux [ + libselinux + 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; + + nativeBuildInputs = [ + meson + ninja + pkg-config + perl + python3 + gettext + libxslt + docbook_xsl + ] ++ lib.optionals buildDocs [ + gtk-doc + docbook_xml_dtd_45 + libxml2 + ]; + + 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}" + "-Dnls=enabled" + "-Ddevbindir=${placeholder "dev"}/bin" + ] ++ lib.optionals (!stdenv.isDarwin) [ + "-Dman=true" # broken on Darwin + ] ++ lib.optionals stdenv.isFreeBSD [ + "-Db_lundef=false" + "-Dxattr=false" + ]; + + env.NIX_CFLAGS_COMPILE = toString [ + "-Wno-error=nonnull" + # Default for release buildtype but passed manually because + # we're using plain + "-DG_DISABLE_CAST_CHECKS" + ]; + + 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 + + # Needs machine-id, comment the test + sed -e '/\/gdbus\/codegen-peer-to-peer/ s/^\/*/\/\//' -i gio/tests/gdbus-peer.c + sed -e '/g_test_add_func/ s/^\/*/\/\//' -i gio/tests/gdbus-address-get-session.c + # All gschemas fail to pass the test, upstream bug? + sed -e '/g_test_add_data_func/ s/^\/*/\/\//' -i gio/tests/gschema-compile.c + # Cannot reproduce the failing test_associations on hydra + sed -e '/\/appinfo\/associations/d' -i gio/tests/appinfo.c + # Needed because of libtool wrappers + sed -e '/g_subprocess_launcher_set_environ (launcher, envp);/a g_subprocess_launcher_setenv (launcher, "PATH", g_getenv("PATH"), TRUE);' -i gio/tests/gsubprocess.c + '' + lib.optionalString stdenv.hostPlatform.isWindows '' + substituteInPlace gio/win32/meson.build \ + --replace "libintl, " "" + ''; + + postConfigure = '' + patchShebangs gio/gdbus-2.0/codegen/gdbus-codegen gobject/glib-{genmarshal,mkenums} + ''; + + DETERMINISTIC_BUILD = 1; + + postInstall = '' + moveToOutput "share/glib-2.0" "$dev" + 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|" + + # This file is *included* in gtk3 and would introduce runtime reference via __FILE__. + sed '1i#line 1 "glib-${finalAttrs.version}/include/glib-2.0/gobject/gobjectnotifyqueue.c"' \ + -i "$dev"/include/glib-2.0/gobject/gobjectnotifyqueue.c + for i in $bin/bin/*; do + moveToOutput "share/bash-completion/completions/''${i##*/}" "$bin" + done + for i in $dev/bin/*; do + moveToOutput "share/bash-completion/completions/''${i##*/}" "$dev" + done + '' + lib.optionalString (!buildDocs) '' + cp -r ${buildPackages.glib.devdoc} $devdoc + ''; + + # Move man pages to the same output as their binaries (needs to be + # done after preFixupHooks which moves man pages too - in + # _multioutDocs) + postFixup = '' + for i in $dev/bin/*; do + moveToOutput "share/man/man1/''${i##*/}.1.*" "$dev" + done + ''; + + nativeCheckInputs = [ tzdata desktop-file-utils shared-mime-info ]; + + 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" + export XDG_CACHE_HOME="$TMP" + export XDG_RUNTIME_HOME="$TMP" + 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" + echo "PATH=$PATH" + ''; + + separateDebugInfo = stdenv.isLinux; + + passthru = rec { + gioModuleDir = "lib/gio/modules"; + + makeSchemaDataDirPath = dir: name: "${dir}/share/gsettings-schemas/${name}"; + makeSchemaPath = dir: name: "${makeSchemaDataDirPath dir name}/glib-2.0/schemas"; + getSchemaPath = pkg: makeSchemaPath pkg pkg.name; + getSchemaDataDirPath = pkg: makeSchemaDataDirPath pkg pkg.name; + + tests = { + withChecks = finalAttrs.finalPackage.overrideAttrs (_: { doCheck = true; }); + pkg-config = testers.testMetaPkgConfig finalAttrs.finalPackage; + }; + + inherit flattenInclude; + updateScript = gnome.updateScript { + packageName = "glib"; + versionPolicy = "odd-unstable"; + }; + + mkHardcodeGsettingsPatch = + { + src, + glib-schema-to-var, + }: + builtins.trace + "glib.mkHardcodeGsettingsPatch is deprecated, please use makeHardcodeGsettingsPatch instead" + (makeHardcodeGsettingsPatch { + inherit src; + schemaIdToVariableMapping = glib-schema-to-var; + }); + }; + + meta = with lib; { + description = "C library of programming buildings blocks"; + homepage = "https://wiki.gnome.org/Projects/GLib"; + license = licenses.lgpl21Plus; + maintainers = teams.gnome.members ++ (with maintainers; [ lovek323 raskin ]); + pkgConfigModules = [ + "gio-2.0" + "gobject-2.0" + "gthread-2.0" + ]; + platforms = platforms.unix; + + longDescription = '' + GLib provides the core application building blocks for libraries + and applications written in C. It provides the core object + system used in GNOME, the main loop implementation, and a large + set of utility functions for strings and common data structures. + ''; + }; +}) diff --git a/nixpkgs/pkgs/development/libraries/glib/elementary-terminal-support.patch b/nixpkgs/pkgs/development/libraries/glib/elementary-terminal-support.patch new file mode 100644 index 000000000000..34a56c8487ae --- /dev/null +++ b/nixpkgs/pkgs/development/libraries/glib/elementary-terminal-support.patch @@ -0,0 +1,12 @@ +diff --git a/gio/gdesktopappinfo.c b/gio/gdesktopappinfo.c +index 30fcb2937..a6a7163a7 100644 +--- a/gio/gdesktopappinfo.c ++++ b/gio/gdesktopappinfo.c +@@ -2704,6 +2704,7 @@ prepend_terminal_to_vector (int *argc, + { "gnome-terminal", "--" }, + { "mate-terminal", "-x" }, + { "xfce4-terminal", "-x" }, ++ { "io.elementary.terminal", "-x" }, + { "tilix", "-e" }, + { "konsole", "-e" }, + { "nxterm", "-e" }, diff --git a/nixpkgs/pkgs/development/libraries/glib/glib-appinfo-watch.patch b/nixpkgs/pkgs/development/libraries/glib/glib-appinfo-watch.patch new file mode 100644 index 000000000000..cbd78a6db4a6 --- /dev/null +++ b/nixpkgs/pkgs/development/libraries/glib/glib-appinfo-watch.patch @@ -0,0 +1,102 @@ +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 +--- a/gio/gdesktopappinfo.c ++++ b/gio/gdesktopappinfo.c +@@ -150,6 +150,7 @@ typedef struct + gchar *alternatively_watching; + gboolean is_config; + gboolean is_setup; ++ gchar *nix_profile_watch_dir; + GFileMonitor *monitor; + GHashTable *app_names; + GHashTable *mime_tweaks; +@@ -181,6 +182,7 @@ desktop_file_dir_unref (DesktopFileDir *dir) + { + desktop_file_dir_reset (dir); + g_free (dir->path); ++ g_free (dir->nix_profile_watch_dir); + g_free (dir); + } + } +@@ -205,6 +207,14 @@ desktop_file_dir_get_alternative_dir (DesktopFileDir *dir) + { + gchar *parent; + ++ /* If DIR is a profile, watch the specified directory--e.g., ++ * /nix/var/nix/profiles/per-user/$USER/ for the user profile. Do not watch ++ * ~/.nix-profile or /run/current-system/sw because GFileMonitor does ++ * not pass IN_DONT_FOLLOW and thus cannot notice any change. ++ * /etc/profiles/per-user is monitored directly for the same reason. */ ++ if (dir->nix_profile_watch_dir != NULL) ++ return g_strdup (dir->nix_profile_watch_dir); ++ + /* 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, + * + * If this is a notification for a parent directory (because the + * desktop directory didn't exist) then we shouldn't fire the signal +- * unless something actually changed. ++ * unless something actually changed or it's part of a Nix profile. + */ + g_mutex_lock (&desktop_file_dir_lock); + +- if (dir->alternatively_watching) ++ if (dir->alternatively_watching && dir->nix_profile_watch_dir == NULL) + { + gchar *alternative_dir; + +@@ -1556,6 +1566,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])); + ++ { ++ /* Monitor the system and user profile under /nix/var/nix/profiles and ++ * treat modifications to them as if they were modifications to their ++ * /share sub-directory. */ ++ const gchar *user; ++ DesktopFileDir *system_profile_dir, *user_profile_dir, *user_env_dir; ++ ++ system_profile_dir = ++ desktop_file_dir_new ("/nix/var/nix/profiles/system/sw/share"); ++ system_profile_dir->nix_profile_watch_dir = g_strdup ("/nix/var/nix/profiles"); ++ g_ptr_array_add (desktop_file_dirs, desktop_file_dir_ref (system_profile_dir)); ++ ++ user = g_get_user_name (); ++ if (user != NULL) ++ { ++ gchar *profile_dir, *user_data_dir, *env_dir, *env_data_dir; ++ ++ profile_dir = g_build_filename ("/nix/var/nix/profiles/per-user", user, NULL); ++ 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); ++ user_env_dir->nix_profile_watch_dir = env_dir; ++ ++ g_ptr_array_add (desktop_file_dirs, desktop_file_dir_ref (user_profile_dir)); ++ g_ptr_array_add (desktop_file_dirs, desktop_file_dir_ref (user_env_dir)); ++ g_free (user_data_dir); ++ g_free (env_data_dir); ++ } ++ } ++ + /* The list of directories will never change after this, unless + * g_get_user_config_dir() changes due to %G_TEST_OPTION_ISOLATE_DIRS. */ + desktop_file_dirs_config_dir = user_config_dir; diff --git a/nixpkgs/pkgs/development/libraries/glib/gobject_init_on_demand.patch b/nixpkgs/pkgs/development/libraries/glib/gobject_init_on_demand.patch new file mode 100644 index 000000000000..d72d0b61dca2 --- /dev/null +++ b/nixpkgs/pkgs/development/libraries/glib/gobject_init_on_demand.patch @@ -0,0 +1,87 @@ +--- glib-source/gobject/gtype.c 2016-08-17 17:20:47.000000000 +0200 ++++ glib-source/gobject/gtype.c 2016-09-01 21:56:31.777406646 +0200 +@@ -209,6 +209,9 @@ + static gboolean type_node_is_a_L (TypeNode *node, + TypeNode *iface_node); + ++#if !defined(__GLIBC__) ++static void gobject_init (void); ++#endif + + /* --- enumeration --- */ + +@@ -2631,7 +2634,10 @@ + GTypeFlags flags) + { + TypeNode *node; +- ++ ++#if !defined(__GLIBC__) ++ gobject_init(); ++#endif + g_assert_type_system_initialized (); + g_return_val_if_fail (type_id > 0, 0); + g_return_val_if_fail (type_name != NULL, 0); +@@ -2749,6 +2755,9 @@ + TypeNode *pnode, *node; + GType type = 0; + ++#if !defined(__GLIBC__) ++ gobject_init(); ++#endif + g_assert_type_system_initialized (); + g_return_val_if_fail (parent_type > 0, 0); + g_return_val_if_fail (type_name != NULL, 0); +@@ -2804,6 +2813,9 @@ + TypeNode *pnode, *node; + GType type; + ++#if !defined(__GLIBC__) ++ gobject_init(); ++#endif + g_assert_type_system_initialized (); + g_return_val_if_fail (parent_type > 0, 0); + g_return_val_if_fail (type_name != NULL, 0); +@@ -3319,6 +3331,9 @@ + { + TypeNode *node; + ++#if !defined(__GLIBC__) ++ gobject_init(); ++#endif + g_assert_type_system_initialized (); + + node = lookup_type_node_I (type); +@@ -4343,6 +4358,9 @@ + void + g_type_init_with_debug_flags (GTypeDebugFlags debug_flags) + { ++#if !defined(__GLIBC__) ++ gobject_init(); ++#endif + g_assert_type_system_initialized (); + + if (debug_flags) +@@ -4361,6 +4379,9 @@ + void + g_type_init (void) + { ++#if !defined(__GLIBC__) ++ gobject_init(); ++#endif + g_assert_type_system_initialized (); + } + +@@ -4372,6 +4393,12 @@ + TypeNode *node; + GType type; + ++#if !defined(__GLIBC__) ++ static int gobject_initialized = 0; ++ if (gobject_initialized) ++ return; ++ gobject_initialized = 1; ++#endif + /* Ensure GLib is initialized first, see + * https://bugzilla.gnome.org/show_bug.cgi?id=756139 + */ diff --git a/nixpkgs/pkgs/development/libraries/glib/quark_init_on_demand.patch b/nixpkgs/pkgs/development/libraries/glib/quark_init_on_demand.patch new file mode 100644 index 000000000000..168086484314 --- /dev/null +++ b/nixpkgs/pkgs/development/libraries/glib/quark_init_on_demand.patch @@ -0,0 +1,33 @@ +--- glib-source/glib/gquark.c 2016-08-17 17:20:47.000000000 +0200 ++++ glib-source/glib/gquark.c 2016-08-30 07:49:13.298234757 +0200 +@@ -57,6 +57,9 @@ + void + g_quark_init (void) + { ++ if (quark_ht) ++ return; ++ + g_assert (quark_seq_id == 0); + quark_ht = g_hash_table_new (g_str_hash, g_str_equal); + quarks = g_new (gchar*, QUARK_BLOCK_SIZE); +@@ -138,9 +141,12 @@ + return 0; + + G_LOCK (quark_global); ++#if !defined(__GLIBC__) ++ g_quark_init (); ++#endif + quark = GPOINTER_TO_UINT (g_hash_table_lookup (quark_ht, string)); + G_UNLOCK (quark_global); + + return quark; + } + +@@ -280,6 +286,7 @@ + GQuark quark; + gchar **quarks_new; + ++ g_quark_init (); + if (quark_seq_id % QUARK_BLOCK_SIZE == 0) + { + quarks_new = g_new (gchar*, quark_seq_id + QUARK_BLOCK_SIZE); diff --git a/nixpkgs/pkgs/development/libraries/glib/schema-override-variable.patch b/nixpkgs/pkgs/development/libraries/glib/schema-override-variable.patch new file mode 100644 index 000000000000..f98af04a7f24 --- /dev/null +++ b/nixpkgs/pkgs/development/libraries/glib/schema-override-variable.patch @@ -0,0 +1,14 @@ +diff --git a/gio/gsettingsschema.c b/gio/gsettingsschema.c +index 1282c10a1..feadfe3aa 100644 +--- a/gio/gsettingsschema.c ++++ b/gio/gsettingsschema.c +@@ -360,6 +360,9 @@ initialise_schema_sources (void) + + try_prepend_data_dir (g_get_user_data_dir ()); + ++ if (!is_setuid && (path = g_getenv ("NIX_GSETTINGS_OVERRIDES_DIR")) != NULL) ++ try_prepend_dir (path); ++ + /* Disallow loading extra schemas if running as setuid, as that could + * allow reading privileged files. */ + if (!is_setuid && (path = g_getenv ("GSETTINGS_SCHEMA_DIR")) != NULL) diff --git a/nixpkgs/pkgs/development/libraries/glib/setup-hook.sh b/nixpkgs/pkgs/development/libraries/glib/setup-hook.sh new file mode 100644 index 000000000000..8ead5510ec4f --- /dev/null +++ b/nixpkgs/pkgs/development/libraries/glib/setup-hook.sh @@ -0,0 +1,34 @@ +make_glib_find_gsettings_schemas() { + # For packages that need gschemas of other packages (e.g. empathy) + for maybe_dir in "$1"/share/gsettings-schemas/*; do + if [[ -d "$maybe_dir/glib-2.0/schemas" ]]; then + addToSearchPath GSETTINGS_SCHEMAS_PATH "$maybe_dir" + fi + done +} +addEnvHooks "$targetOffset" make_glib_find_gsettings_schemas + +# Install gschemas, if any, in a package-specific directory +glibPreInstallPhase() { + makeFlagsArray+=("gsettingsschemadir=${!outputLib}/share/gsettings-schemas/$name/glib-2.0/schemas/") +} +preInstallPhases+=" glibPreInstallPhase" + +glibPreFixupPhase() { + # Move gschemas in case the install flag didn't help + if [ -d "$prefix/share/glib-2.0/schemas" ]; then + mkdir -p "${!outputLib}/share/gsettings-schemas/$name/glib-2.0" + mv "$prefix/share/glib-2.0/schemas" "${!outputLib}/share/gsettings-schemas/$name/glib-2.0/" + fi + + addToSearchPath GSETTINGS_SCHEMAS_PATH "${!outputLib}/share/gsettings-schemas/$name" +} + +# gappsWrapperArgsHook expects GSETTINGS_SCHEMAS_PATH variable to be set by this. +# Until we have dependency mechanism in generic builder, we need to use this ugly hack. +if [[ " ${preFixupPhases:-} " =~ " gappsWrapperArgsHook " ]]; then + preFixupPhases+=" " + preFixupPhases="${preFixupPhases/ gappsWrapperArgsHook / glibPreFixupPhase gappsWrapperArgsHook }" +else + preFixupPhases+=" glibPreFixupPhase" +fi diff --git a/nixpkgs/pkgs/development/libraries/glib/skip-timer-test.patch b/nixpkgs/pkgs/development/libraries/glib/skip-timer-test.patch new file mode 100644 index 000000000000..942f3e7864c4 --- /dev/null +++ b/nixpkgs/pkgs/development/libraries/glib/skip-timer-test.patch @@ -0,0 +1,17 @@ +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/nixpkgs/pkgs/development/libraries/glib/split-dev-programs.patch b/nixpkgs/pkgs/development/libraries/glib/split-dev-programs.patch new file mode 100644 index 000000000000..f3497e6a7811 --- /dev/null +++ b/nixpkgs/pkgs/development/libraries/glib/split-dev-programs.patch @@ -0,0 +1,157 @@ +diff --git a/gio/gdbus-2.0/codegen/meson.build b/gio/gdbus-2.0/codegen/meson.build +index 65faae9..4297513 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) + # Install gdbus-codegen executable + gdbus_codegen = configure_file(input : 'gdbus-codegen.in', + output : 'gdbus-codegen', +- install_dir : get_option('bindir'), ++ install_dir : get_option('devbindir'), + install_tag : 'bin-devel', + configuration : gdbus_codegen_conf + ) +diff --git a/gio/meson.build b/gio/meson.build +index b19c59f..3b20e84 100644 +--- a/gio/meson.build ++++ b/gio/meson.build +@@ -879,14 +879,15 @@ pkg.generate(libgio, + 'datadir=' + '${prefix}' / get_option('datadir'), + 'schemasdir=' + '${datadir}' / schemas_subdir, + 'bindir=' + '${prefix}' / get_option('bindir'), ++ 'devbindir=' + get_option('devbindir'), + 'giomoduledir=' + pkgconfig_giomodulesdir, + 'gio=' + '${bindir}' / 'gio', +- 'gio_querymodules=' + pkgconfig_multiarch_bindir / 'gio-querymodules', +- 'glib_compile_schemas=' + pkgconfig_multiarch_bindir / 'glib-compile-schemas', +- 'glib_compile_resources=' + '${bindir}' / 'glib-compile-resources', ++ 'gio_querymodules=' + '${devbindir}' / 'gio-querymodules', ++ 'glib_compile_schemas=' + '${devbindir}' / 'glib-compile-schemas', ++ 'glib_compile_resources=' + '${devbindir}' / 'glib-compile-resources', + 'gdbus=' + '${bindir}' /'gdbus', +- 'gdbus_codegen=' + '${bindir}' / 'gdbus-codegen', +- 'gresource=' + '${bindir}' / 'gresource', ++ 'gdbus_codegen=' + '${devbindir}' / 'gdbus-codegen', ++ 'gresource=' + '${devbindir}' / 'gresource', + 'gsettings=' + '${bindir}' / 'gsettings', + ], + version : glib_version, +@@ -989,6 +990,7 @@ executable('gio', gio_tool_sources, + + executable('gresource', 'gresource-tool.c', + install : true, ++ install_dir : get_option('devbindir'), + install_tag : 'bin', + # intl.lib is not compatible with SAFESEH + link_args : noseh_link_args, +@@ -996,7 +998,7 @@ executable('gresource', 'gresource-tool.c', + + gio_querymodules = executable('gio-querymodules', 'gio-querymodules.c', 'giomodule-priv.c', + install : true, +- install_dir : multiarch_bindir, ++ install_dir : get_option('devbindir'), + install_tag : 'bin', + c_args : gio_c_args, + # intl.lib is not compatible with SAFESEH +@@ -1006,7 +1008,7 @@ gio_querymodules = executable('gio-querymodules', 'gio-querymodules.c', 'giomodu + glib_compile_schemas = executable('glib-compile-schemas', + ['glib-compile-schemas.c'], + install : true, +- install_dir : multiarch_bindir, ++ install_dir : get_option('devbindir'), + install_tag : 'bin', + # intl.lib is not compatible with SAFESEH + link_args : noseh_link_args, +@@ -1015,6 +1017,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, ++ install_dir : get_option('devbindir'), + install_tag : 'bin-devel', + c_args : gio_c_args, + # intl.lib is not compatible with SAFESEH +diff --git a/glib/meson.build b/glib/meson.build +index c26a35e..38effe1 100644 +--- a/glib/meson.build ++++ b/glib/meson.build +@@ -447,9 +447,10 @@ pkg.generate(libglib, + 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', ++ 'devbindir=' + get_option('devbindir'), ++ 'glib_genmarshal=' + '${devbindir}' / 'glib-genmarshal', ++ 'gobject_query=' + '${devbindir}' / 'gobject-query', ++ 'glib_mkenums=' + '${devbindir}' / 'glib-mkenums', + 'glib_valgrind_suppressions=' + '${datadir}' / + valgrind_suppression_file_install_subdir / + fs.name(valgrind_suppression_file), +@@ -490,6 +491,7 @@ if host_system == 'windows' + else + gtester = executable('gtester', 'gtester.c', + install : true, ++ install_dir : get_option('devbindir'), + install_tag : 'bin-devel', + c_args : ['-UG_DISABLE_ASSERT'], + include_directories : configinc, +@@ -505,7 +507,7 @@ report_conf.set('PYTHON', python_name) + configure_file( + input: 'gtester-report.in', + output: 'gtester-report', +- install_dir: get_option('bindir'), ++ install_dir: get_option('devbindir'), + install_tag : 'bin-devel', + configuration: report_conf, + install_mode: 'rwxr-xr-x' +diff --git a/gobject/meson.build b/gobject/meson.build +index 2129aaf..da84624 100644 +--- a/gobject/meson.build ++++ b/gobject/meson.build +@@ -94,7 +94,7 @@ foreach tool: python_tools + input : tool + '.in', + output : tool, + configuration : python_tools_conf, +- install_dir : glib_bindir, ++ install_dir : get_option('devbindir'), + install_tag : 'bin-devel', + ) + +@@ -172,6 +172,7 @@ meson.override_dependency('gobject-2.0', libgobject_dep) + + gobject_query = executable('gobject-query', 'gobject-query.c', + install : true, ++ install_dir : get_option('devbindir'), + install_tag : 'bin-devel', + dependencies : [libglib_dep, libgobject_dep]) + +diff --git a/meson_options.txt b/meson_options.txt +index 517d575..198cc1b 100644 +--- a/meson_options.txt ++++ b/meson_options.txt +@@ -4,6 +4,11 @@ option('runtime_libdir', + description : 'install runtime libraries relative to libdir', + deprecated: true) + ++option('devbindir', ++ type : 'string', ++ value : '', ++ description : 'bindir for development tools') ++ + option('charsetalias_dir', + type : 'string', + value : '', +diff --git a/tools/meson.build b/tools/meson.build +index 257312e..f831539 100644 +--- a/tools/meson.build ++++ b/tools/meson.build +@@ -8,7 +8,7 @@ if have_sh + gettextize_conf.set('datarootdir', glib_datadir) + gettextize_conf.set('datadir', glib_datadir) + configure_file(input : 'glib-gettextize.in', +- install_dir : glib_bindir, ++ install_dir : get_option('devbindir'), + install_tag : 'bin-devel', + output : 'glib-gettextize', + configuration : gettextize_conf) |