aboutsummaryrefslogtreecommitdiff
path: root/gnu/packages/patches/libxt-guix-search-paths.patch
blob: 5419edd1bdacc94c8c2b36846b380b7b40916325 (about) (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
diff --git a/src/Intrinsic.c b/src/Intrinsic.c
index c9624ec..addcdba 100644
--- a/src/Intrinsic.c
+++ b/src/Intrinsic.c
@@ -1312,21 +1312,101 @@ static void FillInLangSubs(
     } else (void) strcpy(*rest, string);
 }
 
+
+
 /*
- * default path used if environment variable XFILESEARCHPATH
- * is not defined.  Also substitued for %D.
- * The exact value should be documented in the implementation
- * notes for any Xt implementation.
+   Return the default search path for the function
+   XtResolvePathname to use if XFILESEARCHPATH is
+   not defined.
+
+   It returns the combination the set of values which are the 6 "stems" below,
+   prepended with "/run/current-system/profile", and $GUIX_PROFILE and
+   "$HOME/.guix-profile"
+
+   These values provide the default paths where Guix/GuixSD can expect
+   to find resources for installed packages.
  */
-static const char *implementation_default_path(void)
+static const char *guix_default_path(void)
 {
-#if defined(WIN32)
-    static char xfilesearchpath[] = "";
+  static const char *search_path_default_stem[] = {
+    "/lib/X11/%L/%T/%N%C%S",
+    "/lib/X11/%l/%T/%N%C%S",
+    "/lib/X11/%T/%N%C%S",
+    "/lib/X11/%L/%T/%N%S",
+    "/lib/X11/%l/%T/%N%S",
+    "/lib/X11/%T/%N%S"
+  };
+
+#define SIZEOF_STEMS  (strlen (search_path_default_stem[0])	\
+		       + strlen (search_path_default_stem[1])	\
+		       + strlen (search_path_default_stem[2])	\
+		       + strlen (search_path_default_stem[3])	\
+		       + strlen (search_path_default_stem[4])	\
+		       + strlen (search_path_default_stem[5]))
+
+
+  int i;
+  const char *current_profile = "/run/current-system/profile";
+  char *home = getenv ("HOME");
+  char *guix_profile = getenv ("GUIX_PROFILE");
+
+  size_t bytesAllocd = SIZEOF_STEMS + 1;
+
+  /* This function is evaluated multiple times and the calling
+     code assumes that it is idempotent. So we must not allow
+     (say) a changed environment variable to cause it to return
+     something different. */
+  static char *path = NULL;
+  if (path)
+    return path;
+
+  bytesAllocd += 6 * (1 + strlen (current_profile));
+
+  if (guix_profile != NULL)
+    {
+      bytesAllocd += SIZEOF_STEMS;
+      bytesAllocd += 6 * (1 + strlen (guix_profile));
+    }
 
-    return xfilesearchpath;
-#else
-    return XFILESEARCHPATHDEFAULT;
-#endif
+  if (home != NULL)
+    {
+      bytesAllocd += SIZEOF_STEMS;
+      bytesAllocd += 6 * (1 + strlen(home) + strlen ("/.guix-profile"));
+    }
+
+  path = XtMalloc(bytesAllocd);
+  if (path == NULL) _XtAllocError(NULL);
+
+  memset (path, 0, bytesAllocd);
+
+  for (i = 0 ; i < 6 ; ++i)
+    {
+      strcat (path, current_profile);
+      strcat (path, search_path_default_stem[i]);
+      strcat (path, ":");
+    }
+
+  if (guix_profile != NULL)
+    for (i = 0 ; i < 6 ; ++i)
+      {
+	strcat (path, guix_profile);
+	strcat (path, search_path_default_stem[i]);
+	strcat (path, ":");
+      }
+
+  if (home != NULL)
+    for (i = 0 ; i < 6 ; ++i)
+      {
+	strcat (path, home);
+	strcat (path, "/.guix-profile");
+	strcat (path, search_path_default_stem[i]);
+	strcat (path, ":");
+      }
+
+  /* Remove final : */
+  path[strlen(path) - 1] = '\0';
+
+  return path;
 }
 
 
