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 2013/05/05 00:01:43 UTC
[lucy-commits] [1/5] git commit: refs/heads/master - Move obj_ext to chaz_CC
Updated Branches:
refs/heads/master 271bd85dd -> 75626953e
Move obj_ext to chaz_CC
It depends on the compiler not the OS.
Project: http://git-wip-us.apache.org/repos/asf/lucy/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy/commit/598a5ce5
Tree: http://git-wip-us.apache.org/repos/asf/lucy/tree/598a5ce5
Diff: http://git-wip-us.apache.org/repos/asf/lucy/diff/598a5ce5
Branch: refs/heads/master
Commit: 598a5ce501a35c0b3f0ccaf49e36e8e6d914593b
Parents: 271bd85
Author: Nick Wellnhofer <we...@aevum.de>
Authored: Sat May 4 21:39:19 2013 +0200
Committer: Nick Wellnhofer <we...@aevum.de>
Committed: Sat May 4 22:47:25 2013 +0200
----------------------------------------------------------------------
charmonizer/src/Charmonizer/Core/Compiler.c | 27 +++++++++-----
charmonizer/src/Charmonizer/Core/Compiler.h | 5 +++
charmonizer/src/Charmonizer/Core/OperatingSystem.c | 10 +-----
charmonizer/src/Charmonizer/Core/OperatingSystem.h | 5 ---
clownfish/compiler/common/charmonizer.main | 2 +-
common/charmonizer.main | 2 +-
6 files changed, 25 insertions(+), 26 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucy/blob/598a5ce5/charmonizer/src/Charmonizer/Core/Compiler.c
----------------------------------------------------------------------
diff --git a/charmonizer/src/Charmonizer/Core/Compiler.c b/charmonizer/src/Charmonizer/Core/Compiler.c
index 22390b4..f2683b5 100644
--- a/charmonizer/src/Charmonizer/Core/Compiler.c
+++ b/charmonizer/src/Charmonizer/Core/Compiler.c
@@ -36,7 +36,7 @@ static struct {
char *cc_command;
char *cflags;
char *try_exe_name;
- char *try_obj_name;
+ char obj_ext[10];
char gcc_version_str[30];
int cflags_style;
int intval___GNUC__;
@@ -47,8 +47,8 @@ static struct {
chaz_CFlags *extra_cflags;
chaz_CFlags *temp_cflags;
} chaz_CC = {
- NULL, NULL, NULL, NULL,
- "",
+ NULL, NULL, NULL,
+ "", "",
0, 0, 0, 0, 0, 0,
NULL, NULL
};
@@ -69,18 +69,18 @@ chaz_CC_init(const char *compiler_command, const char *compiler_flags) {
/* Set names for the targets which we "try" to compile. */
chaz_CC.try_exe_name
= chaz_Util_join("", CHAZ_CC_TRY_BASENAME, chaz_OS_exe_ext(), NULL);
- chaz_CC.try_obj_name
- = chaz_Util_join("", CHAZ_CC_TRY_BASENAME, chaz_OS_obj_ext(), NULL);
/* If we can't compile anything, game over. */
if (chaz_Util_verbosity) {
printf("Trying to compile a small test file...\n");
}
/* Try MSVC argument style. */
+ strcpy(chaz_CC.obj_ext, ".obj");
chaz_CC.cflags_style = CHAZ_CFLAGS_STYLE_MSVC;
compile_succeeded = chaz_CC_test_compile(code);
if (!compile_succeeded) {
/* Try POSIX argument style. */
+ strcpy(chaz_CC.obj_ext, ".o");
chaz_CC.cflags_style = CHAZ_CFLAGS_STYLE_POSIX;
compile_succeeded = chaz_CC_test_compile(code);
}
@@ -152,7 +152,6 @@ void
chaz_CC_clean_up(void) {
free(chaz_CC.cc_command);
free(chaz_CC.cflags);
- free(chaz_CC.try_obj_name);
free(chaz_CC.try_exe_name);
chaz_CFlags_destroy(chaz_CC.extra_cflags);
chaz_CFlags_destroy(chaz_CC.temp_cflags);
@@ -223,7 +222,7 @@ chaz_CC_compile_obj(const char *source_path, const char *obj_name,
const char *extra_cflags_string = "";
const char *temp_cflags_string = "";
const char *local_cflags_string;
- char *obj_file = chaz_Util_join("", obj_name, chaz_OS_obj_ext(), NULL);
+ char *obj_file = chaz_Util_join("", obj_name, chaz_CC.obj_ext, NULL);
char *command;
int result;
@@ -264,12 +263,15 @@ chaz_CC_compile_obj(const char *source_path, const char *obj_name,
int
chaz_CC_test_compile(const char *source) {
int compile_succeeded;
- if (!chaz_Util_remove_and_verify(chaz_CC.try_obj_name)) {
- chaz_Util_die("Failed to delete file '%s'", chaz_CC.try_obj_name);
+ char *try_obj_name
+ = chaz_Util_join("", CHAZ_CC_TRY_BASENAME, chaz_CC.obj_ext, NULL);
+ if (!chaz_Util_remove_and_verify(try_obj_name)) {
+ chaz_Util_die("Failed to delete file '%s'", try_obj_name);
}
compile_succeeded = chaz_CC_compile_obj(CHAZ_CC_TRY_SOURCE_PATH,
CHAZ_CC_TRY_BASENAME, source);
- chaz_Util_remove_and_verify(chaz_CC.try_obj_name);
+ chaz_Util_remove_and_verify(try_obj_name);
+ free(try_obj_name);
return compile_succeeded;
}
@@ -332,6 +334,11 @@ chaz_CC_get_temp_cflags(void) {
return chaz_CC.temp_cflags;
}
+const char*
+chaz_CC_obj_ext(void) {
+ return chaz_CC.obj_ext;
+}
+
int
chaz_CC_gcc_version_num(void) {
return 10000 * chaz_CC.intval___GNUC__
http://git-wip-us.apache.org/repos/asf/lucy/blob/598a5ce5/charmonizer/src/Charmonizer/Core/Compiler.h
----------------------------------------------------------------------
diff --git a/charmonizer/src/Charmonizer/Core/Compiler.h b/charmonizer/src/Charmonizer/Core/Compiler.h
index 0ec499d..1e7803f 100644
--- a/charmonizer/src/Charmonizer/Core/Compiler.h
+++ b/charmonizer/src/Charmonizer/Core/Compiler.h
@@ -91,6 +91,11 @@ chaz_CC_get_extra_cflags(void);
chaz_CFlags*
chaz_CC_get_temp_cflags(void);
+/* Return the extension for a compiled object.
+ */
+const char*
+chaz_CC_obj_ext(void);
+
int
chaz_CC_gcc_version_num(void);
http://git-wip-us.apache.org/repos/asf/lucy/blob/598a5ce5/charmonizer/src/Charmonizer/Core/OperatingSystem.c
----------------------------------------------------------------------
diff --git a/charmonizer/src/Charmonizer/Core/OperatingSystem.c b/charmonizer/src/Charmonizer/Core/OperatingSystem.c
index 4a23958..a8f933b 100644
--- a/charmonizer/src/Charmonizer/Core/OperatingSystem.c
+++ b/charmonizer/src/Charmonizer/Core/OperatingSystem.c
@@ -31,11 +31,10 @@ static struct {
char name[CHAZ_OS_NAME_MAX+1];
char dev_null[20];
char exe_ext[5];
- char obj_ext[5];
char shared_lib_ext[7];
char local_command_start[3];
int shell_type;
-} chaz_OS = { "", "", "", "", "", "", 0 };
+} chaz_OS = { "", "", "", "", "", 0 };
void
chaz_OS_init(void) {
@@ -68,7 +67,6 @@ chaz_OS_init(void) {
strcpy(chaz_OS.dev_null, "/dev/null");
strcpy(chaz_OS.exe_ext, "");
- strcpy(chaz_OS.obj_ext, ".o");
if (memcmp(chaz_OS.name, "darwin", 6) == 0) {
strcpy(chaz_OS.shared_lib_ext, ".dylib");
}
@@ -84,7 +82,6 @@ chaz_OS_init(void) {
strcpy(chaz_OS.name, "windows");
strcpy(chaz_OS.dev_null, "nul");
strcpy(chaz_OS.exe_ext, ".exe");
- strcpy(chaz_OS.obj_ext, ".obj");
strcpy(chaz_OS.shared_lib_ext, ".dll");
strcpy(chaz_OS.local_command_start, ".\\");
chaz_OS.shell_type = CHAZ_OS_CMD_EXE;
@@ -116,11 +113,6 @@ chaz_OS_exe_ext(void) {
}
const char*
-chaz_OS_obj_ext(void) {
- return chaz_OS.obj_ext;
-}
-
-const char*
chaz_OS_shared_lib_ext(void) {
return chaz_OS.shared_lib_ext;
}
http://git-wip-us.apache.org/repos/asf/lucy/blob/598a5ce5/charmonizer/src/Charmonizer/Core/OperatingSystem.h
----------------------------------------------------------------------
diff --git a/charmonizer/src/Charmonizer/Core/OperatingSystem.h b/charmonizer/src/Charmonizer/Core/OperatingSystem.h
index d28b78b..c335cf3 100644
--- a/charmonizer/src/Charmonizer/Core/OperatingSystem.h
+++ b/charmonizer/src/Charmonizer/Core/OperatingSystem.h
@@ -84,11 +84,6 @@ chaz_OS_is_cygwin(void);
const char*
chaz_OS_exe_ext(void);
-/* Return the extension for a compiled object on this system.
- */
-const char*
-chaz_OS_obj_ext(void);
-
/* Return the extension for a shared object on this system.
*/
const char*
http://git-wip-us.apache.org/repos/asf/lucy/blob/598a5ce5/clownfish/compiler/common/charmonizer.main
----------------------------------------------------------------------
diff --git a/clownfish/compiler/common/charmonizer.main b/clownfish/compiler/common/charmonizer.main
index 3b896ba..55f9139 100644
--- a/clownfish/compiler/common/charmonizer.main
+++ b/clownfish/compiler/common/charmonizer.main
@@ -115,7 +115,7 @@ S_write_makefile(struct chaz_CLIArgs *args) {
const char *base_dir = "..";
const char *exe_ext = chaz_OS_exe_ext();
- const char *obj_ext = chaz_OS_obj_ext();
+ const char *obj_ext = chaz_CC_obj_ext();
const char *parse_header_y = "$(SRC_DIR)" DIR_SEP "CFCParseHeader.y";
const char *parse_header_h = "$(SRC_DIR)" DIR_SEP "CFCParseHeader.h";
http://git-wip-us.apache.org/repos/asf/lucy/blob/598a5ce5/common/charmonizer.main
----------------------------------------------------------------------
diff --git a/common/charmonizer.main b/common/charmonizer.main
index 4ebae65..6ce26e3 100644
--- a/common/charmonizer.main
+++ b/common/charmonizer.main
@@ -138,7 +138,7 @@ S_write_makefile(struct chaz_CLIArgs *args) {
const char *base_dir = "..";
const char *exe_ext = chaz_OS_exe_ext();
- const char *obj_ext = chaz_OS_obj_ext();
+ const char *obj_ext = chaz_CC_obj_ext();
const char *json_parser_y = "$(CORE_DIR)" DIR_SEP "Lucy" DIR_SEP "Util"
DIR_SEP "Json" DIR_SEP "JsonParser.y";
[lucy-commits] [3/5] git commit: refs/heads/master - Regenerate charmonizer.c
Posted by nw...@apache.org.
Regenerate charmonizer.c
Project: http://git-wip-us.apache.org/repos/asf/lucy/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy/commit/6c134eca
Tree: http://git-wip-us.apache.org/repos/asf/lucy/tree/6c134eca
Diff: http://git-wip-us.apache.org/repos/asf/lucy/diff/6c134eca
Branch: refs/heads/master
Commit: 6c134eca8a81f3fc95523526a962c290e09aff07
Parents: f776a04
Author: Nick Wellnhofer <we...@aevum.de>
Authored: Sat May 4 21:40:20 2013 +0200
Committer: Nick Wellnhofer <we...@aevum.de>
Committed: Sat May 4 23:46:09 2013 +0200
----------------------------------------------------------------------
clownfish/compiler/common/charmonizer.c | 89 ++++++++++++++----------
clownfish/runtime/common/charmonizer.c | 92 +++++++++++++++----------
common/charmonizer.c | 96 ++++++++++++++++----------
3 files changed, 166 insertions(+), 111 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucy/blob/6c134eca/clownfish/compiler/common/charmonizer.c
----------------------------------------------------------------------
diff --git a/clownfish/compiler/common/charmonizer.c b/clownfish/compiler/common/charmonizer.c
index 4bb9d67..5c74620 100644
--- a/clownfish/compiler/common/charmonizer.c
+++ b/clownfish/compiler/common/charmonizer.c
@@ -187,6 +187,11 @@ chaz_CC_get_extra_cflags(void);
chaz_CFlags*
chaz_CC_get_temp_cflags(void);
+/* Return the extension for a compiled object.
+ */
+const char*
+chaz_CC_obj_ext(void);
+
int
chaz_CC_gcc_version_num(void);
@@ -440,6 +445,11 @@ chaz_Make_clean_up(void);
const char*
chaz_Make_get_make(void);
+/** Return the type of shell used by the detected 'make' executable.
+ */
+int
+chaz_Make_shell_type(void);
+
/** Recursively list files in a directory. For every file a callback is called
* with the filename and a context variable.
*
@@ -676,11 +686,6 @@ chaz_OS_is_cygwin(void);
const char*
chaz_OS_exe_ext(void);
-/* Return the extension for a compiled object on this system.
- */
-const char*
-chaz_OS_obj_ext(void);
-
/* Return the extension for a shared object on this system.
*/
const char*
@@ -1458,7 +1463,7 @@ static struct {
char *cc_command;
char *cflags;
char *try_exe_name;
- char *try_obj_name;
+ char obj_ext[10];
char gcc_version_str[30];
int cflags_style;
int intval___GNUC__;
@@ -1469,8 +1474,8 @@ static struct {
chaz_CFlags *extra_cflags;
chaz_CFlags *temp_cflags;
} chaz_CC = {
- NULL, NULL, NULL, NULL,
- "",
+ NULL, NULL, NULL,
+ "", "",
0, 0, 0, 0, 0, 0,
NULL, NULL
};
@@ -1491,18 +1496,18 @@ chaz_CC_init(const char *compiler_command, const char *compiler_flags) {
/* Set names for the targets which we "try" to compile. */
chaz_CC.try_exe_name
= chaz_Util_join("", CHAZ_CC_TRY_BASENAME, chaz_OS_exe_ext(), NULL);
- chaz_CC.try_obj_name
- = chaz_Util_join("", CHAZ_CC_TRY_BASENAME, chaz_OS_obj_ext(), NULL);
/* If we can't compile anything, game over. */
if (chaz_Util_verbosity) {
printf("Trying to compile a small test file...\n");
}
/* Try MSVC argument style. */
+ strcpy(chaz_CC.obj_ext, ".obj");
chaz_CC.cflags_style = CHAZ_CFLAGS_STYLE_MSVC;
compile_succeeded = chaz_CC_test_compile(code);
if (!compile_succeeded) {
/* Try POSIX argument style. */
+ strcpy(chaz_CC.obj_ext, ".o");
chaz_CC.cflags_style = CHAZ_CFLAGS_STYLE_POSIX;
compile_succeeded = chaz_CC_test_compile(code);
}
@@ -1574,7 +1579,6 @@ void
chaz_CC_clean_up(void) {
free(chaz_CC.cc_command);
free(chaz_CC.cflags);
- free(chaz_CC.try_obj_name);
free(chaz_CC.try_exe_name);
chaz_CFlags_destroy(chaz_CC.extra_cflags);
chaz_CFlags_destroy(chaz_CC.temp_cflags);
@@ -1645,7 +1649,7 @@ chaz_CC_compile_obj(const char *source_path, const char *obj_name,
const char *extra_cflags_string = "";
const char *temp_cflags_string = "";
const char *local_cflags_string;
- char *obj_file = chaz_Util_join("", obj_name, chaz_OS_obj_ext(), NULL);
+ char *obj_file = chaz_Util_join("", obj_name, chaz_CC.obj_ext, NULL);
char *command;
int result;
@@ -1686,12 +1690,15 @@ chaz_CC_compile_obj(const char *source_path, const char *obj_name,
int
chaz_CC_test_compile(const char *source) {
int compile_succeeded;
- if (!chaz_Util_remove_and_verify(chaz_CC.try_obj_name)) {
- chaz_Util_die("Failed to delete file '%s'", chaz_CC.try_obj_name);
+ char *try_obj_name
+ = chaz_Util_join("", CHAZ_CC_TRY_BASENAME, chaz_CC.obj_ext, NULL);
+ if (!chaz_Util_remove_and_verify(try_obj_name)) {
+ chaz_Util_die("Failed to delete file '%s'", try_obj_name);
}
compile_succeeded = chaz_CC_compile_obj(CHAZ_CC_TRY_SOURCE_PATH,
CHAZ_CC_TRY_BASENAME, source);
- chaz_Util_remove_and_verify(chaz_CC.try_obj_name);
+ chaz_Util_remove_and_verify(try_obj_name);
+ free(try_obj_name);
return compile_succeeded;
}
@@ -1754,6 +1761,11 @@ chaz_CC_get_temp_cflags(void) {
return chaz_CC.temp_cflags;
}
+const char*
+chaz_CC_obj_ext(void) {
+ return chaz_CC.obj_ext;
+}
+
int
chaz_CC_gcc_version_num(void) {
return 10000 * chaz_CC.intval___GNUC__
@@ -2936,9 +2948,10 @@ static struct {
char *make_command;
int is_gnu_make;
int is_nmake;
+ int shell_type;
} chaz_Make = {
NULL,
- 0, 0
+ 0, 0, 0
};
/* Detect make command.
@@ -2971,16 +2984,24 @@ void
chaz_Make_init(void) {
const char *make;
- chaz_Make_detect("make", "gmake", "nmake", "dmake", NULL);
+ chaz_Make_detect("make", "gmake", "nmake", "dmake", "mingw32-make",
+ "mingw64-make", NULL);
make = chaz_Make.make_command;
if (make) {
- if (strcmp(make, "make") == 0 || strcmp(make, "gmake") == 0) {
+ if (strcmp(make, "make") == 0
+ || strcmp(make, "gmake") == 0
+ || strcmp(make, "mingw32-make") == 0
+ || strcmp(make, "mingw64-make") == 0
+ ) {
/* TODO: Add a feature test for GNU make. */
chaz_Make.is_gnu_make = 1;
+ /* TODO: Feature test which shell GNU make uses on Windows. */
+ chaz_Make.shell_type = CHAZ_OS_POSIX;
}
else if (strcmp(make, "nmake") == 0) {
chaz_Make.is_nmake = 1;
+ chaz_Make.shell_type = CHAZ_OS_CMD_EXE;
}
}
}
@@ -2995,6 +3016,11 @@ chaz_Make_get_make(void) {
return chaz_Make.make_command;
}
+int
+chaz_Make_shell_type(void) {
+ return chaz_Make.shell_type;
+}
+
static int
chaz_Make_detect(const char *make1, ...) {
va_list args;
@@ -3241,7 +3267,6 @@ chaz_MakeFile_add_shared_lib(chaz_MakeFile *makefile, const char *name,
void
chaz_MakeFile_write(chaz_MakeFile *makefile) {
- int shell_type = chaz_OS_shell_type();
FILE *out;
size_t i;
@@ -3386,18 +3411,17 @@ chaz_MakeRule_add_command(chaz_MakeRule *rule, const char *command) {
void
chaz_MakeRule_add_rm_command(chaz_MakeRule *rule, const char *files) {
- int shell_type = chaz_OS_shell_type();
char *command;
- if (shell_type == CHAZ_OS_POSIX) {
+ if (chaz_Make.shell_type == CHAZ_OS_POSIX) {
command = chaz_Util_join(" ", "rm -f", files, NULL);
}
- else if (shell_type == CHAZ_OS_CMD_EXE) {
+ else if (chaz_Make.shell_type == CHAZ_OS_CMD_EXE) {
command = chaz_Util_join("", "for %i in (", files,
") do @if exist %i del /f %i", NULL);
}
else {
- chaz_Util_die("Unsupported shell type: %d", shell_type);
+ chaz_Util_die("Unsupported shell type: %d", chaz_Make.shell_type);
}
chaz_MakeRule_add_command(rule, command);
@@ -3406,18 +3430,17 @@ chaz_MakeRule_add_rm_command(chaz_MakeRule *rule, const char *files) {
void
chaz_MakeRule_add_recursive_rm_command(chaz_MakeRule *rule, const char *dirs) {
- int shell_type = chaz_OS_shell_type();
char *command;
- if (shell_type == CHAZ_OS_POSIX) {
+ if (chaz_Make.shell_type == CHAZ_OS_POSIX) {
command = chaz_Util_join(" ", "rm -rf", dirs, NULL);
}
- else if (shell_type == CHAZ_OS_CMD_EXE) {
+ else if (chaz_Make.shell_type == CHAZ_OS_CMD_EXE) {
command = chaz_Util_join("", "for %i in (", dirs,
") do @if exist %i rmdir /s /q %i", NULL);
}
else {
- chaz_Util_die("Unsupported shell type: %d", shell_type);
+ chaz_Util_die("Unsupported shell type: %d", chaz_Make.shell_type);
}
chaz_MakeRule_add_command(rule, command);
@@ -3569,11 +3592,10 @@ static struct {
char name[CHAZ_OS_NAME_MAX+1];
char dev_null[20];
char exe_ext[5];
- char obj_ext[5];
char shared_lib_ext[7];
char local_command_start[3];
int shell_type;
-} chaz_OS = { "", "", "", "", "", "", 0 };
+} chaz_OS = { "", "", "", "", "", 0 };
void
chaz_OS_init(void) {
@@ -3606,7 +3628,6 @@ chaz_OS_init(void) {
strcpy(chaz_OS.dev_null, "/dev/null");
strcpy(chaz_OS.exe_ext, "");
- strcpy(chaz_OS.obj_ext, ".o");
if (memcmp(chaz_OS.name, "darwin", 6) == 0) {
strcpy(chaz_OS.shared_lib_ext, ".dylib");
}
@@ -3622,7 +3643,6 @@ chaz_OS_init(void) {
strcpy(chaz_OS.name, "windows");
strcpy(chaz_OS.dev_null, "nul");
strcpy(chaz_OS.exe_ext, ".exe");
- strcpy(chaz_OS.obj_ext, ".obj");
strcpy(chaz_OS.shared_lib_ext, ".dll");
strcpy(chaz_OS.local_command_start, ".\\");
chaz_OS.shell_type = CHAZ_OS_CMD_EXE;
@@ -3654,11 +3674,6 @@ chaz_OS_exe_ext(void) {
}
const char*
-chaz_OS_obj_ext(void) {
- return chaz_OS.obj_ext;
-}
-
-const char*
chaz_OS_shared_lib_ext(void) {
return chaz_OS.shared_lib_ext;
}
@@ -5244,7 +5259,7 @@ S_write_makefile(struct chaz_CLIArgs *args) {
const char *base_dir = "..";
const char *exe_ext = chaz_OS_exe_ext();
- const char *obj_ext = chaz_OS_obj_ext();
+ const char *obj_ext = chaz_CC_obj_ext();
const char *parse_header_y = "$(SRC_DIR)" DIR_SEP "CFCParseHeader.y";
const char *parse_header_h = "$(SRC_DIR)" DIR_SEP "CFCParseHeader.h";
http://git-wip-us.apache.org/repos/asf/lucy/blob/6c134eca/clownfish/runtime/common/charmonizer.c
----------------------------------------------------------------------
diff --git a/clownfish/runtime/common/charmonizer.c b/clownfish/runtime/common/charmonizer.c
index 4651ef7..3affa90 100644
--- a/clownfish/runtime/common/charmonizer.c
+++ b/clownfish/runtime/common/charmonizer.c
@@ -187,6 +187,11 @@ chaz_CC_get_extra_cflags(void);
chaz_CFlags*
chaz_CC_get_temp_cflags(void);
+/* Return the extension for a compiled object.
+ */
+const char*
+chaz_CC_obj_ext(void);
+
int
chaz_CC_gcc_version_num(void);
@@ -440,6 +445,11 @@ chaz_Make_clean_up(void);
const char*
chaz_Make_get_make(void);
+/** Return the type of shell used by the detected 'make' executable.
+ */
+int
+chaz_Make_shell_type(void);
+
/** Recursively list files in a directory. For every file a callback is called
* with the filename and a context variable.
*
@@ -676,11 +686,6 @@ chaz_OS_is_cygwin(void);
const char*
chaz_OS_exe_ext(void);
-/* Return the extension for a compiled object on this system.
- */
-const char*
-chaz_OS_obj_ext(void);
-
/* Return the extension for a shared object on this system.
*/
const char*
@@ -1737,7 +1742,7 @@ static struct {
char *cc_command;
char *cflags;
char *try_exe_name;
- char *try_obj_name;
+ char obj_ext[10];
char gcc_version_str[30];
int cflags_style;
int intval___GNUC__;
@@ -1748,8 +1753,8 @@ static struct {
chaz_CFlags *extra_cflags;
chaz_CFlags *temp_cflags;
} chaz_CC = {
- NULL, NULL, NULL, NULL,
- "",
+ NULL, NULL, NULL,
+ "", "",
0, 0, 0, 0, 0, 0,
NULL, NULL
};
@@ -1770,18 +1775,18 @@ chaz_CC_init(const char *compiler_command, const char *compiler_flags) {
/* Set names for the targets which we "try" to compile. */
chaz_CC.try_exe_name
= chaz_Util_join("", CHAZ_CC_TRY_BASENAME, chaz_OS_exe_ext(), NULL);
- chaz_CC.try_obj_name
- = chaz_Util_join("", CHAZ_CC_TRY_BASENAME, chaz_OS_obj_ext(), NULL);
/* If we can't compile anything, game over. */
if (chaz_Util_verbosity) {
printf("Trying to compile a small test file...\n");
}
/* Try MSVC argument style. */
+ strcpy(chaz_CC.obj_ext, ".obj");
chaz_CC.cflags_style = CHAZ_CFLAGS_STYLE_MSVC;
compile_succeeded = chaz_CC_test_compile(code);
if (!compile_succeeded) {
/* Try POSIX argument style. */
+ strcpy(chaz_CC.obj_ext, ".o");
chaz_CC.cflags_style = CHAZ_CFLAGS_STYLE_POSIX;
compile_succeeded = chaz_CC_test_compile(code);
}
@@ -1853,7 +1858,6 @@ void
chaz_CC_clean_up(void) {
free(chaz_CC.cc_command);
free(chaz_CC.cflags);
- free(chaz_CC.try_obj_name);
free(chaz_CC.try_exe_name);
chaz_CFlags_destroy(chaz_CC.extra_cflags);
chaz_CFlags_destroy(chaz_CC.temp_cflags);
@@ -1924,7 +1928,7 @@ chaz_CC_compile_obj(const char *source_path, const char *obj_name,
const char *extra_cflags_string = "";
const char *temp_cflags_string = "";
const char *local_cflags_string;
- char *obj_file = chaz_Util_join("", obj_name, chaz_OS_obj_ext(), NULL);
+ char *obj_file = chaz_Util_join("", obj_name, chaz_CC.obj_ext, NULL);
char *command;
int result;
@@ -1965,12 +1969,15 @@ chaz_CC_compile_obj(const char *source_path, const char *obj_name,
int
chaz_CC_test_compile(const char *source) {
int compile_succeeded;
- if (!chaz_Util_remove_and_verify(chaz_CC.try_obj_name)) {
- chaz_Util_die("Failed to delete file '%s'", chaz_CC.try_obj_name);
+ char *try_obj_name
+ = chaz_Util_join("", CHAZ_CC_TRY_BASENAME, chaz_CC.obj_ext, NULL);
+ if (!chaz_Util_remove_and_verify(try_obj_name)) {
+ chaz_Util_die("Failed to delete file '%s'", try_obj_name);
}
compile_succeeded = chaz_CC_compile_obj(CHAZ_CC_TRY_SOURCE_PATH,
CHAZ_CC_TRY_BASENAME, source);
- chaz_Util_remove_and_verify(chaz_CC.try_obj_name);
+ chaz_Util_remove_and_verify(try_obj_name);
+ free(try_obj_name);
return compile_succeeded;
}
@@ -2033,6 +2040,11 @@ chaz_CC_get_temp_cflags(void) {
return chaz_CC.temp_cflags;
}
+const char*
+chaz_CC_obj_ext(void) {
+ return chaz_CC.obj_ext;
+}
+
int
chaz_CC_gcc_version_num(void) {
return 10000 * chaz_CC.intval___GNUC__
@@ -3215,9 +3227,10 @@ static struct {
char *make_command;
int is_gnu_make;
int is_nmake;
+ int shell_type;
} chaz_Make = {
NULL,
- 0, 0
+ 0, 0, 0
};
/* Detect make command.
@@ -3250,16 +3263,24 @@ void
chaz_Make_init(void) {
const char *make;
- chaz_Make_detect("make", "gmake", "nmake", "dmake", NULL);
+ chaz_Make_detect("make", "gmake", "nmake", "dmake", "mingw32-make",
+ "mingw64-make", NULL);
make = chaz_Make.make_command;
if (make) {
- if (strcmp(make, "make") == 0 || strcmp(make, "gmake") == 0) {
+ if (strcmp(make, "make") == 0
+ || strcmp(make, "gmake") == 0
+ || strcmp(make, "mingw32-make") == 0
+ || strcmp(make, "mingw64-make") == 0
+ ) {
/* TODO: Add a feature test for GNU make. */
chaz_Make.is_gnu_make = 1;
+ /* TODO: Feature test which shell GNU make uses on Windows. */
+ chaz_Make.shell_type = CHAZ_OS_POSIX;
}
else if (strcmp(make, "nmake") == 0) {
chaz_Make.is_nmake = 1;
+ chaz_Make.shell_type = CHAZ_OS_CMD_EXE;
}
}
}
@@ -3274,6 +3295,11 @@ chaz_Make_get_make(void) {
return chaz_Make.make_command;
}
+int
+chaz_Make_shell_type(void) {
+ return chaz_Make.shell_type;
+}
+
static int
chaz_Make_detect(const char *make1, ...) {
va_list args;
@@ -3520,7 +3546,6 @@ chaz_MakeFile_add_shared_lib(chaz_MakeFile *makefile, const char *name,
void
chaz_MakeFile_write(chaz_MakeFile *makefile) {
- int shell_type = chaz_OS_shell_type();
FILE *out;
size_t i;
@@ -3665,18 +3690,17 @@ chaz_MakeRule_add_command(chaz_MakeRule *rule, const char *command) {
void
chaz_MakeRule_add_rm_command(chaz_MakeRule *rule, const char *files) {
- int shell_type = chaz_OS_shell_type();
char *command;
- if (shell_type == CHAZ_OS_POSIX) {
+ if (chaz_Make.shell_type == CHAZ_OS_POSIX) {
command = chaz_Util_join(" ", "rm -f", files, NULL);
}
- else if (shell_type == CHAZ_OS_CMD_EXE) {
+ else if (chaz_Make.shell_type == CHAZ_OS_CMD_EXE) {
command = chaz_Util_join("", "for %i in (", files,
") do @if exist %i del /f %i", NULL);
}
else {
- chaz_Util_die("Unsupported shell type: %d", shell_type);
+ chaz_Util_die("Unsupported shell type: %d", chaz_Make.shell_type);
}
chaz_MakeRule_add_command(rule, command);
@@ -3685,18 +3709,17 @@ chaz_MakeRule_add_rm_command(chaz_MakeRule *rule, const char *files) {
void
chaz_MakeRule_add_recursive_rm_command(chaz_MakeRule *rule, const char *dirs) {
- int shell_type = chaz_OS_shell_type();
char *command;
- if (shell_type == CHAZ_OS_POSIX) {
+ if (chaz_Make.shell_type == CHAZ_OS_POSIX) {
command = chaz_Util_join(" ", "rm -rf", dirs, NULL);
}
- else if (shell_type == CHAZ_OS_CMD_EXE) {
+ else if (chaz_Make.shell_type == CHAZ_OS_CMD_EXE) {
command = chaz_Util_join("", "for %i in (", dirs,
") do @if exist %i rmdir /s /q %i", NULL);
}
else {
- chaz_Util_die("Unsupported shell type: %d", shell_type);
+ chaz_Util_die("Unsupported shell type: %d", chaz_Make.shell_type);
}
chaz_MakeRule_add_command(rule, command);
@@ -3848,11 +3871,10 @@ static struct {
char name[CHAZ_OS_NAME_MAX+1];
char dev_null[20];
char exe_ext[5];
- char obj_ext[5];
char shared_lib_ext[7];
char local_command_start[3];
int shell_type;
-} chaz_OS = { "", "", "", "", "", "", 0 };
+} chaz_OS = { "", "", "", "", "", 0 };
void
chaz_OS_init(void) {
@@ -3885,7 +3907,6 @@ chaz_OS_init(void) {
strcpy(chaz_OS.dev_null, "/dev/null");
strcpy(chaz_OS.exe_ext, "");
- strcpy(chaz_OS.obj_ext, ".o");
if (memcmp(chaz_OS.name, "darwin", 6) == 0) {
strcpy(chaz_OS.shared_lib_ext, ".dylib");
}
@@ -3901,7 +3922,6 @@ chaz_OS_init(void) {
strcpy(chaz_OS.name, "windows");
strcpy(chaz_OS.dev_null, "nul");
strcpy(chaz_OS.exe_ext, ".exe");
- strcpy(chaz_OS.obj_ext, ".obj");
strcpy(chaz_OS.shared_lib_ext, ".dll");
strcpy(chaz_OS.local_command_start, ".\\");
chaz_OS.shell_type = CHAZ_OS_CMD_EXE;
@@ -3933,11 +3953,6 @@ chaz_OS_exe_ext(void) {
}
const char*
-chaz_OS_obj_ext(void) {
- return chaz_OS.obj_ext;
-}
-
-const char*
chaz_OS_shared_lib_ext(void) {
return chaz_OS.shared_lib_ext;
}
@@ -5978,6 +5993,11 @@ chaz_Memory_probe_alloca(void) {
chaz_ConfWriter_add_def("alloca", "alloca");
}
if (!has_alloca) {
+ /*
+ * FIXME: Under MinGW, alloca is defined in malloc.h. This probe
+ * produces compiler warnings but works regardless. These warnings
+ * are subsequently repeated during the build.
+ */
sprintf(code_buf, alloca_code, "stdlib.h", "alloca");
if (chaz_CC_test_compile(code_buf)) {
has_alloca = true;
http://git-wip-us.apache.org/repos/asf/lucy/blob/6c134eca/common/charmonizer.c
----------------------------------------------------------------------
diff --git a/common/charmonizer.c b/common/charmonizer.c
index 2acbf3d..76ff931 100644
--- a/common/charmonizer.c
+++ b/common/charmonizer.c
@@ -187,6 +187,11 @@ chaz_CC_get_extra_cflags(void);
chaz_CFlags*
chaz_CC_get_temp_cflags(void);
+/* Return the extension for a compiled object.
+ */
+const char*
+chaz_CC_obj_ext(void);
+
int
chaz_CC_gcc_version_num(void);
@@ -440,6 +445,11 @@ chaz_Make_clean_up(void);
const char*
chaz_Make_get_make(void);
+/** Return the type of shell used by the detected 'make' executable.
+ */
+int
+chaz_Make_shell_type(void);
+
/** Recursively list files in a directory. For every file a callback is called
* with the filename and a context variable.
*
@@ -676,11 +686,6 @@ chaz_OS_is_cygwin(void);
const char*
chaz_OS_exe_ext(void);
-/* Return the extension for a compiled object on this system.
- */
-const char*
-chaz_OS_obj_ext(void);
-
/* Return the extension for a shared object on this system.
*/
const char*
@@ -1737,7 +1742,7 @@ static struct {
char *cc_command;
char *cflags;
char *try_exe_name;
- char *try_obj_name;
+ char obj_ext[10];
char gcc_version_str[30];
int cflags_style;
int intval___GNUC__;
@@ -1748,8 +1753,8 @@ static struct {
chaz_CFlags *extra_cflags;
chaz_CFlags *temp_cflags;
} chaz_CC = {
- NULL, NULL, NULL, NULL,
- "",
+ NULL, NULL, NULL,
+ "", "",
0, 0, 0, 0, 0, 0,
NULL, NULL
};
@@ -1770,18 +1775,18 @@ chaz_CC_init(const char *compiler_command, const char *compiler_flags) {
/* Set names for the targets which we "try" to compile. */
chaz_CC.try_exe_name
= chaz_Util_join("", CHAZ_CC_TRY_BASENAME, chaz_OS_exe_ext(), NULL);
- chaz_CC.try_obj_name
- = chaz_Util_join("", CHAZ_CC_TRY_BASENAME, chaz_OS_obj_ext(), NULL);
/* If we can't compile anything, game over. */
if (chaz_Util_verbosity) {
printf("Trying to compile a small test file...\n");
}
/* Try MSVC argument style. */
+ strcpy(chaz_CC.obj_ext, ".obj");
chaz_CC.cflags_style = CHAZ_CFLAGS_STYLE_MSVC;
compile_succeeded = chaz_CC_test_compile(code);
if (!compile_succeeded) {
/* Try POSIX argument style. */
+ strcpy(chaz_CC.obj_ext, ".o");
chaz_CC.cflags_style = CHAZ_CFLAGS_STYLE_POSIX;
compile_succeeded = chaz_CC_test_compile(code);
}
@@ -1853,7 +1858,6 @@ void
chaz_CC_clean_up(void) {
free(chaz_CC.cc_command);
free(chaz_CC.cflags);
- free(chaz_CC.try_obj_name);
free(chaz_CC.try_exe_name);
chaz_CFlags_destroy(chaz_CC.extra_cflags);
chaz_CFlags_destroy(chaz_CC.temp_cflags);
@@ -1924,7 +1928,7 @@ chaz_CC_compile_obj(const char *source_path, const char *obj_name,
const char *extra_cflags_string = "";
const char *temp_cflags_string = "";
const char *local_cflags_string;
- char *obj_file = chaz_Util_join("", obj_name, chaz_OS_obj_ext(), NULL);
+ char *obj_file = chaz_Util_join("", obj_name, chaz_CC.obj_ext, NULL);
char *command;
int result;
@@ -1965,12 +1969,15 @@ chaz_CC_compile_obj(const char *source_path, const char *obj_name,
int
chaz_CC_test_compile(const char *source) {
int compile_succeeded;
- if (!chaz_Util_remove_and_verify(chaz_CC.try_obj_name)) {
- chaz_Util_die("Failed to delete file '%s'", chaz_CC.try_obj_name);
+ char *try_obj_name
+ = chaz_Util_join("", CHAZ_CC_TRY_BASENAME, chaz_CC.obj_ext, NULL);
+ if (!chaz_Util_remove_and_verify(try_obj_name)) {
+ chaz_Util_die("Failed to delete file '%s'", try_obj_name);
}
compile_succeeded = chaz_CC_compile_obj(CHAZ_CC_TRY_SOURCE_PATH,
CHAZ_CC_TRY_BASENAME, source);
- chaz_Util_remove_and_verify(chaz_CC.try_obj_name);
+ chaz_Util_remove_and_verify(try_obj_name);
+ free(try_obj_name);
return compile_succeeded;
}
@@ -2033,6 +2040,11 @@ chaz_CC_get_temp_cflags(void) {
return chaz_CC.temp_cflags;
}
+const char*
+chaz_CC_obj_ext(void) {
+ return chaz_CC.obj_ext;
+}
+
int
chaz_CC_gcc_version_num(void) {
return 10000 * chaz_CC.intval___GNUC__
@@ -3215,9 +3227,10 @@ static struct {
char *make_command;
int is_gnu_make;
int is_nmake;
+ int shell_type;
} chaz_Make = {
NULL,
- 0, 0
+ 0, 0, 0
};
/* Detect make command.
@@ -3250,16 +3263,24 @@ void
chaz_Make_init(void) {
const char *make;
- chaz_Make_detect("make", "gmake", "nmake", "dmake", NULL);
+ chaz_Make_detect("make", "gmake", "nmake", "dmake", "mingw32-make",
+ "mingw64-make", NULL);
make = chaz_Make.make_command;
if (make) {
- if (strcmp(make, "make") == 0 || strcmp(make, "gmake") == 0) {
+ if (strcmp(make, "make") == 0
+ || strcmp(make, "gmake") == 0
+ || strcmp(make, "mingw32-make") == 0
+ || strcmp(make, "mingw64-make") == 0
+ ) {
/* TODO: Add a feature test for GNU make. */
chaz_Make.is_gnu_make = 1;
+ /* TODO: Feature test which shell GNU make uses on Windows. */
+ chaz_Make.shell_type = CHAZ_OS_POSIX;
}
else if (strcmp(make, "nmake") == 0) {
chaz_Make.is_nmake = 1;
+ chaz_Make.shell_type = CHAZ_OS_CMD_EXE;
}
}
}
@@ -3274,6 +3295,11 @@ chaz_Make_get_make(void) {
return chaz_Make.make_command;
}
+int
+chaz_Make_shell_type(void) {
+ return chaz_Make.shell_type;
+}
+
static int
chaz_Make_detect(const char *make1, ...) {
va_list args;
@@ -3520,7 +3546,6 @@ chaz_MakeFile_add_shared_lib(chaz_MakeFile *makefile, const char *name,
void
chaz_MakeFile_write(chaz_MakeFile *makefile) {
- int shell_type = chaz_OS_shell_type();
FILE *out;
size_t i;
@@ -3665,18 +3690,17 @@ chaz_MakeRule_add_command(chaz_MakeRule *rule, const char *command) {
void
chaz_MakeRule_add_rm_command(chaz_MakeRule *rule, const char *files) {
- int shell_type = chaz_OS_shell_type();
char *command;
- if (shell_type == CHAZ_OS_POSIX) {
+ if (chaz_Make.shell_type == CHAZ_OS_POSIX) {
command = chaz_Util_join(" ", "rm -f", files, NULL);
}
- else if (shell_type == CHAZ_OS_CMD_EXE) {
+ else if (chaz_Make.shell_type == CHAZ_OS_CMD_EXE) {
command = chaz_Util_join("", "for %i in (", files,
") do @if exist %i del /f %i", NULL);
}
else {
- chaz_Util_die("Unsupported shell type: %d", shell_type);
+ chaz_Util_die("Unsupported shell type: %d", chaz_Make.shell_type);
}
chaz_MakeRule_add_command(rule, command);
@@ -3685,18 +3709,17 @@ chaz_MakeRule_add_rm_command(chaz_MakeRule *rule, const char *files) {
void
chaz_MakeRule_add_recursive_rm_command(chaz_MakeRule *rule, const char *dirs) {
- int shell_type = chaz_OS_shell_type();
char *command;
- if (shell_type == CHAZ_OS_POSIX) {
+ if (chaz_Make.shell_type == CHAZ_OS_POSIX) {
command = chaz_Util_join(" ", "rm -rf", dirs, NULL);
}
- else if (shell_type == CHAZ_OS_CMD_EXE) {
+ else if (chaz_Make.shell_type == CHAZ_OS_CMD_EXE) {
command = chaz_Util_join("", "for %i in (", dirs,
") do @if exist %i rmdir /s /q %i", NULL);
}
else {
- chaz_Util_die("Unsupported shell type: %d", shell_type);
+ chaz_Util_die("Unsupported shell type: %d", chaz_Make.shell_type);
}
chaz_MakeRule_add_command(rule, command);
@@ -3848,11 +3871,10 @@ static struct {
char name[CHAZ_OS_NAME_MAX+1];
char dev_null[20];
char exe_ext[5];
- char obj_ext[5];
char shared_lib_ext[7];
char local_command_start[3];
int shell_type;
-} chaz_OS = { "", "", "", "", "", "", 0 };
+} chaz_OS = { "", "", "", "", "", 0 };
void
chaz_OS_init(void) {
@@ -3885,7 +3907,6 @@ chaz_OS_init(void) {
strcpy(chaz_OS.dev_null, "/dev/null");
strcpy(chaz_OS.exe_ext, "");
- strcpy(chaz_OS.obj_ext, ".o");
if (memcmp(chaz_OS.name, "darwin", 6) == 0) {
strcpy(chaz_OS.shared_lib_ext, ".dylib");
}
@@ -3901,7 +3922,6 @@ chaz_OS_init(void) {
strcpy(chaz_OS.name, "windows");
strcpy(chaz_OS.dev_null, "nul");
strcpy(chaz_OS.exe_ext, ".exe");
- strcpy(chaz_OS.obj_ext, ".obj");
strcpy(chaz_OS.shared_lib_ext, ".dll");
strcpy(chaz_OS.local_command_start, ".\\");
chaz_OS.shell_type = CHAZ_OS_CMD_EXE;
@@ -3933,11 +3953,6 @@ chaz_OS_exe_ext(void) {
}
const char*
-chaz_OS_obj_ext(void) {
- return chaz_OS.obj_ext;
-}
-
-const char*
chaz_OS_shared_lib_ext(void) {
return chaz_OS.shared_lib_ext;
}
@@ -5978,6 +5993,11 @@ chaz_Memory_probe_alloca(void) {
chaz_ConfWriter_add_def("alloca", "alloca");
}
if (!has_alloca) {
+ /*
+ * FIXME: Under MinGW, alloca is defined in malloc.h. This probe
+ * produces compiler warnings but works regardless. These warnings
+ * are subsequently repeated during the build.
+ */
sprintf(code_buf, alloca_code, "stdlib.h", "alloca");
if (chaz_CC_test_compile(code_buf)) {
has_alloca = true;
@@ -6442,7 +6462,7 @@ S_write_makefile(struct chaz_CLIArgs *args) {
const char *base_dir = "..";
const char *exe_ext = chaz_OS_exe_ext();
- const char *obj_ext = chaz_OS_obj_ext();
+ const char *obj_ext = chaz_CC_obj_ext();
const char *json_parser_y = "$(CORE_DIR)" DIR_SEP "Lucy" DIR_SEP "Util"
DIR_SEP "Json" DIR_SEP "JsonParser.y";
@@ -6680,7 +6700,7 @@ S_write_makefile(struct chaz_CLIArgs *args) {
clean_rule = chaz_MakeFile_clean_rule(makefile);
- if (chaz_OS_shell_type() == CHAZ_OS_CMD_EXE) {
+ if (chaz_Make_shell_type() == CHAZ_OS_CMD_EXE) {
/*
* The length of the command would exceed the limit of 8191
* characters. As a work-around, delete all .obj files in BASE_DIR
[lucy-commits] [5/5] git commit: refs/heads/master - Update installation
instructions for C library
Posted by nw...@apache.org.
Update installation instructions for C library
Project: http://git-wip-us.apache.org/repos/asf/lucy/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy/commit/75626953
Tree: http://git-wip-us.apache.org/repos/asf/lucy/tree/75626953
Diff: http://git-wip-us.apache.org/repos/asf/lucy/diff/75626953
Branch: refs/heads/master
Commit: 75626953eee763d5b956406500eef1a7a414eb79
Parents: 8169643
Author: Nick Wellnhofer <we...@aevum.de>
Authored: Sat May 4 23:19:22 2013 +0200
Committer: Nick Wellnhofer <we...@aevum.de>
Committed: Sat May 4 23:53:33 2013 +0200
----------------------------------------------------------------------
c/INSTALL | 22 ++++++++++++++++++++--
clownfish/compiler/c/INSTALL | 26 ++++++++++++++++++++++----
2 files changed, 42 insertions(+), 6 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucy/blob/75626953/c/INSTALL
----------------------------------------------------------------------
diff --git a/c/INSTALL b/c/INSTALL
index 9afce20..722f505 100644
--- a/c/INSTALL
+++ b/c/INSTALL
@@ -1,18 +1,36 @@
Build instructions for the Apache Lucy C library
================================================
-When building under UNIX and derivatives run:
+Building under UNIX and derivatives or Cygwin
+---------------------------------------------
$ ./configure
$ make
$ make test
-When building under Windows with MSVC run:
+Building under Windows
+----------------------
+
+You need MSVC or gcc as C compiler and nmake or mingw32-make as make utility.
+
+When using cmd.exe configure with:
$ configure.bat
+
+When using the MSYS shell configure with:
+
+ $ ./configure
+
+When building with nmake run:
+
$ nmake
$ nmake test
+When building with mingw32-make run:
+
+ $ mingw32-make
+ $ mingw32-make test
+
Configuration
-------------
http://git-wip-us.apache.org/repos/asf/lucy/blob/75626953/clownfish/compiler/c/INSTALL
----------------------------------------------------------------------
diff --git a/clownfish/compiler/c/INSTALL b/clownfish/compiler/c/INSTALL
index 8c4012f..838563c 100644
--- a/clownfish/compiler/c/INSTALL
+++ b/clownfish/compiler/c/INSTALL
@@ -1,18 +1,36 @@
-Build instructions for the Apache Lucy C library
-================================================
+Build instructions for the Clownfish compiler
+=============================================
-When building under UNIX and derivatives run:
+Building under UNIX and derivatives or Cygwin
+---------------------------------------------
$ ./configure
$ make
$ make test
-When building under Windows with MSVC run:
+Building under Windows
+----------------------
+
+You need MSVC or gcc as C compiler and nmake or mingw32-make as make utility.
+
+When using cmd.exe configure with:
$ configure.bat
+
+When using the MSYS shell configure with:
+
+ $ ./configure
+
+When building with nmake run:
+
$ nmake
$ nmake test
+When building with mingw32-make run:
+
+ $ mingw32-make
+ $ mingw32-make test
+
Configuration
-------------
[lucy-commits] [2/5] git commit: refs/heads/master - Support GNU make under Windows
Posted by nw...@apache.org.
Support GNU make under Windows
Project: http://git-wip-us.apache.org/repos/asf/lucy/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy/commit/f776a04e
Tree: http://git-wip-us.apache.org/repos/asf/lucy/tree/f776a04e
Diff: http://git-wip-us.apache.org/repos/asf/lucy/diff/f776a04e
Branch: refs/heads/master
Commit: f776a04e03ad5a0f00d69fd85522eb300ad141ed
Parents: 598a5ce
Author: Nick Wellnhofer <we...@aevum.de>
Authored: Sat May 4 22:32:45 2013 +0200
Committer: Nick Wellnhofer <we...@aevum.de>
Committed: Sat May 4 23:45:38 2013 +0200
----------------------------------------------------------------------
charmonizer/src/Charmonizer/Core/Make.c | 35 +++++++++++++++++---------
charmonizer/src/Charmonizer/Core/Make.h | 5 +++
common/charmonizer.main | 2 +-
3 files changed, 29 insertions(+), 13 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucy/blob/f776a04e/charmonizer/src/Charmonizer/Core/Make.c
----------------------------------------------------------------------
diff --git a/charmonizer/src/Charmonizer/Core/Make.c b/charmonizer/src/Charmonizer/Core/Make.c
index 5210154..f114a37 100644
--- a/charmonizer/src/Charmonizer/Core/Make.c
+++ b/charmonizer/src/Charmonizer/Core/Make.c
@@ -47,9 +47,10 @@ static struct {
char *make_command;
int is_gnu_make;
int is_nmake;
+ int shell_type;
} chaz_Make = {
NULL,
- 0, 0
+ 0, 0, 0
};
/* Detect make command.
@@ -82,16 +83,24 @@ void
chaz_Make_init(void) {
const char *make;
- chaz_Make_detect("make", "gmake", "nmake", "dmake", NULL);
+ chaz_Make_detect("make", "gmake", "nmake", "dmake", "mingw32-make",
+ "mingw64-make", NULL);
make = chaz_Make.make_command;
if (make) {
- if (strcmp(make, "make") == 0 || strcmp(make, "gmake") == 0) {
+ if (strcmp(make, "make") == 0
+ || strcmp(make, "gmake") == 0
+ || strcmp(make, "mingw32-make") == 0
+ || strcmp(make, "mingw64-make") == 0
+ ) {
/* TODO: Add a feature test for GNU make. */
chaz_Make.is_gnu_make = 1;
+ /* TODO: Feature test which shell GNU make uses on Windows. */
+ chaz_Make.shell_type = CHAZ_OS_POSIX;
}
else if (strcmp(make, "nmake") == 0) {
chaz_Make.is_nmake = 1;
+ chaz_Make.shell_type = CHAZ_OS_CMD_EXE;
}
}
}
@@ -106,6 +115,11 @@ chaz_Make_get_make(void) {
return chaz_Make.make_command;
}
+int
+chaz_Make_shell_type(void) {
+ return chaz_Make.shell_type;
+}
+
static int
chaz_Make_detect(const char *make1, ...) {
va_list args;
@@ -352,7 +366,6 @@ chaz_MakeFile_add_shared_lib(chaz_MakeFile *makefile, const char *name,
void
chaz_MakeFile_write(chaz_MakeFile *makefile) {
- int shell_type = chaz_OS_shell_type();
FILE *out;
size_t i;
@@ -497,18 +510,17 @@ chaz_MakeRule_add_command(chaz_MakeRule *rule, const char *command) {
void
chaz_MakeRule_add_rm_command(chaz_MakeRule *rule, const char *files) {
- int shell_type = chaz_OS_shell_type();
char *command;
- if (shell_type == CHAZ_OS_POSIX) {
+ if (chaz_Make.shell_type == CHAZ_OS_POSIX) {
command = chaz_Util_join(" ", "rm -f", files, NULL);
}
- else if (shell_type == CHAZ_OS_CMD_EXE) {
+ else if (chaz_Make.shell_type == CHAZ_OS_CMD_EXE) {
command = chaz_Util_join("", "for %i in (", files,
") do @if exist %i del /f %i", NULL);
}
else {
- chaz_Util_die("Unsupported shell type: %d", shell_type);
+ chaz_Util_die("Unsupported shell type: %d", chaz_Make.shell_type);
}
chaz_MakeRule_add_command(rule, command);
@@ -517,18 +529,17 @@ chaz_MakeRule_add_rm_command(chaz_MakeRule *rule, const char *files) {
void
chaz_MakeRule_add_recursive_rm_command(chaz_MakeRule *rule, const char *dirs) {
- int shell_type = chaz_OS_shell_type();
char *command;
- if (shell_type == CHAZ_OS_POSIX) {
+ if (chaz_Make.shell_type == CHAZ_OS_POSIX) {
command = chaz_Util_join(" ", "rm -rf", dirs, NULL);
}
- else if (shell_type == CHAZ_OS_CMD_EXE) {
+ else if (chaz_Make.shell_type == CHAZ_OS_CMD_EXE) {
command = chaz_Util_join("", "for %i in (", dirs,
") do @if exist %i rmdir /s /q %i", NULL);
}
else {
- chaz_Util_die("Unsupported shell type: %d", shell_type);
+ chaz_Util_die("Unsupported shell type: %d", chaz_Make.shell_type);
}
chaz_MakeRule_add_command(rule, command);
http://git-wip-us.apache.org/repos/asf/lucy/blob/f776a04e/charmonizer/src/Charmonizer/Core/Make.h
----------------------------------------------------------------------
diff --git a/charmonizer/src/Charmonizer/Core/Make.h b/charmonizer/src/Charmonizer/Core/Make.h
index 97cae84..8df49f6 100644
--- a/charmonizer/src/Charmonizer/Core/Make.h
+++ b/charmonizer/src/Charmonizer/Core/Make.h
@@ -47,6 +47,11 @@ chaz_Make_clean_up(void);
const char*
chaz_Make_get_make(void);
+/** Return the type of shell used by the detected 'make' executable.
+ */
+int
+chaz_Make_shell_type(void);
+
/** Recursively list files in a directory. For every file a callback is called
* with the filename and a context variable.
*
http://git-wip-us.apache.org/repos/asf/lucy/blob/f776a04e/common/charmonizer.main
----------------------------------------------------------------------
diff --git a/common/charmonizer.main b/common/charmonizer.main
index 6ce26e3..eeebf89 100644
--- a/common/charmonizer.main
+++ b/common/charmonizer.main
@@ -376,7 +376,7 @@ S_write_makefile(struct chaz_CLIArgs *args) {
clean_rule = chaz_MakeFile_clean_rule(makefile);
- if (chaz_OS_shell_type() == CHAZ_OS_CMD_EXE) {
+ if (chaz_Make_shell_type() == CHAZ_OS_CMD_EXE) {
/*
* The length of the command would exceed the limit of 8191
* characters. As a work-around, delete all .obj files in BASE_DIR
[lucy-commits] [4/5] git commit: refs/heads/master - Add FIXME comment for FSFolder
test
Posted by nw...@apache.org.
Add FIXME comment for FSFolder test
Project: http://git-wip-us.apache.org/repos/asf/lucy/repo
Commit: http://git-wip-us.apache.org/repos/asf/lucy/commit/81696436
Tree: http://git-wip-us.apache.org/repos/asf/lucy/tree/81696436
Diff: http://git-wip-us.apache.org/repos/asf/lucy/diff/81696436
Branch: refs/heads/master
Commit: 81696436624a9dbfd9c4d08ae6aacfcf6ff1fc61
Parents: 6c134ec
Author: Nick Wellnhofer <we...@aevum.de>
Authored: Sat May 4 23:47:26 2013 +0200
Committer: Nick Wellnhofer <we...@aevum.de>
Committed: Sat May 4 23:53:27 2013 +0200
----------------------------------------------------------------------
core/Lucy/Test/Store/TestFSFolder.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/lucy/blob/81696436/core/Lucy/Test/Store/TestFSFolder.c
----------------------------------------------------------------------
diff --git a/core/Lucy/Test/Store/TestFSFolder.c b/core/Lucy/Test/Store/TestFSFolder.c
index 78b98a0..74165ff 100644
--- a/core/Lucy/Test/Store/TestFSFolder.c
+++ b/core/Lucy/Test/Store/TestFSFolder.c
@@ -76,6 +76,7 @@ static void
S_tear_down() {
struct stat stat_buf;
rmdir("_fstest");
+ /* FIXME: This can fail on Windows. */
if (stat("_fstest", &stat_buf) != -1) {
THROW(ERR, "Can't clean up directory _fstest");
}