gtk3: make gtk3 look for immodule cache in $NIX_PROFILE

This commit is contained in:
Eric Sagnes 2016-04-04 18:06:48 +09:00
parent ab428dce14
commit 77c4139262
2 changed files with 29 additions and 7 deletions

View File

@ -0,0 +1,27 @@
--- a/gtk/deprecated/gtkrc.c 2016-04-02 18:43:08.401663112 +0900
+++ b/gtk/deprecated/gtkrc.c 2016-04-02 18:29:19.927608592 +0900
@@ -774,5 +774,23 @@
if (var)
result = g_strdup (var);
+ // check NIX_PROFILES paths.
+ const gchar *nixProfilesEnv = g_getenv ("NIX_PROFILES");
+ gchar *cachePath;
+ guint i;
+
+ if(nixProfilesEnv && !result){
+ gchar **paths = g_strsplit(nixProfilesEnv, " ", -1);
+ for (i = 0; paths[i] != NULL; i++){
+ cachePath = g_build_filename(paths[i], "etc", "gtk-3.0", "immodules.cache", NULL);
+ if( g_file_test( cachePath, G_FILE_TEST_EXISTS) ){
+ if(result) g_free(result);
+ result = g_strdup(cachePath);
+ }
+ g_free(cachePath);
+ }
+ g_strfreev(paths);
+ }
+
if (!result)
{

View File

@ -28,6 +28,8 @@ stdenv.mkDerivation rec {
nativeBuildInputs = [ pkgconfig gettext gobjectIntrospection perl ];
patches = [ ./3.0-immodules.cache.patch ];
buildInputs = [ libxkbcommon epoxy json_glib ];
propagatedBuildInputs = with xorg; with stdenv.lib;
[ expat glib cairo pango gdk_pixbuf atk at_spi2_atk
@ -58,13 +60,6 @@ stdenv.mkDerivation rec {
--replace '-L${gmp.dev}/lib' '-L${gmp.out}/lib'
'';
passthru = {
gtkExeEnvPostBuild = ''
rm $out/lib/gtk-3.0/3.0.0/immodules.cache
$out/bin/gtk-query-immodules-3.0 $out/lib/gtk-3.0/3.0.0/immodules/*.so > $out/lib/gtk-3.0/3.0.0/immodules.cache
''; # workaround for bug of nix-mode for Emacs */ '';
};
meta = with stdenv.lib; {
description = "A multi-platform toolkit for creating graphical user interfaces";