CVSROOT:        /cvsroot/lilypond
Module name:    lilypond
Branch:         
Changes by:     Jan Nieuwenhuizen <[EMAIL PROTECTED]>   05/06/03 12:52:35

Modified files:
        lily           : main.cc 
        flower/include : file-path.hh 
        flower         : file-path.cc 
        .              : ChangeLog 

Log message:
        * lily/main.cc (setup_localisation): Listen to LILYPOND_LOCALEDIR.
        
        * flower/file-path.cc (is_file, is_dir): Export.
        
        * lily/main.cc (prepend_env_path, set_env_file): Use them.

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/lily/main.cc.diff?tr1=1.256&tr2=1.257&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/flower/include/file-path.hh.diff?tr1=1.20&tr2=1.21&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/flower/file-path.cc.diff?tr1=1.35&tr2=1.36&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/ChangeLog.diff?tr1=1.3712&tr2=1.3713&r1=text&r2=text

Patches:
Index: lilypond/ChangeLog
diff -u lilypond/ChangeLog:1.3712 lilypond/ChangeLog:1.3713
--- lilypond/ChangeLog:1.3712   Thu Jun  2 14:28:53 2005
+++ lilypond/ChangeLog  Fri Jun  3 12:52:34 2005
@@ -1,3 +1,11 @@
+2005-06-03  Jan Nieuwenhuizen  <[EMAIL PROTECTED]>
+
+       * lily/main.cc (setup_localisation): Listen to LILYPOND_LOCALEDIR.
+
+       * flower/file-path.cc (is_file, is_dir): Export.
+
+       * lily/main.cc (prepend_env_path, set_env_file): Use them.
+
 2005-06-02  Mats Bengtsson  <[EMAIL PROTECTED]>
 
        * lily/easy-notation.cc: Added include cctype to correct
Index: lilypond/flower/file-path.cc
diff -u lilypond/flower/file-path.cc:1.35 lilypond/flower/file-path.cc:1.36
--- lilypond/flower/file-path.cc:1.35   Thu May 19 22:57:50 2005
+++ lilypond/flower/file-path.cc        Fri Jun  3 12:52:32 2005
@@ -48,7 +48,7 @@
     }
 }
 
-static bool
+bool
 is_file (String file_name)
 {
 #if 0 /* Check if directory. TODO: encapsulate for autoconf */
@@ -79,7 +79,7 @@
   return false;
 }
 
-static bool
+bool
 is_dir (String file_name)
 {
 #if !STAT_MACROS_BROKEN
@@ -98,7 +98,6 @@
   return false;
 }
 
-
 /** Find a file.
 
 Check absolute file name, search in the current dir (DUH! FIXME!),
Index: lilypond/flower/include/file-path.hh
diff -u lilypond/flower/include/file-path.hh:1.20 
lilypond/flower/include/file-path.hh:1.21
--- lilypond/flower/include/file-path.hh:1.20   Thu May 19 22:57:50 2005
+++ lilypond/flower/include/file-path.hh        Fri Jun  3 12:52:32 2005
@@ -35,4 +35,7 @@
   void prepend (String str);
 };
 
+bool is_file (String file_name);
+bool is_dir (String file_name);
+
 #endif /* FILE_PATH */
Index: lilypond/lily/main.cc
diff -u lilypond/lily/main.cc:1.256 lilypond/lily/main.cc:1.257
--- lilypond/lily/main.cc:1.256 Mon May 23 19:18:58 2005
+++ lilypond/lily/main.cc       Fri Jun  3 12:52:31 2005
@@ -270,11 +270,25 @@
 }
 
 static int
+set_env_file (char const* key, String value)
+{
+  if (is_file (value))
+    return sane_putenv (key, value, false);
+  else if (be_verbose_global)
+    warning (_f ("no such file: %s", value));
+  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 ());
+  if (is_dir (value + "/"))
+    return sane_putenv (key, value.to_str0 ());
+  else if (be_verbose_global)
+    warning (_f ("no such directory: %s", value));
+  return -1;
 }
 
 String
@@ -297,38 +311,58 @@
   prefix_directory = LILYPOND_DATADIR;
 
 #if ARGV0_RELOCATION
+
+  if (getenv ("LILYPOND_VERBOSE"))
+    be_verbose_global = true;
+
   String bindir = dir_name (argv0);
   String argv0_prefix = dir_name (bindir);
   if (argv0_prefix != dir_name (dir_name (dir_name (prefix_directory))))
     {
-#if 0
-      warning (_f ("argv0 relocation: argv0=%s, prefix=%s", argv0,
-                  prefix_directory));
-#endif
+      if (be_verbose_global)
+       warning (_f ("argv0 relocation: argv0=%s, prefix=%s", argv0,
+                    prefix_directory));
       String datadir = argv0_prefix + "/share";
       String libdir = argv0_prefix + "/lib";
+      String localedir = argv0_prefix + "/locale";
       String sysconfdir = argv0_prefix + "/etc";
-      prefix_directory = datadir + "/lilypond/" TOPLEVEL_VERSION;
+      String argv0_lilypond_datadir = datadir + "/lilypond/" TOPLEVEL_VERSION;
+
+      if (is_dir (argv0_lilypond_datadir))
+       prefix_directory = argv0_lilypond_datadir;
 
-      sane_putenv ("FONTCONFIG_FILE", sysconfdir + "/fonts/fonts.conf", false);
+#if HAVE_GETTEXT
+      if (is_dir (localedir))
+       bindtextdomain ("lilypond", localedir.to_str0 ());
+#endif
+
+      set_env_file ("FONTCONFIG_FILE", sysconfdir + "/fonts/fonts.conf");
 #ifdef __MINGW32__
       char font_dir[PATH_MAX];
       ExpandEnvironmentStrings ("%windir%/fonts", font_dir, sizeof (font_dir));
       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");
+
       prepend_env_path ("GS_FONTPATH", datadir + "/gs/fonts");
       prepend_env_path ("GS_LIB", datadir + "/gs/Resource");
       prepend_env_path ("GS_LIB", datadir + "/gs/lib");
+
       prepend_env_path ("GUILE_LOAD_PATH", datadir
                        + to_string ("/guile/%d.%d",
                                     SCM_MAJOR_VERSION, SCM_MINOR_VERSION));
-      sane_putenv ("PANGO_RC_FILE", sysconfdir + "/pango/pangorc", false);
+      set_env_file ("PANGO_RC_FILE", sysconfdir + "/pango/pangorc");
       prepend_env_path ("PATH", bindir);
     }
 #else
   (void) argv0;
 #endif /* ARGV0_RELOCATION */
-    
+
+  /* FIXME: use LILYPOND_DATADIR.  */
   if (char const *env = getenv ("LILYPONDPREFIX"))
     {
 #ifdef __MINGW32__
@@ -553,10 +587,12 @@
      Disable localisation of float values.  This breaks TeX output.  */
   setlocale (LC_NUMERIC, "C");
 
-  String name (PACKAGE);
-  name.to_lower ();
-  bindtextdomain (name.to_str0 (), LOCALEDIR);
-  textdomain (name.to_str0 ());
+  String localedir = LOCALEDIR;
+  if (char const *env = getenv ("LILYPOND_LOCALEDIR"))
+    localedir = env;
+  
+  bindtextdomain ("lilypond", localedir.to_str0 ());
+  textdomain ("lilypond");
 #endif
 }
 


_______________________________________________
Lilypond-cvs mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/lilypond-cvs

Reply via email to