summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJan Nieuwenhuizen <janneke@gnu.org>2007-02-02 13:06:30 +0100
committerJan Nieuwenhuizen <janneke@gnu.org>2007-02-02 13:06:30 +0100
commit38e0fd809d01de319d40224b5d2279888304b2d3 (patch)
tree123f994c41374bec9292c6c3fc586cb2259dee23
parent88755cdba14fe06fbe7f434841e193c5474c5a6b (diff)
Finish rename of LILYPONDPREFIX to LILYPOND_DATADIR. Remove confusion
between prefix (/usr) and lilypond_datadir (/usr/share/lilypond/x.y.x), fixes running from compile prefix and build tree with `current' link.
-rw-r--r--Documentation/topdocs/NEWS.tely4
-rw-r--r--Documentation/user/GNUmakefile2
-rw-r--r--Documentation/user/running.itely4
-rw-r--r--SConstruct20
-rw-r--r--flower/GNUmakefile2
-rw-r--r--lily/font-config.cc4
-rw-r--r--lily/general-scheme.cc2
-rw-r--r--lily/include/main.hh2
-rw-r--r--lily/include/relocate.hh1
-rw-r--r--lily/main.cc12
-rw-r--r--lily/relocate.cc192
-rw-r--r--make/ly.make4
-rw-r--r--python/lilylib.py8
-rw-r--r--scm/standalone.scm4
-rwxr-xr-xscripts/lilypond-invoke-editor.scm6
15 files changed, 135 insertions, 132 deletions
diff --git a/Documentation/topdocs/NEWS.tely b/Documentation/topdocs/NEWS.tely
index b79a19a998..3ec4ab5959 100644
--- a/Documentation/topdocs/NEWS.tely
+++ b/Documentation/topdocs/NEWS.tely
@@ -86,6 +86,10 @@ This feature was sponsored by Trevor Bača.
@item
+The environment variable LILYPONDPREFIX has been renamed to
+LILYPOND_DATADIR.
+
+@item
Notes or rests, such as a typical end note, that fill an entire
measure are preceded by some more space.
diff --git a/Documentation/user/GNUmakefile b/Documentation/user/GNUmakefile
index 11653d575f..9186bf5bb0 100644
--- a/Documentation/user/GNUmakefile
+++ b/Documentation/user/GNUmakefile
@@ -40,7 +40,7 @@ info: $(INFO_FILES)
pathsettings:
@echo export PATH=$(PATH)
- @echo export LILYPONDPREFIX=$(LILYPONDPREFIX)
+ @echo export LILYPOND_DATADIR=$(LILYPOND_DATADIR)
@echo export PYTHONPATH=$(PYTHONPATH)
xml: $(outdir)/lilypond/lilypond.xml $(outdir)/lilypond-internals/lilypond-internals.xml
diff --git a/Documentation/user/running.itely b/Documentation/user/running.itely
index 5670f9e28b..e6ed8fa904 100644
--- a/Documentation/user/running.itely
+++ b/Documentation/user/running.itely
@@ -330,11 +330,11 @@ Show the warranty with which GNU LilyPond comes. (It comes with
@cindex LANG
-@cindex LILYPONDPREFIX
+@cindex LILYPOND_DATADIR
@code{Lilypond} recognizes the following environment variables:
@table @code
-@item LILYPONDPREFIX
+@item LILYPOND_DATADIR
This specifies a directory where locale messages and
data files will be looked up by default. The directory should contain
subdirectories called @file{ly/}, @file{ps/}, @file{tex/}, etc.
diff --git a/SConstruct b/SConstruct
index 5a07e1b33a..5df9fd0598 100644
--- a/SConstruct
+++ b/SConstruct
@@ -22,7 +22,7 @@ Run from build tree
PATH=$run/bin:$PATH
#optionally, if you do not use custom.py below
- #export LILYPONDPREFIX=$run/share/lilypond/<VERSION>
+ #export LILYPOND_DATADIR=$run/share/lilypond/<VERSION>
lilypond input/simple
@@ -245,7 +245,7 @@ if not os.path.exists (cachedir):
CacheDir (cachedir)
-# No need to set $LILYPONDPREFIX to run lily, but cannot install...
+# No need to set $LILYPOND_DATADIR to run lily, but cannot install...
if env['debugging'] and not 'install' in COMMAND_LINE_TARGETS:
env['prefix'] = run_prefix
@@ -658,17 +658,17 @@ SConscript ('buildscripts/builder.py')
env.PrependENVPath ('PATH',
os.path.join (env['absbuild'], env['out'], 'usr/bin'))
-LILYPONDPREFIX = os.path.join (run_prefix, 'share/lilypond/', version)
+LILYPOND_DATADIR = os.path.join (run_prefix, 'share/lilypond/', version)
-if not os.path.exists (LILYPONDPREFIX):
- os.makedirs (LILYPONDPREFIX)
+if not os.path.exists (LILYPOND_DATADIR):
+ os.makedirs (LILYPOND_DATADIR)
-env.Command (LILYPONDPREFIX, ['#/SConstruct', '#/VERSION'], symlink_tree)
-env.Depends ('lily', LILYPONDPREFIX)
+env.Command (LILYPOND_DATADIR, ['#/SConstruct', '#/VERSION'], symlink_tree)
+env.Depends ('lily', LILYPOND_DATADIR)
env.Append (ENV = {
- 'LILYPONDPREFIX' : LILYPONDPREFIX,
- 'TEXMF' : '{$LILYPONDPREFIX,'
+ 'LILYPOND_DATADIR' : LILYPOND_DATADIR,
+ 'TEXMF' : '{$LILYPOND_DATADIR,'
+ os.popen ('kpsexpand \$TEXMF').read ()[:-1] + '}',
})
@@ -781,7 +781,7 @@ env.Command (version_hh, '#/VERSION',
# post-config environment update
env.Append (
run_prefix = run_prefix,
- LILYPONDPREFIX = LILYPONDPREFIX,
+ LILYPOND_DATADIR = LILYPOND_DATADIR,
# FIXME: move to lily/SConscript?
LIBPATH = [os.path.join (absbuild, 'flower', env['out'])],
diff --git a/flower/GNUmakefile b/flower/GNUmakefile
index 670aece45c..83fc5576fa 100644
--- a/flower/GNUmakefile
+++ b/flower/GNUmakefile
@@ -9,7 +9,7 @@ README_FILES = NEWS-1.0 NEWS-1.1.46 README TODO
EXTRA_DIST_FILES= VERSION $(README_FILES) $(SCRIPTS)
STEPMAKE_TEMPLATES=library c++ po test
-# test uses LILYPONDPREFIX
+# test uses LILYPOND_DATADIR
LOCALSTEPMAKE_TEMPLATES=lilypond
TEST_MODULE_LIBS = ../flower
export top-src-dir
diff --git a/lily/font-config.cc b/lily/font-config.cc
index ab530eabfd..742887f684 100644
--- a/lily/font-config.cc
+++ b/lily/font-config.cc
@@ -45,8 +45,8 @@ init_fontconfig ()
vector<string> dirs;
- dirs.push_back (prefix_directory + "/fonts/otf/");
- dirs.push_back (prefix_directory + "/fonts/type1/");
+ dirs.push_back (lilypond_datadir + "/fonts/otf/");
+ dirs.push_back (lilypond_datadir + "/fonts/type1/");
for (vsize i = 0; i < dirs.size (); i++)
{
diff --git a/lily/general-scheme.cc b/lily/general-scheme.cc
index 816dfeee0a..1d97d4bf8e 100644
--- a/lily/general-scheme.cc
+++ b/lily/general-scheme.cc
@@ -289,7 +289,7 @@ LY_DEFINE (ly_effective_prefix, "ly:effective-prefix",
0, 0, 0, (),
"Return effective prefix.")
{
- return ly_string2scm (prefix_directory);
+ return ly_string2scm (lilypond_datadir);
}
LY_DEFINE (ly_chain_assoc_get, "ly:chain-assoc-get",
diff --git a/lily/include/main.hh b/lily/include/main.hh
index 69aa8899c7..bf02837d93 100644
--- a/lily/include/main.hh
+++ b/lily/include/main.hh
@@ -35,7 +35,7 @@ extern bool do_internal_type_checking_global;
extern bool is_pango_format_global;
extern bool is_TeX_format_global;
extern bool point_and_click_global;
-extern string prefix_directory;
+extern string lilypond_datadir;
extern bool use_object_keys;
extern bool strict_infinity_checking;
extern string init_scheme_code_global;
diff --git a/lily/include/relocate.hh b/lily/include/relocate.hh
index d50614d787..80dc22e890 100644
--- a/lily/include/relocate.hh
+++ b/lily/include/relocate.hh
@@ -14,7 +14,6 @@
void read_relocation_dir (string dirname);
void read_relocation_file (string filename);
-string read_line (FILE *f);
string expand_environment_variables (string orig);
int sane_putenv (char const *key, string value, bool overwrite);
diff --git a/lily/main.cc b/lily/main.cc
index 4a539e0eea..4232f17e2e 100644
--- a/lily/main.cc
+++ b/lily/main.cc
@@ -136,7 +136,7 @@ static char const *WARRANTY
/* Where the init files live. Typically:
LILYPOND_DATADIR = /usr/share/lilypond
*/
-string prefix_directory;
+string lilypond_datadir;
/* The jail specification: USER, GROUP, JAIL, DIR. */
string jail_spec;
@@ -199,9 +199,10 @@ dir_info (FILE *out)
fputs ("\n", out);
fprintf (out, "LILYPOND_DATADIR=\"%s\"\n", LILYPOND_DATADIR);
env_var_info (out, "LILYPONDPREFIX");
+ env_var_info (out, "LILYPOND_DATADIR");
fprintf (out, "LOCALEDIR=\"%s\"\n", LOCALEDIR);
- fprintf (out, "\nEffective prefix: \"%s\"\n", prefix_directory.c_str ());
+ fprintf (out, "\nEffective prefix: \"%s\"\n", lilypond_datadir.c_str ());
if (relocate_binary)
{
@@ -377,8 +378,8 @@ main_with_guile (void *, int, char **)
/* Engravers use lily.scm contents, need to make Guile find it.
Prepend onto GUILE %load-path, very ugh. */
- prepend_load_path (prefix_directory);
- prepend_load_path (prefix_directory + "/scm");
+ prepend_load_path (lilypond_datadir);
+ prepend_load_path (lilypond_datadir + "/scm");
if (be_verbose_global)
dir_info (stderr);
@@ -593,9 +594,6 @@ setup_guile_env ()
"104857600", overwrite);
}
-void
-read_relocation_dir (string);
-
int
main (int argc, char **argv)
{
diff --git a/lily/relocate.cc b/lily/relocate.cc
index 635b4165c9..2ff9fc44d3 100644
--- a/lily/relocate.cc
+++ b/lily/relocate.cc
@@ -48,7 +48,7 @@ sane_putenv (char const *key, string value, bool overwrite)
/*
unfortunately, we can't portably free S here,
due to various bugs in glibc prior to 2.1.1
- */
+ */
return retval;
}
@@ -97,37 +97,41 @@ prepend_env_path (char const *key, string value)
#include <winbase.h>
#endif
-void
+static void
prefix_relocation (string prefix)
{
- if (be_verbose_global)
- warning (_f ("Relocation: compile prefix=%s, new prefix=%s",
- prefix_directory,
- prefix.c_str ()));
-
string bindir = prefix + "/bin";
string datadir = prefix + "/share";
string localedir = datadir + "/locale";
- string lilypond_datadir = datadir + "/lilypond/";
-
- if (is_dir (lilypond_datadir + "/" + TOPLEVEL_VERSION))
- prefix_directory = lilypond_datadir + "/" + TOPLEVEL_VERSION;
- else if (is_dir (lilypond_datadir + "/current"))
- prefix_directory = lilypond_datadir + "/current";
-
+ string package_datadir = datadir + "/lilypond/";
+ string old_lilypond_datadir = lilypond_datadir;
+
+ if (is_dir (package_datadir + "/" + TOPLEVEL_VERSION))
+ lilypond_datadir = package_datadir + "/" + TOPLEVEL_VERSION;
+ else if (is_dir (package_datadir + "/current"))
+ lilypond_datadir = package_datadir + "/current";
+ else
+ warning (_f ("not relocating, no %s/ or current/ found under %s",
+ TOPLEVEL_VERSION, package_datadir.c_str ()));
+
#if HAVE_GETTEXT
if (is_dir (localedir))
bindtextdomain ("lilypond", localedir.c_str ());
#endif
prepend_env_path ("PATH", bindir);
+
+ if (be_verbose_global)
+ warning (_f ("Relocation: compile datadir=%s, new datadir=%s",
+ old_lilypond_datadir.c_str (),
+ lilypond_datadir.c_str ()));
}
/*
UGH : this is a complete mess.
- */
+*/
-void
+static void
framework_relocation (string prefix)
{
if (be_verbose_global)
@@ -144,106 +148,106 @@ framework_relocation (string prefix)
/*
UGH : this is a complete mess.
- */
+*/
void
setup_paths (char const *argv0_ptr)
{
File_name argv0_filename (argv0_ptr);
- prefix_directory = LILYPOND_DATADIR;
- if (relocate_binary
- && getenv ("LILYPOND_RELOCATE_PREFIX"))
+ if (relocate_binary)
{
- prefix_directory = getenv ("LILYPOND_RELOCATE_PREFIX");
+ string prefix_directory;
+ if (getenv ("LILYPOND_RELOCATE_PREFIX"))
+ {
+ prefix_directory = getenv ("LILYPOND_RELOCATE_PREFIX");
#ifdef __MINGW32__
- /* Normalize file name. */
- prefix_directory = File_name (prefix_directory).to_string ();
+ /* Normalize file name. */
+ prefix_directory = File_name (prefix_directory).to_string ();
#endif /* __MINGW32__ */
- prefix_relocation (prefix_directory);
- string bindir = prefix_directory + "/bin";
- framework_relocation (bindir);
- }
- else if (relocate_binary)
- {
- string argv0_abs;
- if (argv0_filename.is_absolute ())
- {
- argv0_abs = argv0_filename.to_string ();
- if (be_verbose_global)
- warning (_f ("Relocation: is absolute: argv0=%s", argv0_ptr));
+ prefix_relocation (prefix_directory);
+ string bindir = prefix_directory + "/bin";
+ framework_relocation (bindir);
}
- else if (argv0_filename.dir_.length ())
+ else if (relocate_binary)
{
- argv0_abs = get_working_directory ()
- + "/" + string (argv0_filename.to_string ());
- if (be_verbose_global)
- warning (_f ("Relocation: from cwd: argv0=%s", argv0_ptr));
- }
- else
- {
- /* Find absolute ARGV0 name, using PATH. */
- File_path path;
- path.parse_path (getenv ("PATH"));
+ string argv0_abs;
+ if (argv0_filename.is_absolute ())
+ {
+ argv0_abs = argv0_filename.to_string ();
+ if (be_verbose_global)
+ warning (_f ("Relocation: is absolute: argv0=%s", argv0_ptr));
+ }
+ else if (argv0_filename.dir_.length ())
+ {
+ argv0_abs = get_working_directory ()
+ + "/" + string (argv0_filename.to_string ());
+ if (be_verbose_global)
+ warning (_f ("Relocation: from cwd: argv0=%s", argv0_ptr));
+ }
+ else
+ {
+ /* Find absolute ARGV0 name, using PATH. */
+ File_path path;
+ path.parse_path (getenv ("PATH"));
- if (be_verbose_global)
- warning (_f ("Relocation: from PATH=%s\nargv0=%s",
- path.to_string ().c_str (), argv0_ptr));
+ if (be_verbose_global)
+ warning (_f ("Relocation: from PATH=%s\nargv0=%s",
+ path.to_string ().c_str (), argv0_ptr));
#ifndef __MINGW32__
- argv0_abs = path.find (argv0_filename.to_string ());
+ argv0_abs = path.find (argv0_filename.to_string ());
#else /* __MINGW32__ */
- char const *ext[] = {"exe", "", 0 };
- argv0_abs = path.find (argv0_filename.to_string (), ext);
+ char const *ext[] = {"exe", "", 0 };
+ argv0_abs = path.find (argv0_filename.to_string (), ext);
#endif /* __MINGW32__ */
- if (argv0_abs.empty ())
- programming_error ("cannot find absolute argv0");
- }
+ if (argv0_abs.empty ())
+ programming_error ("cannot find absolute argv0");
+ }
- string bindir = dir_name (argv0_abs);
- string argv0_prefix = dir_name (bindir);
- string compile_prefix = dir_name (dir_name (dir_name (prefix_directory)));
- if (argv0_prefix != compile_prefix)
- {
- prefix_relocation (argv0_prefix);
- prefix_directory = argv0_prefix;
- }
- if (argv0_prefix != compile_prefix || string (FRAMEWORKDIR) != "..")
- {
- framework_relocation (bindir + "/" + FRAMEWORKDIR);
- prefix_directory = bindir + "/" + FRAMEWORKDIR;
+ string bindir = dir_name (argv0_abs);
+ string argv0_prefix = dir_name (bindir);
+ string compile_prefix = dir_name (dir_name (dir_name (lilypond_datadir)));
+ if (argv0_prefix != compile_prefix)
+ {
+ prefix_relocation (argv0_prefix);
+ prefix_directory = argv0_prefix;
+ }
+ if (argv0_prefix != compile_prefix || string (FRAMEWORKDIR) != "..")
+ {
+ framework_relocation (bindir + "/" + FRAMEWORKDIR);
+ prefix_directory = bindir + "/" + FRAMEWORKDIR;
+ }
}
+
+ lilypond_datadir = prefix_directory
+ + "/share/lilypond/" TOPLEVEL_VERSION;
}
- /* FIXME: use LILYPOND_DATADIR. */
- if (char const *env = getenv ("LILYPONDPREFIX"))
+ if (getenv ("LILYPONDPREFIX"))
+ error (_ ("LILYPONDPREFIX is obsolete, use LILYPOND_DATADIR"));
+
+ if (char const *env = getenv ("LILYPOND_DATADIR"))
{
#ifdef __MINGW32__
/* Normalize file name. */
- prefix_directory = File_name (env).to_string ();
+ lilypond_datadir = File_name (env).to_string ();
#else
- prefix_directory = env;
+ lilypond_datadir = env;
#endif
}
+ /* When running from build dir, a full LILYPOND_DATADIR is set-up at
+ $(OUTBASE)/{share, lib}/lilypond/current. Configure lily using
+ ./configure --prefix=$(pwd)/out */
+ string build_datadir_current = dir_name (lilypond_datadir) + "/current";
+ if (!is_dir (lilypond_datadir.c_str ())
+ && is_dir (build_datadir_current.c_str ()))
+ lilypond_datadir = build_datadir_current;
+
global_path.append ("");
-
- /*
- When running from build dir, a full LILYPOND_PREFIX is set-up at
-
- $(OUTBASE)/{share, lib}/lilypond/current
-
- */
-
- string build_prefix_current = prefix_directory + "/share/lilypond/" "current";
- string build_prefix_version = prefix_directory + "/share/lilypond/" TOPLEVEL_VERSION;
- if (is_dir (build_prefix_version.c_str ()))
- prefix_directory = build_prefix_version;
- else if (is_dir (build_prefix_current.c_str ()))
- prefix_directory = build_prefix_current;
-
/* Adding mf/out make lilypond unchanged source directory, when setting
LILYPONDPREFIX to lilypond-x.y.z */
char const *suffixes[] = {"ly", "ps", "scm", 0 };
@@ -251,20 +255,18 @@ setup_paths (char const *argv0_ptr)
vector<string> dirs;
for (char const **s = suffixes; *s; s++)
{
- string path = prefix_directory + to_string ('/') + string (*s);
+ string path = lilypond_datadir + to_string ('/') + string (*s);
dirs.push_back (path);
}
- dirs.push_back (prefix_directory + "/fonts/otf/");
- dirs.push_back (prefix_directory + "/fonts/type1/");
- dirs.push_back (prefix_directory + "/fonts/svg/");
+ dirs.push_back (lilypond_datadir + "/fonts/otf/");
+ dirs.push_back (lilypond_datadir + "/fonts/type1/");
+ dirs.push_back (lilypond_datadir + "/fonts/svg/");
for (vsize i = 0; i < dirs.size (); i++)
global_path.prepend (dirs[i]);
}
-
-
string
expand_environment_variables (string orig)
{
@@ -306,7 +308,7 @@ expand_environment_variables (string orig)
{
/*
Hmm. what to do for $1 , $~ etc.?
- */
+ */
do
{
end_var ++;
@@ -336,7 +338,7 @@ expand_environment_variables (string orig)
}
-string
+static string
read_line (FILE *f)
{
string out;
@@ -402,6 +404,6 @@ read_relocation_dir (string dirname)
{
File_name name (ent->d_name);
if (name.ext_ == "reloc")
- read_relocation_file (dirname + "/" + name.to_string ());
+ read_relocation_file (dirname + "/" + name.to_string ());
}
}
diff --git a/make/ly.make b/make/ly.make
index caee2d2245..f9a3f212d4 100644
--- a/make/ly.make
+++ b/make/ly.make
@@ -10,14 +10,14 @@
# Magic: find and include LilyPond's StepMake rules
#
# 0: try local tree
-# 1: follow LILYPONDPREFIX
+# 1: follow LILYPOND_DATADIR
# 2: try source tree in home
# 3: try installed tree in $HOME
# 4: try system installed tree
# 5: try system installed tree
#
make-root=$(wildcard $(depth)/make)
-make-root?=$(wildcard $(LILYPONDPREFIX)/make)
+make-root?=$(wildcard $(LILYPOND_DATADIR)/make)
make-root?=$(wildcard $(HOME)/usr/src/lilypond/make)
make-root?=$(wildcard $(HOME)/usr/share/lilypond/make)
make-root?=$(wildcard /usr/share/lilypond/make)
diff --git a/python/lilylib.py b/python/lilylib.py
index 686993e5d8..156c9b7c8d 100644
--- a/python/lilylib.py
+++ b/python/lilylib.py
@@ -24,14 +24,14 @@ import optparse
# it as we do with teTeX on Red Hat Linux: set some environment var
# (PYTHONPATH) in profile)
-# If set, LILYPONDPREFIX must take prevalence
-# if datadir is not set, we're doing a build and LILYPONDPREFIX
+# If set, LILYPOND_DATADIR must take prevalence
+# if datadir is not set, we're doing a build and LILYPOND_DATADIR
datadir = '@local_lilypond_datadir@'
if not os.path.isdir (datadir):
datadir = '@lilypond_datadir@'
-if os.environ.has_key ('LILYPONDPREFIX') :
- datadir = os.environ['LILYPONDPREFIX']
+if os.environ.has_key ('LILYPOND_DATADIR') :
+ datadir = os.environ['LILYPOND_DATADIR']
while datadir[-1] == os.sep:
datadir= datadir[:-1]
diff --git a/scm/standalone.scm b/scm/standalone.scm
index 5a644d2b3d..8fbf6b1f65 100644
--- a/scm/standalone.scm
+++ b/scm/standalone.scm
@@ -19,8 +19,8 @@
(define (scm-gulp-file name)
(set! %load-path
- (cons (string-append (getenv "LILYPONDPREFIX") "/ly")
- (cons (string-append (getenv "LILYPONDPREFIX") "/ps")
+ (cons (string-append (getenv "LILYPOND_DATADIR") "/ly")
+ (cons (string-append (getenv "LILYPOND_DATADIR") "/ps")
%load-path)))
(let ((path (%search-load-path name)))
(if path
diff --git a/scripts/lilypond-invoke-editor.scm b/scripts/lilypond-invoke-editor.scm
index 275aa901d8..0d8ca9ef52 100755
--- a/scripts/lilypond-invoke-editor.scm
+++ b/scripts/lilypond-invoke-editor.scm
@@ -24,9 +24,9 @@
;; argv0 relocation -- do in wrapper?
-(define LILYPONDPREFIX
+(define LILYPOND_DATADIR
(let* ((prefix
- (or (getenv "LILYPONDPREFIX")
+ (or (getenv "LILYPOND_DATADIR")
(dirname (dirname (car (command-line)))))))
@@ -150,7 +150,7 @@ Options:
(begin
(show-help (current-error-port))
(exit 2)))
- (set! %load-path (cons LILYPONDPREFIX %load-path))
+ (set! %load-path (cons LILYPOND_DATADIR %load-path))
(primitive-eval '(use-modules (scm editor)))