]> git.lyx.org Git - lyx.git/blobdiff - src/support/package.C.in
hopefully fix tex2lyx linking.
[lyx.git] / src / support / package.C.in
index e036dcb871827accc8c69c7a9b9c60eea8ca6e45..f666e6eceb9a3852e011f4004704bda9b7e2b347 100644 (file)
@@ -111,6 +111,9 @@ std::pair<string, bool> const
 get_user_support_dir(string const & default_user_support_dir,
                     string const & command_line_user_support_dir);
 
+
+string const & with_version_suffix();
+
 } // namespace anon
 
 
@@ -144,6 +147,10 @@ Package::Package(string const & command_line_arg0,
                get_user_support_dir(default_user_support_dir,
                                     command_line_user_support_dir);
 
+       string const configure_script = addName(system_support(), "configure.py");
+       configure_command_ = os::python() + ' ' + quoteName(configure_script)
+                                      + with_version_suffix();
+
        lyxerr[Debug::INIT]
                << "<package>\n"
                << "\tbinary_dir " << binary_dir() << '\n'
@@ -180,6 +187,15 @@ string const hardcoded_system_support_dir()
        return string("%LYX_DIR%");
 }
 
+
+string const & with_version_suffix()
+{
+       static string const program_suffix("%PROGRAM_SUFFIX%");
+       static string const
+               with_version_suffix(" --with-version-suffix=%PROGRAM_SUFFIX%");
+       return program_suffix.empty() ? program_suffix : with_version_suffix;
+}
+
 } // namespace anon
 
 
@@ -234,10 +250,10 @@ get_build_dirs(string const & abs_binary,
 {
        string const check_text = "Checking whether LyX is run in place...";
 
-       // We're looking for "lyxrc.defaults" in a directory
+       // We're looking for "Makefile" in a directory
        //   binary_dir/../lib
        // We're also looking for "chkconfig.ltx" in a directory
-       //   binary_dir/top_srcdir()/lib
+       //   top_srcdir()/lib
        // If both are found, then we're running LyX in-place.
 
        // Note that the name of the lyx binary may be a symbolic link.
@@ -249,11 +265,10 @@ get_build_dirs(string const & abs_binary,
                string const build_support_dir =
                        get_build_support_dir(binary_dir, top_build_dir_location);
 
-               if (!fileSearch(build_support_dir, "lyxrc.defaults").empty()) {
+               if (!fileSearch(build_support_dir, "Makefile").empty()) {
                        // Try and find "chkconfig.ltx".
                        string const system_support_dir =
-                               makeAbsPath(addPath(top_srcdir(), "lib"),
-                                           addPath(binary_dir, "support"));
+                               addPath(top_srcdir(), "lib");
 
                        if (!fileSearch(system_support_dir, "chkconfig.ltx").empty()) {
                                lyxerr[Debug::INIT] << check_text << " yes"
@@ -342,8 +357,8 @@ string const get_temp_dir()
 {
 #if defined (USE_WINDOWS_PACKAGING)
        // Typical example: C:/TEMP/.
-       char path[PATH_MAX];
-       GetTempPath(PATH_MAX, path);
+       char path[MAX_PATH];
+       GetTempPath(MAX_PATH, path);
        return os::internal_path(path);
 #else // Posix-like.
        return "/tmp";
@@ -421,9 +436,10 @@ string const abs_path_from_binary_name(string const & exe)
 {
        string const abs_binary = get_binary_path(exe);
        if (abs_binary.empty()) {
-               lyxerr << bformat(_("Unable to determine the path to the "
-                                   "LyX binary from the command line %1$s"),
-                                 exe)
+               // FIXME UNICODE
+               lyxerr << lyx::to_utf8(bformat(_("Unable to determine the path to the "
+                                                "LyX binary from the command line %1$s"),
+                                                lyx::from_utf8(exe)))
                       << std::endl;
                bail_out();
        }
@@ -542,14 +558,15 @@ get_system_support_dir(string const & abs_binary,
                searched_dirs_str += *it;
        }
 
-       lyxerr << bformat(_("Unable to determine the system directory "
-                           "having searched\n"
-                           "\t%1$s\n"
-                           "Use the '-sysdir' command line parameter or "
-                           "set the environment variable LYX_DIR_14x to "
-                           "the LyX system directory containing the file "
-                           "`chkconfig.ltx'."),
-                         searched_dirs_str)
+       // FIXME UNICODE
+       lyxerr << lyx::to_utf8(bformat(_("Unable to determine the system directory "
+                                        "having searched\n"
+                                        "\t%1$s\n"
+                                        "Use the '-sysdir' command line parameter or "
+                                        "set the environment variable LYX_DIR_14x to "
+                                        "the LyX system directory containing the file "
+                                        "`chkconfig.ltx'."),
+                         lyx::from_utf8(searched_dirs_str)))
               << std::endl;
 
        bail_out();
@@ -627,9 +644,11 @@ bool check_command_line_dir(string const & dir,
 {
        string const abs_path = fileSearch(dir, file);
        if (abs_path.empty()) {
-               lyxerr << bformat(_("Invalid %1$s switch.\n"
-                                   "Directory %2$s does not contain %3$s."),
-                                 command_line_switch, dir, file)
+               // FIXME UNICODE
+               lyxerr << lyx::to_utf8(bformat(_("Invalid %1$s switch.\n"
+                                                "Directory %2$s does not contain %3$s."),
+                                 lyx::from_utf8(command_line_switch), lyx::from_utf8(dir),
+                                 lyx::from_utf8(file)))
                       << std::endl;
        }
 
@@ -653,9 +672,10 @@ bool check_env_var_dir(string const & dir,
 {
        string const abs_path = fileSearch(dir, file);
        if (abs_path.empty()) {
-               lyxerr << bformat(_("Invalid %1$s environment variable.\n"
-                                   "Directory %2$s does not contain %3$s."),
-                                 env_var, dir, file)
+               // FIXME UNICODE
+               lyxerr << lyx::to_utf8(bformat(_("Invalid %1$s environment variable.\n"
+                                                "Directory %2$s does not contain %3$s."),
+                                 lyx::from_utf8(env_var), lyx::from_utf8(dir), lyx::from_utf8(file)))
                       << std::endl;
        }
 
@@ -675,10 +695,11 @@ bool check_env_var_dir(string const & dir,
                // search mechanism in po/Makefile.in.in will register
                // package.C.in as a file containing strings that need
                // translation.
-               string const fmt =
-               _("Invalid %1$s environment variable.\n%2$s is not a directory.");
+               // FIXME UNICODE
+               docstring const fmt =
+                       _("Invalid %1$s environment variable.\n%2$s is not a directory.");
 
-               lyxerr << bformat(fmt, env_var, dir)
+               lyxerr << lyx::to_utf8(bformat(fmt, lyx::from_utf8(env_var), lyx::from_utf8(dir)))
                       << std::endl;
        }
 
@@ -689,7 +710,11 @@ bool check_env_var_dir(string const & dir,
 // The locale directory relative to the LyX system directory.
 string const relative_locale_dir()
 {
+#if defined (USE_WINDOWS_PACKAGING) || defined (USE_MACOSX_PACKAGING)
+       return "locale/";
+#else
        return "../locale/";
+#endif
 }