From 813c5f0af9d1dac32b156ef3c72b890a7cf9eab5 Mon Sep 17 00:00:00 2001 From: Paul Davis Date: Fri, 18 May 2012 17:24:06 +0000 Subject: major rationalization of use of search paths. ardour now has just 4 functions used to define how external resources are located: ardour_config_search_path() (for system or user specific configuration data), ardour_data_search_path() (for machine, user and system independent data), ardour_dll_directory() (base directory where shared libraries are found) and user_config_directory(). These are now used throughout the code. the config, data and dll paths/directories can be overridden by environment variables. the user config dir is added as the first element of the first two search paths, and use selectively when searching for a few other things. This commit re-enabes ./waf install, and it is believed that it works fully at this point (more testing likely required) git-svn-id: svn://localhost/ardour2/branches/3.0@12326 d708f5d6-7413-0410-9779-e7cbd77b26cf --- gtk2_ardour/about.cc | 2 +- gtk2_ardour/actions.cc | 4 +--- gtk2_ardour/ardev_common.sh.in | 15 +++++++++++++++ gtk2_ardour/ardour.sh.in | 17 ++++++++++++++--- gtk2_ardour/editor_actions.cc | 5 ++--- gtk2_ardour/keyboard.cc | 4 +--- gtk2_ardour/mixer_actor.cc | 5 ++--- gtk2_ardour/splash.cc | 2 +- gtk2_ardour/step_entry.cc | 3 +-- gtk2_ardour/theme_manager.cc | 8 ++------ gtk2_ardour/ui_config.cc | 9 +++------ gtk2_ardour/utils.cc | 8 +++----- gtk2_ardour/wscript | 8 +++----- 13 files changed, 49 insertions(+), 41 deletions(-) (limited to 'gtk2_ardour') diff --git a/gtk2_ardour/about.cc b/gtk2_ardour/about.cc index a66a4a2f69..5ecc075c30 100644 --- a/gtk2_ardour/about.cc +++ b/gtk2_ardour/about.cc @@ -559,7 +559,7 @@ About::About () sys::path splash_file; - SearchPath spath(ardour_search_path() + system_data_search_path()); + SearchPath spath(ardour_data_search_path()); if (find_file_in_search_path (spath, "splash.png", splash_file)) { set_logo (Gdk::Pixbuf::create_from_file (splash_file.to_string())); diff --git a/gtk2_ardour/actions.cc b/gtk2_ardour/actions.cc index e9252bcbff..a1bdcdb36e 100644 --- a/gtk2_ardour/actions.cc +++ b/gtk2_ardour/actions.cc @@ -72,9 +72,7 @@ ActionManager::init () ui_manager = UIManager::create (); - SearchPath spath = ardour_search_path() + user_config_directory() + system_config_search_path(); - - find_file_in_search_path (spath, "ardour.menus", ui_file); + find_file_in_search_path (ardour_config_search_path(), "ardour.menus", ui_file); bool loaded = false; diff --git a/gtk2_ardour/ardev_common.sh.in b/gtk2_ardour/ardev_common.sh.in index d8bdeb430d..0b0fc1b7dc 100644 --- a/gtk2_ardour/ardev_common.sh.in +++ b/gtk2_ardour/ardev_common.sh.in @@ -4,6 +4,13 @@ TOP=`dirname "$0"`/.. libs=$TOP/@LIBS@ +# +# when running ardev, the various parts of Ardour have not been consolidated into the locations that they +# would normally end up after an install. We therefore need to set up environment variables so that we +# can find all the components. +# + + export ARDOUR_PATH=$TOP/gtk2_ardour/icons:$TOP/gtk2_ardour/pixmaps:$TOP/build/gtk2_ardour:$TOP/gtk2_ardour:. export ARDOUR_SURFACES_PATH=$libs/surfaces/osc:$libs/surfaces/generic_midi:$libs/surfaces/tranzport:$libs/surfaces/powermate:$libs/surfaces/mackie export ARDOUR_PANNER_PATH=$libs/panners/2in2out:$libs/panners/1in2out:$libs/panners/vbap @@ -11,6 +18,14 @@ export ARDOUR_DATA_PATH=$TOP/gtk2_ardour:build/gtk2_ardour:. export ARDOUR_MIDIMAPS_PATH=$TOP/midi_maps:. export ARDOUR_MCP_PATH=$TOP/mcp:. +# +# even though we set the above variables, ardour requires that these +# two also be set. the above settings will override them. +# + +export ARDOUR_CONFIG_PATH=$TOP:$TOP/gtk2_ardour:../build:../build/gtk2_ardour +export ARDOUR_DLL_PATH=$libs + if test -d $HOME/gtk/inst ; then export GTK_PATH=~/.ardour3:$libs/clearlooks-newer else diff --git a/gtk2_ardour/ardour.sh.in b/gtk2_ardour/ardour.sh.in index d7297fd77c..45fdb6f55e 100644 --- a/gtk2_ardour/ardour.sh.in +++ b/gtk2_ardour/ardour.sh.in @@ -1,10 +1,13 @@ #!/bin/sh -export GTK_PATH=@LIBDIR@/ardour3${GTK_PATH:+:$GTK_PATH} +# +# This script runs an installed version of Ardour. It sets a few environment variables +# and does a few checks before exec'ing the real executable. +# + +export GTK_PATH=@SYSCONFDIR@/ardour3${GTK_PATH:+:$GTK_PATH} export LD_LIBRARY_PATH=@LIBDIR@/ardour3${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH} -# DYLD_LIBRARY_PATH is for Darwin -export DYLD_LIBRARY_PATH=$LD_LIBRARY_PATH ## Memlock check @@ -36,6 +39,14 @@ elif [ $(nm -D --radix=dec --defined-only -S $GLIB | grep -w g_atomic_int_add | echo "" fi +# +# Running Ardour requires these 3 variables to be set +# + +export ARDOUR_DATA_PATH=@DATADIR@/ardour3 +export ARDOUR_CONFIG_PATH=@SYSCONFDIR@/ardour3 +export ARDOUR_DLL_PATH=@LIBDIR@/ardour3 + exec @LIBDIR@/ardour3/ardour-@VERSION@ "$@" diff --git a/gtk2_ardour/editor_actions.cc b/gtk2_ardour/editor_actions.cc index ac7af6494a..e544f7d8c3 100644 --- a/gtk2_ardour/editor_actions.cc +++ b/gtk2_ardour/editor_actions.cc @@ -643,13 +643,12 @@ Editor::load_bindings () key_bindings.set_action_map (editor_action_map); sys::path binding_file; - SearchPath spath = ardour_search_path() + user_config_directory() + system_config_search_path(); - if (find_file_in_search_path (spath, "editor.bindings", binding_file)) { + if (find_file_in_search_path (ardour_config_search_path(), "editor.bindings", binding_file)) { key_bindings.load (binding_file.to_string()); info << string_compose (_("Loaded editor bindings from %1"), binding_file.to_string()) << endmsg; } else { - error << string_compose (_("Could not find editor.bindings in search path %1"), spath.to_string()) << endmsg; + error << string_compose (_("Could not find editor.bindings in search path %1"), ardour_config_search_path().to_string()) << endmsg; } } diff --git a/gtk2_ardour/keyboard.cc b/gtk2_ardour/keyboard.cc index 41e6a08814..2fbd5812ad 100644 --- a/gtk2_ardour/keyboard.cc +++ b/gtk2_ardour/keyboard.cc @@ -126,9 +126,7 @@ ArdourKeyboard::setup_keybindings () /* not absolute - look in the usual places */ sys::path keybindings_file; - SearchPath spath = ardour_search_path() + user_config_directory() + system_config_search_path(); - - if ( ! find_file_in_search_path (spath, keybindings_path, keybindings_file)) { + if ( ! find_file_in_search_path (ardour_config_search_path(), keybindings_path, keybindings_file)) { if (keybindings_path == default_bindings) { error << string_compose (_("Default keybindings not found - %1 will be hard to use!"), PROGRAM_NAME) << endmsg; diff --git a/gtk2_ardour/mixer_actor.cc b/gtk2_ardour/mixer_actor.cc index b309b9fd7f..437da39bab 100644 --- a/gtk2_ardour/mixer_actor.cc +++ b/gtk2_ardour/mixer_actor.cc @@ -83,13 +83,12 @@ MixerActor::load_bindings () bindings.set_action_map (myactions); sys::path binding_file; - SearchPath spath = ardour_search_path() + user_config_directory() + system_config_search_path(); - if (find_file_in_search_path (spath, "mixer.bindings", binding_file)) { + if (find_file_in_search_path (ardour_config_search_path(), "mixer.bindings", binding_file)) { bindings.load (binding_file.to_string()); info << string_compose (_("Loaded mixer bindings from %1"), binding_file.to_string()) << endmsg; } else { - error << string_compose (_("Could not find mixer.bindings in search path %1"), spath.to_string()) << endmsg; + error << string_compose (_("Could not find mixer.bindings in search path %1"), ardour_config_search_path().to_string()) << endmsg; } } diff --git a/gtk2_ardour/splash.cc b/gtk2_ardour/splash.cc index 8d6e84bae2..f91ae89e69 100644 --- a/gtk2_ardour/splash.cc +++ b/gtk2_ardour/splash.cc @@ -22,7 +22,7 @@ Splash::Splash () { sys::path splash_file; - if (!find_file_in_search_path (ardour_search_path() + system_data_search_path(), "splash.png", splash_file)) { + if (!find_file_in_search_path (ardour_data_search_path(), "splash.png", splash_file)) { throw failed_constructor(); } diff --git a/gtk2_ardour/step_entry.cc b/gtk2_ardour/step_entry.cc index 61bdeacae0..8e8bd3a3fa 100644 --- a/gtk2_ardour/step_entry.cc +++ b/gtk2_ardour/step_entry.cc @@ -709,9 +709,8 @@ StepEntry::load_bindings () bindings.set_action_map (myactions); sys::path binding_file; - SearchPath spath = ardour_search_path() + user_config_directory() + system_config_search_path(); - if (find_file_in_search_path (spath, "step_editing.bindings", binding_file)) { + if (find_file_in_search_path (ardour_config_search_path(), "step_editing.bindings", binding_file)) { bindings.load (binding_file.to_string()); } } diff --git a/gtk2_ardour/theme_manager.cc b/gtk2_ardour/theme_manager.cc index 887ca5453c..a3ee38e629 100644 --- a/gtk2_ardour/theme_manager.cc +++ b/gtk2_ardour/theme_manager.cc @@ -202,13 +202,9 @@ load_rc_file (const string& filename, bool themechange) { sys::path rc_file_path; - SearchPath spath (ardour_search_path()); - spath += user_config_directory(); - spath += system_config_search_path(); - - if (!find_file_in_search_path (spath, filename, rc_file_path)) { + if (!find_file_in_search_path (ardour_config_search_path(), filename, rc_file_path)) { warning << string_compose (_("Unable to find UI style file %1 in search path %2. %3 will look strange"), - filename, spath.to_string(), PROGRAM_NAME) + filename, ardour_config_search_path().to_string(), PROGRAM_NAME) << endmsg; return; } diff --git a/gtk2_ardour/ui_config.cc b/gtk2_ardour/ui_config.cc index 17ba896f1f..0d41ade0a5 100644 --- a/gtk2_ardour/ui_config.cc +++ b/gtk2_ardour/ui_config.cc @@ -75,8 +75,7 @@ UIConfiguration::load_defaults () rcfile = "ardour3_ui_default.conf"; } - if (find_file_in_search_path (ardour_search_path() + system_config_search_path(), - rcfile, default_ui_rc_file) ) { + if (find_file_in_search_path (ardour_config_search_path(), rcfile, default_ui_rc_file) ) { XMLTree tree; found = 1; @@ -107,8 +106,7 @@ UIConfiguration::load_state () sys::path default_ui_rc_file; - if ( find_file_in_search_path (ardour_search_path() + system_config_search_path(), - "ardour3_ui_default.conf", default_ui_rc_file) ) { + if ( find_file_in_search_path (ardour_config_search_path(), "ardour3_ui_default.conf", default_ui_rc_file)) { XMLTree tree; found = true; @@ -129,8 +127,7 @@ UIConfiguration::load_state () sys::path user_ui_rc_file; - if (find_file_in_search_path (ardour_search_path() + user_config_directory(), - "ardour3_ui.conf", user_ui_rc_file)) { + if (find_file_in_search_path (ardour_config_search_path(), "ardour3_ui.conf", user_ui_rc_file)) { XMLTree tree; found = true; diff --git a/gtk2_ardour/utils.cc b/gtk2_ardour/utils.cc index d061fce35f..988bd370ae 100644 --- a/gtk2_ardour/utils.cc +++ b/gtk2_ardour/utils.cc @@ -494,8 +494,7 @@ get_xpm (std::string name) { if (!xpm_map[name]) { - SearchPath spath(ARDOUR::ardour_search_path()); - spath += ARDOUR::system_data_search_path(); + SearchPath spath(ARDOUR::ardour_data_search_path()); spath.add_subdirectory_to_paths("pixmaps"); @@ -521,15 +520,14 @@ get_icon_path (const char* cname) string name = cname; name += X_(".png"); - SearchPath spath(ARDOUR::ardour_search_path()); - spath += ARDOUR::system_data_search_path(); + SearchPath spath(ARDOUR::ardour_data_search_path()); spath.add_subdirectory_to_paths("icons"); sys::path data_file_path; if (!find_file_in_search_path (spath, name, data_file_path)) { - fatal << string_compose (_("cannot find icon image for %1"), name) << endmsg; + fatal << string_compose (_("cannot find icon image for %1 using %2"), name, spath.to_string()) << endmsg; } return data_file_path.to_string(); diff --git a/gtk2_ardour/wscript b/gtk2_ardour/wscript index 338a585dca..e1fccbd328 100644 --- a/gtk2_ardour/wscript +++ b/gtk2_ardour/wscript @@ -405,9 +405,7 @@ def build(bld): 'VERSIONSTRING="' + bld.env['VERSION'] + '"', 'DATA_DIR="' + os.path.normpath(bld.env['DATADIR']) + '"', 'CONFIG_DIR="' + os.path.normpath(bld.env['SYSCONFDIR']) + '"', - 'MODULE_DIR="' + os.path.normpath(bld.env['LIBDIR']) + '"', - 'LOCALEDIR="' + os.path.join(os.path.normpath(bld.env['DATADIR']), - 'locale') + '"', + 'LOCALEDIR="' + os.path.join(os.path.normpath(bld.env['DATADIR']), 'locale') + '"', 'PROGRAM_NAME="' + bld.env['PROGRAM_NAME'] + '"' ] obj.includes += ['../libs'] @@ -449,6 +447,8 @@ def build(bld): wrapper_subst_dict = { 'INSTALL_PREFIX' : bld.env['PREFIX'], 'LIBDIR' : os.path.normpath(bld.env['LIBDIR']), + 'DATADIR' : os.path.normpath(bld.env['DATADIR']), + 'SYSCONFDIR' : os.path.normpath(bld.env['SYSCONFDIR']), 'LIBS' : 'build/libs', 'VERSION' : '3.0', 'EXECUTABLE' : 'build/gtk2_ardour/ardour-3.0' @@ -644,8 +644,6 @@ def build(bld): # Default UI configuration bld.install_files('${SYSCONFDIR}/ardour3', 'ardour3_ui_default.conf') - # Generic widget style mappings - bld.install_files('${SYSCONFDIR}/ardour3', 'ardour3_widgets.rc') # Default export stuff bld.install_files('${SYSCONFDIR}/ardour3/export', bld.path.ant_glob('export/*.format')) -- cgit v1.2.3