You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@lucy.apache.org by nw...@apache.org on 2016/01/26 13:38:51 UTC

lucy git commit: Regenerate charmonizer.c to fix OS detection

Repository: lucy
Updated Branches:
  refs/heads/master 6e490904e -> da05df9c7


Regenerate charmonizer.c to fix OS detection


Project: http://git-wip-us.apache.org/repos/asf/lucy/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy/commit/da05df9c
Tree: http://git-wip-us.apache.org/repos/asf/lucy/tree/da05df9c
Diff: http://git-wip-us.apache.org/repos/asf/lucy/diff/da05df9c

Branch: refs/heads/master
Commit: da05df9c7b0036ebaecea417bb3ad30c3d4c1de5
Parents: 6e49090
Author: Nick Wellnhofer <we...@aevum.de>
Authored: Tue Jan 26 13:23:58 2016 +0100
Committer: Nick Wellnhofer <we...@aevum.de>
Committed: Tue Jan 26 13:23:58 2016 +0100

----------------------------------------------------------------------
 common/charmonizer.c | 43 ++++++++++++++++++++++++++++---------------
 1 file changed, 28 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucy/blob/da05df9c/common/charmonizer.c
----------------------------------------------------------------------
diff --git a/common/charmonizer.c b/common/charmonizer.c
index f0ebfcd..d2ba280 100644
--- a/common/charmonizer.c
+++ b/common/charmonizer.c
@@ -784,7 +784,7 @@ chaz_MakeFile_add_lemon_grammar(chaz_MakeFile *makefile,
  * @param obj The object file.
  * @param cflags Compiler flags.
  */
-void
+chaz_MakeRule*
 chaz_MakeFile_override_cflags(chaz_MakeFile *makefile, const char *obj,
                               chaz_CFlags *cflags);
 
@@ -2788,6 +2788,7 @@ chaz_CC_compile_exe(const char *source_path, const char *exe_name,
         chaz_OS_run_quietly(command);
     }
     else {
+        printf("%s\n", command);
         system(command);
     }
 
@@ -2846,6 +2847,7 @@ chaz_CC_compile_obj(const char *source_path, const char *obj_name,
         chaz_OS_run_quietly(command);
     }
     else {
+        printf("%s\n", command);
         system(command);
     }
 
@@ -4881,7 +4883,7 @@ chaz_MakeFile_add_lemon_grammar(chaz_MakeFile *makefile,
     return rule;
 }
 
-void
+chaz_MakeRule*
 chaz_MakeFile_override_cflags(chaz_MakeFile *makefile, const char *obj,
                               chaz_CFlags *cflags) {
     const char *obj_ext       = chaz_CC_obj_ext();
@@ -4920,6 +4922,8 @@ chaz_MakeFile_override_cflags(chaz_MakeFile *makefile, const char *obj,
 
     free(command);
     free(src);
+
+    return rule;
 }
 
 void
@@ -5087,7 +5091,10 @@ chaz_MakeRule_add_command_with_libpath(chaz_MakeRule *rule,
         path = chaz_Util_vjoin(";", args);
         va_end(args);
 
-        lib_command = chaz_Util_join("", "path ", path, ";%path% && ", command,
+        /* It's important to not add a space before `&&`. Otherwise, the
+	 * space is added to the search path.
+	 */
+        lib_command = chaz_Util_join("", "path ", path, ";%path%&& ", command,
                                      NULL);
     }
     else {
@@ -5300,8 +5307,20 @@ chaz_OS_init(void) {
         printf("Trying to find a bit-bucket a la /dev/null...\n");
     }
 
-    /* Detect shell based on whether the bitbucket is "/dev/null" or "nul". */
-    if (chaz_Util_can_open_file("/dev/null")) {
+    /* Detect shell based on whether the bitbucket is "/dev/null" or "nul".
+     * Start with "nul" as some Windows boxes seem to have a "/dev/null".
+     */
+    if (chaz_Util_can_open_file("nul")) {
+        strcpy(chaz_OS.name, "windows");
+        strcpy(chaz_OS.dev_null, "nul");
+        strcpy(chaz_OS.dir_sep, "\\");
+        strcpy(chaz_OS.exe_ext, ".exe");
+        strcpy(chaz_OS.shared_lib_ext, ".dll");
+        strcpy(chaz_OS.static_lib_ext, ".lib");
+        strcpy(chaz_OS.local_command_start, ".\\");
+        chaz_OS.shell_type = CHAZ_OS_CMD_EXE;
+    }
+    else if (chaz_Util_can_open_file("/dev/null")) {
         char   *uname;
         size_t  uname_len;
         size_t i;
@@ -5334,20 +5353,14 @@ chaz_OS_init(void) {
         }
         strcpy(chaz_OS.local_command_start, "./");
     }
-    else if (chaz_Util_can_open_file("nul")) {
-        strcpy(chaz_OS.name, "windows");
-        strcpy(chaz_OS.dev_null, "nul");
-        strcpy(chaz_OS.dir_sep, "\\");
-        strcpy(chaz_OS.exe_ext, ".exe");
-        strcpy(chaz_OS.shared_lib_ext, ".dll");
-        strcpy(chaz_OS.static_lib_ext, ".lib");
-        strcpy(chaz_OS.local_command_start, ".\\");
-        chaz_OS.shell_type = CHAZ_OS_CMD_EXE;
-    }
     else {
         /* Bail out because we couldn't find anything like /dev/null. */
         chaz_Util_die("Couldn't find anything like /dev/null");
     }
+
+    if (chaz_Util_verbosity) {
+        printf("Detected OS: %s\n", chaz_OS.name);
+    }
 }
 
 const char*