]> git.donarmstrong.com Git - lilypond.git/commitdiff
*** empty log message ***
authorJan Nieuwenhuizen <janneke@gnu.org>
Mon, 16 May 2005 23:25:37 +0000 (23:25 +0000)
committerJan Nieuwenhuizen <janneke@gnu.org>
Mon, 16 May 2005 23:25:37 +0000 (23:25 +0000)
ChangeLog
Documentation/pictures/GNUmakefile
flower/file-path.cc
lily/main.cc
scm/backend-library.scm
scm/editor.scm
scripts/lilypond-invoke-editor.scm

index b1eeae499539b03b316b8d11585336230b5dd847..927ed21c39fb43e180277fb6e7901f6344c8a2f8 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,7 @@
+2005-05-16  Jan Nieuwenhuizen  <janneke@gnu.org>
+
+       * lily/main.cc (setup_paths)[ARGV0_RELOCATION]: 
+
 2005-05-16  Mats Bengtsson  <mabe@drongo.s3.kth.se>
 
        * lily/horizontal-bracket.cc (print): Take care of the direction
index 7490fd6a5974b6be7d154a95209df4d5abf99241..b1e9ee9d1eded90fcf5a117540355c2cdacb0599 100644 (file)
@@ -7,6 +7,8 @@ OUTPNG_FILES = $(addprefix $(outdir)/,$(XPM_FILES:.xpm=.png))
 
 EXTRA_DIST_FILES= $(XPM_FILES)
 
+include $(depth)/make/stepmake.make
+
 ifeq ($(PLATFORM_WINDOWS),yes)
 OUT_DIST_FILES = $(icon) # $(package-icon)
 
@@ -35,8 +37,6 @@ $(outdir)/%-8.png: $(outdir)/%.png
        convert -depth 8 $< $@
 endif # PLATFORM_WINDOWS
 
-include $(depth)/make/stepmake.make
-
 default: $(icon)
 local-dist: $(icon) # $(package-icon)
 xgifs: $(OUTGIF_FILES)
index 1c0fb5628de9a9496482fca84ce420f1cfad2555..32f174943ac9ce6aee17b54b740fb557ee455eb7 100644 (file)
@@ -112,8 +112,7 @@ File_path::find (String name) const
     return name;
 
 #ifdef __MINGW32__
-  if (name[0] == '\\' || (name.length () > 2 && name[2] == '\\')
-      || name.index ('//'))
+  if (name.index ('\\') >= 0)
     programming_error ("file name not normalized: " + name);
 #endif /* __MINGW32__ */
 
index eb2f222d174a76227600f01958ad6fe294b6432e..32455ce104fb910fb65e6e56fc9a0f3626be9382 100644 (file)
@@ -170,16 +170,32 @@ static Long_option_init options_static[]
 
 #define LILYPOND_DATADIR PACKAGE_DATADIR "/" TOPLEVEL_VERSION
 
+static void
+env_var_info (FILE *out, char const* key)
+{
+  if (char const *value = getenv (key))
+    fprintf (out, "%s=\"%s\"\n", key, value);
+}
+
 static void
 dir_info (FILE *out)
 {
   fputs ("\n", out);
   fprintf (out, "LILYPOND_DATADIR=\"%s\"\n", LILYPOND_DATADIR);
-  if (char const *env = getenv ("LILYPONDPREFIX"))
-    fprintf (out, "LILYPONDPREFIX=\"%s\"\n", env);
+  env_var_info (out, "LILYPONDPREFIX");
   fprintf (out, "LOCALEDIR=\"%s\"\n", LOCALEDIR);
 
   fprintf (out, "\nEffective prefix: \"%s\"\n", prefix_directory.to_str0 ());
+
+#if ARGV0_RELOCATION
+  env_var_info (out, "FONTCONFIG_FILE");
+  env_var_info (out, "FONTCONFIG_PATH");
+  env_var_info (out, "GS_FONTPATH");
+  env_var_info (out, "GS_LIB");
+  env_var_info (out, "GUILE_LOAD_PATH");
+  env_var_info (out, "PANGO_RC_FILE");
+  env_var_info (out, "PATH");
+#endif  
 }
 
 static void
@@ -240,10 +256,71 @@ warranty ()
   printf (_ (WARRANTY).to_str0 ());
 }
 
+#if ARGV0_RELOCATION
+static int
+sane_putenv (char const* key, String value, bool overwrite = true)
+{
+  if (overwrite || !getenv (key))
+    {
+      String combine = String (key) + "=" + value;
+      char *s = strdup (combine.to_str0 ());
+      return putenv (s);
+    }
+  return -1;
+}
+
+static int
+prepend_env_path (char const *key, String value)
+{
+  if (char const* cur = getenv (key))
+    value += to_string (PATHSEP) + cur;
+  return sane_putenv (key, value.to_str0 ());
+}
+
+String
+dir_name (String const file_name)
+{
+  String s = file_name;
+  s.substitute ('\\', '/');
+  s = s.left_string (s.index_last ('/'));
+  return s;
+}
+#endif
+
 static void
