]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/relocate.cc
(setup_paths): oops.
[lilypond.git] / lily / relocate.cc
index ffb32d54153edafa42b69ece4c3708e92b0ecafc..0d9e9c9a6a08850b1e35e421e29c01c4e160a4a4 100644 (file)
@@ -27,6 +27,8 @@
 #include "version.hh"
 #include "warn.hh"
 
+#define FRAMEWORKDIR ".."
+
 
 int
 sane_putenv (char const *key, string value, bool overwrite)
@@ -144,10 +146,20 @@ framework_relocation (string prefix)
   prepend_env_path ("GS_FONTPATH", font_dir);
 #endif
 
-  /* FIXME: *cough* 8.15 *cough* */
-  prepend_env_path ("GS_FONTPATH", datadir + "/ghostscript/8.15/fonts");
-  prepend_env_path ("GS_LIB", datadir + "/ghostscript/8.15/Resource");
-  prepend_env_path ("GS_LIB", datadir + "/ghostscript/8.15/lib");
+  string gs_version =
+#ifdef GHOSTSCRIPT_VERSION
+    GHOSTSCRIPT_VERSION
+#else
+    "ghostscript-version-undefined"
+#endif
+    ;
+  
+  if (char const *cur = getenv ("LILYPOND_GS_VERSION"))
+    gs_version = cur;
+  
+  prepend_env_path ("GS_FONTPATH", datadir + "/ghostscript/" + gs_version + "/fonts");
+  prepend_env_path ("GS_LIB", datadir + "/ghostscript/" + gs_version + "/Resource");
+  prepend_env_path ("GS_LIB", datadir + "/ghostscript/" + gs_version + "/lib");
 
   prepend_env_path ("GS_FONTPATH", datadir + "/gs/fonts");
   prepend_env_path ("GS_LIB", datadir + "/gs/Resource");
@@ -188,7 +200,7 @@ setup_paths (char const *argv0_ptr)
 #endif /* __MINGW32__ */
       prefix_relocation (prefix);
       string bindir = prefix + "/bin";
-      framework_relocation (bindir + "/" FRAMEWORKDIR);
+      framework_relocation (bindir);
     }
   else if (relocate_binary)
     {
@@ -233,7 +245,7 @@ setup_paths (char const *argv0_ptr)
       if (argv0_prefix != compile_prefix)
        prefix_relocation (argv0_prefix);
       if (argv0_prefix != compile_prefix || string (FRAMEWORKDIR) != "..")
-       framework_relocation (bindir + "/" FRAMEWORKDIR);
+       framework_relocation (bindir + "/" FRAMEWORKDIR);
     }
 
   /* FIXME: use LILYPOND_DATADIR.  */
@@ -273,11 +285,11 @@ setup_paths (char const *argv0_ptr)
   
   /* Adding mf/out make lilypond unchanged source directory, when setting
      LILYPONDPREFIX to lilypond-x.y.z */
-  char *suffixes[] = {"ly", "ps", "scm", 0 };
+  char const *suffixes[] = {"ly", "ps", "scm", 0 };
 
   
   vector<string> dirs;
-  for (char **s = suffixes; *s; s++)
+  for (char const **s = suffixes; *s; s++)
     {
       string path = prefix_directory + to_string ('/') + string (*s);
       dirs.push_back (path);