@@ -1354,7 +1434,7 @@ _XtString XtResolvePathname(
 {
     XtPerDisplay pd;
     static const char *defaultPath = NULL;
-    const char *impl_default = implementation_default_path();
+    const char *impl_default = guix_default_path();
     int idef_len = (int) strlen(impl_default);
     char *massagedPath;
     int bytesAllocd, bytesLeft;
o. * guix/self.scm (specification->package): Add guile-avahi. (compiled-guix): Ditto. 2020-10-22git: Require Guile-Git 0.3.0 or later.Ludovic Courtès * guix/git.scm (auth-supported?): Remove. (clone*): Inline code that was dependent on AUTH-SUPPORTED?. (update-cached-checkout): Likewise. (resolve-reference): Remove check for 'object-lookup-prefix' and use it unconditionally. (load-git-submodules): Remove. (update-submodules): Use 'repository-submodules', 'submodule-lookup', etc. unconditionally. (update-cached-checkout): Use 'repository-close!' unconditionally. * m4/guix.m4 (GUIX_CHECK_GUILE_GIT): New macro. * configure.ac: Use it and error out when it fails. * doc/guix.texi (Requirements): Bump to Guile-Git 0.3.0. 2020-10-05build: Use a 'guile' executable that doesn't warn about locales.Ludovic Courtès This gets rid of: guile: warning: failed to install locale when running the 'guix' command on a foreign distro where 'GUIX_LOCPATH' isn't set. * Makefile.am (pkglibexec_PROGRAMS, guile_SOURCES, guile_LDADD) (guile_CFLAGS): New variables. (install-exec-hook): New target. (AUX_FILES): Remove 'guile-launcher.c'. * configure.ac: Use 'GUILE_FLAGS'. 2020-08-29build: Remove references to the 'nix-hash' program.Ludovic Courtès * configure.ac: Remove check for 'nix-hash'. * tests/base32.scm (%nix-hash, %have-nix-hash?): Remove. ("sha256 & bytevector->nix-base32-string"): Remove test. * build-aux/pre-inst-env.in: Do not set 'NIX_HASH' environment variable. 2020-08-29build: Remove check for Guile 2.2.1 bug.Ludovic Courtès This check is unnecessary since e688c2df3924423b67892cc9939ca099c729d1cb. * m4/guix.m4 (GUIX_ASSERT_SYNTAX_OBJECT_EQUAL): Remove. * configure.ac: Remove user. 2020-08-24Use "guile-zlib" and "guile-lzlib" instead of (guix config).Mathieu Othacehe * Makefile.am (MODULES): Remove guix/zlib.scm and guix/lzlib.scm, (SCM_TESTS): remove tests/zlib.scm, tests/lzlib.scm. * build-aux/build-self.scm (make-config.scm): Remove unused %libz variable. * configure.ac: Remove LIBZ and LIBLZ variables and check instead for Guile-zlib and Guile-lzlib. * doc/guix.texi ("Requirements"): Remove zlib requirement and add Guile-zlib and Guile-lzlib instead. * gnu/packages/package-management.scm (guix)[native-inputs]: Add "guile-zlib" and "guile-lzlib", [inputs]: remove "zlib" and "lzlib", [propagated-inputs]: ditto, [arguments]: add "guile-zlib" and "guile-lzlib" to Guile load path. * guix/config.scm.in (%libz, %liblz): Remove them. * guix/lzlib.scm: Remove it. * guix/man-db.scm: Use (zlib) instead of (guix zlib). * guix/profiles.scm (manual-database): Do not stub (guix config) in imported modules list, instead add "guile-zlib" to the extension list. * guix/scripts/publish.scm: Use (zlib) instead of (guix zlib) and (lzlib) instead of (guix lzlib), (string->compression-type, effective-compression): do not check for zlib and lzlib availability. * guix/scripts/substitute.scm (%compression-methods): Do not check for lzlib availability. * guix/self.scm (specification->package): Add "guile-zlib" and "guile-lzlib" and remove "zlib" and "lzlib", (compiled-guix): remove "zlib" and "lzlib" arguments and add guile-zlib and guile-lzlib to the dependencies, also do not pass "zlib" and "lzlib" to "make-config.scm" procedure, (make-config.scm): remove "zlib" and "lzlib" arguments as well as %libz and %liblz variables. * guix/utils.scm (lzip-port): Use (lzlib) instead of (guix lzlib) and do not check for lzlib availability. * guix/zlib.scm: Remove it. * m4/guix.m4 (GUIX_LIBZ_LIBDIR, GUIX_LIBLZ_FILE_NAME): Remove them. * tests/lzlib.scm: Use (zlib) instead of (guix zlib) and (lzlib) instead of (guix lzlib), and do not check for zlib and lzlib availability. * tests/publish.scm: Ditto. * tests/substitute.scm: Do not check for lzlib availability. * tests/utils.scm: Ditto. * tests/zlib.scm: Remove it.