--- sys/grcpfx.c.orig	2015-05-14 13:31:11.566105395 +0000
+++ sys/grcpfx.c	2015-05-14 14:32:13.952900454 +0000
@@ -0,0 +1,36 @@
+#include <string.h>
+
+#ifdef PG_PPU
+#define GRCPFX grcpfx_
+#else
+#define GRCPFX grcpfx
+#endif
+
+/* This is a hack to enable relocation of the PGPLOT libraries so
+ * that they don't need dumb environment variables set to find their
+ * data files. Conda's prefix-replacement method doesn't work in pure
+ * FORTRAN because of how the language handles strings, so we need
+ * this C shim. Fun times.
+ *
+ * I don't mark the data directory as const in case the compiler tries
+ * to get too clever about optimizing the "constant"; it's constant at
+ * build time, but it gets patched by Conda.
+ */
+
+char *hardcoded_datadir = CONDA_DATADIR;
+
+void 
+GRCPFX (char *string, int *slen, int string_buffer_size)
+{
+  int i;
+
+  *slen = (int) strlen (hardcoded_datadir);
+
+  if (*slen > string_buffer_size)
+    *slen = string_buffer_size;
+        
+  strncpy (string, hardcoded_datadir, (size_t) *slen);
+
+  for (i = *slen; i < string_buffer_size; i++)
+    string[i] = ' ';
+}
--- src/grgfil.f.orig	2015-05-14 12:34:25.856646395 +0000
+++ src/grgfil.f	2015-05-14 14:23:21.311203082 +0000
@@ -31,6 +31,7 @@
       PARAMETER  (DEFRGB='rgb.txt')
       CHARACTER*255 FF
       CHARACTER*16 DEFLT
+      CHARACTER*255 CPFX
       INTEGER I, L, LD
       LOGICAL TEST, DEBUG
 C
@@ -51,41 +52,18 @@
          CALL GRWARN('Internal error in routine GRGFIL')
       END IF
 C
-C Try each possibility in turn.
+C Conda: use the hardcoded prefix
 C
-      DO 10 I=1,4
-         IF (I.EQ.1) THEN
-            CALL GRGENV(TYPE, FF, L)
-         ELSE IF (I.EQ.2) THEN
-            CALL GRGENV('DIR', FF, L)
-            IF (L.GT.0) THEN
-               FF(L+1:) = DEFLT
-               L = L+LD
-            END IF
-         ELSE IF (I.EQ.3) THEN
-            CALL GRGENV('DIR', FF, L)
-            IF (L.GT.0) THEN
-               FF(L+1:L+1) = '/'
-               FF(L+2:) = DEFLT
-               L = L+1+LD
-            END IF
-         ELSE IF (I.EQ.4) THEN
-            FF = DEFDIR//DEFLT
-            L = LEN(DEFDIR)+LD
-         END IF
-         IF (L.GT.0) THEN
-            IF (DEBUG) THEN
-               CALL GRWARN('Looking for '//FF(:L))
-            END IF
-            INQUIRE (FILE=FF(:L), EXIST=TEST)
-            IF (TEST) THEN
-               NAME = FF(:L)
-               RETURN
-            ELSE IF (DEBUG) THEN
-               CALL GRWARN('WARNING: file not found')
-            END IF
-         END IF
- 10   CONTINUE
+      CALL GRCPFX(CPFX, L)
+      FF = CPFX(:L)//DEFLT
+      L = L + LD
+      INQUIRE (FILE=FF(:L), EXIST=TEST)
+      IF (TEST) THEN
+         NAME = FF(:L)
+         RETURN
+      ELSE IF (DEBUG) THEN
+         CALL GRWARN('WARNING: file not found: '//FF(:L))
+      END IF
 C
 C Failed to find the file.
 C
--- makemake.orig	2015-05-14 13:36:01.829485428 +0000
+++ makemake	2015-05-14 13:36:26.194517329 +0000
@@ -479,6 +479,7 @@
 "
 
 SYSTEM_ROUTINES="\
+ grcpfx.o\
  grdate.o\
  grfileio.o\
  grflun.o\
