+#else
+
+void
+fixup_bundle_environment (int /*argc*/, char* argv[])
+{
+ /* THIS IS FOR LINUX - its just about the only place where its
+ * acceptable to build paths directly using '/'.
+ */
+
+ if (!getenv ("ARDOUR_BUNDLED")) {
+ return;
+ }
+
+ EnvironmentalProtectionAgency::set_global_epa (new EnvironmentalProtectionAgency (true, "PREBUNDLE_ENV"));
+
+ Glib::ustring dir_path = Glib::path_get_dirname (Glib::path_get_dirname (argv[0]));
+ Glib::ustring path;
+ Glib::ustring userconfigdir = user_config_directory().to_string();
+
+ /* note that this function is POSIX/Linux specific, so using / as
+ a dir separator in this context is just fine.
+ */
+
+ export_search_path (dir_path, "ARDOUR_DLL_PATH", "/lib");
+ export_search_path (dir_path, "ARDOUR_CONFIG_PATH", "/etc");
+ export_search_path (dir_path, "ARDOUR_INSTANT_XML_PATH", "/share");
+ export_search_path (dir_path, "ARDOUR_DATA_PATH", "/share");
+
+ export_search_path (dir_path, "LADSPA_PATH", "/../plugins");
+ export_search_path (dir_path, "VAMP_PATH", "/lib");
+ export_search_path (dir_path, "SUIL_MODULE_DIR", "/lib");
+
+ path = dir_path;
+ path += "/lib/clearlooks";
+ setenv ("GTK_PATH", path.c_str(), 1);
+
+ /* unset GTK_RC_FILES so that we only load the RC files that we define
+ */
+
+ unsetenv ("GTK_RC_FILES");
+
+ if (!ARDOUR::translations_are_disabled ()) {
+ path = dir_path;
+ path += "/share/locale";
+
+ localedir = strdup (path.c_str());
+ setenv ("GTK_LOCALEDIR", localedir, 1);
+ }
+
+ /* Tell fontconfig where to find fonts.conf. Use the system version
+ if it exists, otherwise use the stuff we included in the bundle
+ */
+
+ if (Glib::file_test ("/etc/fonts/fonts.conf", Glib::FILE_TEST_EXISTS)) {
+ setenv ("FONTCONFIG_FILE", "/etc/fonts/fonts.conf", 1);
+ setenv ("FONTCONFIG_PATH", "/etc/fonts", 1);
+ } else {
+ /* use the one included in the bundle */
+
+ path = Glib::build_filename (dir_path, "etc/fonts/fonts.conf");
+ setenv ("FONTCONFIG_FILE", path.c_str(), 1);
+ path = Glib::build_filename (dir_path, "etc/fonts");
+ setenv ("FONTCONFIG_PATH", "/etc/fonts", 1);
+ }
+
+ /* write a pango.rc file and tell pango to use it. we'd love
+ to put this into the Ardour.app bundle and leave it there,
+ but the user may not have write permission. so ...
+
+ we also have to make sure that the user ardour directory
+ actually exists ...
+ */
+
+ if (g_mkdir_with_parents (userconfigdir.c_str(), 0755) < 0) {
+ error << string_compose (_("cannot create user ardour folder %1 (%2)"), userconfigdir, strerror (errno))
+ << endmsg;
+ return;
+ }
+
+ Glib::ustring mpath;
+
+ path = Glib::build_filename (userconfigdir, "pango.rc");
+
+ std::ofstream pangorc (path.c_str());
+ if (!pangorc) {
+ error << string_compose (_("cannot open pango.rc file %1") , path) << endmsg;
+ } else {
+ mpath = Glib::build_filename (userconfigdir, "pango.modules");
+
+ pangorc << "[Pango]\nModuleFiles=";
+ pangorc << mpath << endl;
+ pangorc.close ();
+ }
+
+ setenv ("PANGO_RC_FILE", path.c_str(), 1);
+
+ /* similar for GDK pixbuf loaders, but there's no RC file required
+ to specify where it lives.
+ */
+
+ mpath = Glib::build_filename (userconfigdir, "gdk-pixbuf.loaders");
+ setenv ("GDK_PIXBUF_MODULE_FILE", mpath.c_str(), 1);
+}
+