-setup_paths ()
+setup_paths (char const* argv0)
 {
   prefix_directory = LILYPOND_DATADIR;
+
+#if ARGV0_RELOCATION
+  String bindir = dir_name (argv0);
+  String argv0_prefix = dir_name (bindir);
+  if (argv0_prefix != dir_name (dir_name (dir_name (prefix_directory))))
+    {
+      warning (_f ("argv0 relocation: argv0=%s, prefix=%s", argv0,
+                  prefix_directory));
+      String datadir = argv0_prefix + "/share";
+      String libdir = argv0_prefix + "/lib";
+      String sysconfdir = argv0_prefix + "/etc";
+      prefix_directory = datadir + "/lilypond/" TOPLEVEL_VERSION;
+
+      sane_putenv ("FONTCONFIG_FILE", sysconfdir + "/fonts/fonts.conf", false);
+      prepend_env_path ("GUILE_LOAD_PATH", datadir
+                       + to_string ("/guile/%d.%d",
+                                    SCM_MAJOR_VERSION, SCM_MINOR_VERSION));
+#ifdef __MINGW32__
+      /* FIXME: this is broken and must go, but updating the environment
+        takes a relogin/reboot.  Can gs be wrapped?  */
+      prepend_env_path ("GS_FONTPATH", "c:/windows/fonts");
+#endif
+      prepend_env_path ("GS_FONTPATH", datadir + "/gs/fonts");
+      prepend_env_path ("GS_LIB", datadir + "/gs/Resource");
+      prepend_env_path ("GS_LIB", datadir + "/gs/lib");
+      sane_putenv ("PANGO_RC_FILE", sysconfdir + "/pango/pango.modules", false);
+      prepend_env_path ("PATH", bindir);
+    }
+#endif /* ARGV0_RELOCATION */
+    
   if (char const *env = getenv ("LILYPONDPREFIX"))
     prefix_directory = env;
 
@@ -420,9 +497,7 @@ main_with_guile (void *, int, char **)
       char const *str0 = init_scheme_code_string.to_str0 ();
       
       if (be_verbose_global)
-       {
-         progress_indication (_f("Evaluating %s", str0));
-       }
+       progress_indication (_f("Evaluating %s", str0));
       scm_c_eval_string ((char *) str0);
     }
 
@@ -600,7 +675,7 @@ int
 main (int argc, char **argv)
 {
   setup_localisation ();
-  setup_paths ();
+  setup_paths (argv[0]);
   parse_argv (argc, argv);
   if (isatty (STDIN_FILENO))
     identify (stderr);
index 756d6c6638ad70cde0badec3a18f5bf9e39fe453..74e53693594a9c836aed76fbd10a5768a2c3428a 100644 (file)
@@ -36,8 +36,8 @@
   (let* ((pdf-name (string-append (basename name ".ps") ".pdf" ))
         (cmd (format #f
                      "gs\
+ -dSAFER\
  -dCompatibilityLevel=1.4 \
- ~S\
  -sPAPERSIZE=~a\
  -q\
  -dNOPAUSE\
  -c .setpdfwrite\
  -f ~S\
 "
-                     ;; gs on windows with -dSAFER fails on opening a
-                     ;; file that has no group read permissions.
-                     (if (eq? PLATFORM 'windows) "" "-dSAFER")
                      (sanitize-command-option papersizename)
                      pdf-name
                      name)))
+    ;; The wrapper on windows cannot handle `=' signs,
+    ;; gs has a workaround with #.
+    (if (eq? PLATFORM 'windows)
+       (set! cmd (string-regex-substitute "=" "#" cmd)))
 
     (if (access? pdf-name W_OK)
        (delete-file pdf-name))
index b02d3917f47ed2f475c7b17ee8827d87c25ed59d..047d9af7a2f46a8dd2c87d7ecf3b12b64cf21b10 100644 (file)
@@ -14,7 +14,8 @@
     ("gvim" . "gvim --remote +:%(line)s:norm%(column)s %(file)s")
     ("nedit" . "nc -noask +%(line)s %(file)s")
     ("gedit" . "gedit +%(line)s %(file)s")
-    ("jedit" . "jedit %(file)s +line:%(line)s")))
+    ("jedit" . "jedit %(file)s +line:%(line)s")
+    ("lilypad" . "lilypad +%(line)s:%(column)s %(file)s")))
 
 (define (get-editor)
   (or (getenv "LYEDITOR")
index 56218fb7443862c17fdb844c1d966392a09a5fcc..e61d10f779ff5f4574c2210023da68a8219456d7 100755 (executable)
  (srfi srfi-14))
 
 (define PROGRAM-NAME "lilypond-invoke-editor")
-(define TOPLEVEL-VERSION "2.5.25")
-(define DATADIR "@DATADIR@")
+(define TOPLEVEL-VERSION "@TOPLEVEL_VERSION@")
+(define DATADIR "@datadir@")
 (define COMPILE-TIME-PREFIX
   (format #f "~a/lilypond/~a" DATADIR TOPLEVEL-VERSION))
-(define LILYPONDPREFIX (or (getenv "LILYPONDPREFIX") COMPILE-TIME-PREFIX))
+
+;; argv0 relocation -- do in wrapper?
+(define LILYPONDPREFIX
+  (or (getenv "LILYPONDPREFIX")
+      (let* ((bindir (dirname (car (command-line))))
+            (prefix (dirname bindir))
+            (lilypond-prefix
+             (if (eq? prefix (dirname DATADIR)) COMPILE-TIME-PREFIX
+                 (format #f "~a/share/lilypond/~a"
+                         prefix TOPLEVEL-VERSION))))
+       lilypond-prefix)))
 
 ;; gettext wrapper for guile < 1.7.2
 (if (defined? 'gettext)