/*
This file is part of LilyPond, the GNU music typesetter.
- Copyright (C) 2005--2011 Han-Wen Nienhuys <hanwen@xs4all.nl>
+ Copyright (C) 2005--2012 Han-Wen Nienhuys <hanwen@xs4all.nl>
LilyPond is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
string combine = string (key) + "=" + value;
char *s = strdup (combine.c_str ());
- if (be_verbose_global)
- progress_indication (_f ("Setting %s to %s", key, value.c_str ())
- + "\n");
+ debug_output (_f ("Setting %s to %s", key, value.c_str ())
+ + "\n");
int retval = putenv (s);
/*
{
if (is_file (value))
return sane_putenv (key, value, overwrite);
- else if (be_verbose_global)
+ else if (is_loglevel (LOG_DEBUG))
+ // this warning should only be printed in debug mode!
warning (_f ("no such file: %s for %s", value, key));
return -1;
}
{
if (is_dir (value))
return sane_putenv (key, value, false);
- else if (be_verbose_global)
+ else if (is_loglevel (LOG_DEBUG))
+ // this warning should only be printed in debug mode!
warning (_f ("no such directory: %s for %s", value, key));
return -1;
}
{
if (is_dir (value))
{
- if (be_verbose_global)
- progress_indication (_f ("%s=%s (prepend)\n", key, value.c_str ()));
+ debug_output (_f ("%s=%s (prepend)\n", key, value.c_str ()), false);
if (char const *cur = getenv (key))
value += to_string (PATHSEP) + cur;
return sane_putenv (key, value.c_str (), true);
}
- else if (be_verbose_global)
+ else if (is_loglevel (LOG_DEBUG))
+ // this warning should only be printed in debug mode
warning (_f ("no such directory: %s for %s", value, key));
return -1;
}
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 ()));
+ debug_output (_f ("Relocation: compile datadir=%s, new datadir=%s",
+ old_lilypond_datadir.c_str (),
+ lilypond_datadir.c_str ()));
}
/*
static void
framework_relocation (string prefix)
{
- if (be_verbose_global)
- warning (_f ("Relocation: framework_prefix=%s", prefix));
+ debug_output (_f ("Relocation: framework_prefix=%s", prefix));
sane_putenv ("INSTALLER_PREFIX", prefix, true);
if (relocate_binary)
{
string prefix_directory;
- if (getenv ("LILYPOND_RELOCATE_PREFIX"))
+ string argv0_abs;
+ if (argv0_filename.is_absolute ())
{
- prefix_directory = getenv ("LILYPOND_RELOCATE_PREFIX");
-#ifdef __MINGW32__
- /* 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);
+ argv0_abs = argv0_filename.to_string ();
+ debug_output (_f ("Relocation: is absolute: argv0=%s\n", argv0_ptr));
}
- else if (relocate_binary)
+ else if (argv0_filename.dir_.length ())
{
- 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"));
+ argv0_abs = get_working_directory ()
+ + "/" + string (argv0_filename.to_string ());
+ debug_output (_f ("Relocation : from cwd: argv0=%s\n", argv0_ptr));
+ }
+ else
+ {
+ /* Find absolute ARGV0 name, using PATH. */
+ File_path path;
+ path.parse_path (getenv ("PATH"));
#ifndef __MINGW32__
- argv0_abs = path.find (argv0_filename.to_string ());
+ argv0_abs = path.find (argv0_filename.to_string ());
#else /* __MINGW32__ */
- path.prepend (get_working_directory ());
- char const *ext[] = {"exe", "", 0 };
- argv0_abs = path.find (argv0_filename.to_string (), ext);
+ path.prepend (get_working_directory ());
+ char const *ext[] = {"exe", "", 0 };
+ argv0_abs = path.find (argv0_filename.to_string (), ext);
#endif /* __MINGW32__ */
- if (be_verbose_global)
- warning (_f ("Relocation: from PATH=%s\nargv0=%s",
- path.to_string ().c_str (), argv0_ptr));
+ debug_output (_f ("Relocation: from PATH=%s\nargv0=%s\n",
+ path.to_string ().c_str (), argv0_ptr), true);
- 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 (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;
- }
+ 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
void
read_relocation_file (string filename)
{
- if (be_verbose_global)
- progress_indication (_f ("Relocation file: %s", filename.c_str ())
- + "\n");
-
+ debug_output (_f ("Relocation file: %s", filename.c_str ()) + "\n");
char const *cname = filename.c_str ();
FILE *f = fopen (cname, "r");
if (!f)