CVSROOT: /cvsroot/lilypond
Module name: lilypond
Branch:
Changes by: Jan Nieuwenhuizen <[EMAIL PROTECTED]> 05/05/16 23:25:37
Modified files:
scripts : lilypond-invoke-editor.scm
scm : editor.scm backend-library.scm
lily : main.cc
flower : file-path.cc
Documentation/pictures: GNUmakefile
. : ChangeLog
Log message:
CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/scripts/lilypond-invoke-editor.scm.diff?tr1=1.4&tr2=1.5&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/scm/editor.scm.diff?tr1=1.5&tr2=1.6&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/scm/backend-library.scm.diff?tr1=1.25&tr2=1.26&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/lily/main.cc.diff?tr1=1.251&tr2=1.252&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/flower/file-path.cc.diff?tr1=1.33&tr2=1.34&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/Documentation/pictures/GNUmakefile.diff?tr1=1.8&tr2=1.9&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/ChangeLog.diff?tr1=1.3623&tr2=1.3624&r1=text&r2=text
Patches:
Index: lilypond/ChangeLog
diff -u lilypond/ChangeLog:1.3623 lilypond/ChangeLog:1.3624
--- lilypond/ChangeLog:1.3623 Mon May 16 11:46:52 2005
+++ lilypond/ChangeLog Mon May 16 23:25:37 2005
@@ -1,3 +1,7 @@
+2005-05-16 Jan Nieuwenhuizen <[EMAIL PROTECTED]>
+
+ * lily/main.cc (setup_paths)[ARGV0_RELOCATION]:
+
2005-05-16 Mats Bengtsson <[EMAIL PROTECTED]>
* lily/horizontal-bracket.cc (print): Take care of the direction
Index: lilypond/Documentation/pictures/GNUmakefile
diff -u lilypond/Documentation/pictures/GNUmakefile:1.8
lilypond/Documentation/pictures/GNUmakefile:1.9
--- lilypond/Documentation/pictures/GNUmakefile:1.8 Sat May 14 21:43:04 2005
+++ lilypond/Documentation/pictures/GNUmakefile Mon May 16 23:25:37 2005
@@ -7,6 +7,8 @@
EXTRA_DIST_FILES= $(XPM_FILES)
+include $(depth)/make/stepmake.make
+
ifeq ($(PLATFORM_WINDOWS),yes)
OUT_DIST_FILES = $(icon) # $(package-icon)
@@ -35,8 +37,6 @@
convert -depth 8 $< $@
endif # PLATFORM_WINDOWS
-include $(depth)/make/stepmake.make
-
default: $(icon)
local-dist: $(icon) # $(package-icon)
xgifs: $(OUTGIF_FILES)
Index: lilypond/flower/file-path.cc
diff -u lilypond/flower/file-path.cc:1.33 lilypond/flower/file-path.cc:1.34
--- lilypond/flower/file-path.cc:1.33 Sun May 15 23:44:06 2005
+++ lilypond/flower/file-path.cc Mon May 16 23:25:37 2005
@@ -112,8 +112,7 @@
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: lilypond/lily/main.cc
diff -u lilypond/lily/main.cc:1.251 lilypond/lily/main.cc:1.252
--- lilypond/lily/main.cc:1.251 Sat May 14 21:43:04 2005
+++ lilypond/lily/main.cc Mon May 16 23:25:37 2005
@@ -171,15 +171,31 @@
#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 @@
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 @@
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 @@
main (int argc, char **argv)
{
setup_localisation ();
- setup_paths ();
+ setup_paths (argv[0]);
parse_argv (argc, argv);
if (isatty (STDIN_FILENO))
identify (stderr);
Index: lilypond/scm/backend-library.scm
diff -u lilypond/scm/backend-library.scm:1.25
lilypond/scm/backend-library.scm:1.26
--- lilypond/scm/backend-library.scm:1.25 Sun May 15 23:44:06 2005
+++ lilypond/scm/backend-library.scm Mon May 16 23:25:37 2005
@@ -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\
@@ -47,12 +47,13 @@
-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: lilypond/scm/editor.scm
diff -u lilypond/scm/editor.scm:1.5 lilypond/scm/editor.scm:1.6
--- lilypond/scm/editor.scm:1.5 Sun May 15 11:45:13 2005
+++ lilypond/scm/editor.scm Mon May 16 23:25:37 2005
@@ -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: lilypond/scripts/lilypond-invoke-editor.scm
diff -u lilypond/scripts/lilypond-invoke-editor.scm:1.4
lilypond/scripts/lilypond-invoke-editor.scm:1.5
--- lilypond/scripts/lilypond-invoke-editor.scm:1.4 Sun May 15 21:22:08 2005
+++ lilypond/scripts/lilypond-invoke-editor.scm Mon May 16 23:25:37 2005
@@ -17,11 +17,21 @@
(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)
_______________________________________________
Lilypond-cvs mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/lilypond-cvs