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/07/06 15:40:19 UTC

[1/2] lucy-clownfish git commit: Support MSYS and Cygwin in install script

Repository: lucy-clownfish
Updated Branches:
  refs/heads/master 32391ee98 -> be1957bfb


Support MSYS and Cygwin in install script


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

Branch: refs/heads/master
Commit: f5e6cddb6bd1cc9e970576760451c978ecf7af4f
Parents: 32391ee
Author: Nick Wellnhofer <we...@aevum.de>
Authored: Wed Jul 6 14:04:28 2016 +0200
Committer: Nick Wellnhofer <we...@aevum.de>
Committed: Wed Jul 6 17:21:56 2016 +0200

----------------------------------------------------------------------
 runtime/c/install.bat |  9 ++++++---
 runtime/c/install.sh  | 22 ++++++++++++++++++++++
 2 files changed, 28 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/f5e6cddb/runtime/c/install.bat
----------------------------------------------------------------------
diff --git a/runtime/c/install.bat b/runtime/c/install.bat
index 5530686..98aa582 100644
--- a/runtime/c/install.bat
+++ b/runtime/c/install.bat
@@ -29,13 +29,16 @@ exit /b 1
 :has_prefix
 set prefix=%~2
 
-rem Install libraries.
+mkdir "%prefix%\bin" 2>nul
 mkdir "%prefix%\lib" 2>nul
-copy cfish-%major_version%.dll "%prefix%\lib" >nul
+
+rem Install libraries.
+copy cfish-%major_version%.dll "%prefix%\bin" >nul
+copy libcfish-%major_version%.dll "%prefix%\bin" >nul
 copy cfish-%major_version%.lib "%prefix%\lib" >nul
+copy libcfish-%major_version%.dll.a "%prefix%\lib" >nul
 
 rem Install executables.
-mkdir "%prefix%\bin" 2>nul
 copy ..\..\compiler\c\cfc.exe "%prefix%\bin" >nul
 
 rem Install Clownfish header files.

http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/f5e6cddb/runtime/c/install.sh
----------------------------------------------------------------------
diff --git a/runtime/c/install.sh b/runtime/c/install.sh
index 7b49395..16953eb 100755
--- a/runtime/c/install.sh
+++ b/runtime/c/install.sh
@@ -75,6 +75,28 @@ case `uname` in
         ln -sf $lib_file "$prefix/lib/libcfish.dylib"
         install_name_tool -id "$install_name" "$prefix/lib/$lib_file"
         ;;
+    MINGW*|MSYS*)
+        lib_file=libcfish-$major_version.dll
+        if [ ! -f $lib_file ]; then
+            echo "$lib_file not found. Did you run make?"
+            exit 1
+        fi
+        mkdir -p "$prefix/bin"
+        cp $lib_file "$prefix/bin"
+        mkdir -p "$prefix/lib"
+        cp libcfish-$major_version.dll.a "$prefix/lib"
+        ;;
+    CYGWIN*)
+        lib_file=cygcfish-$major_version.dll
+        if [ ! -f $lib_file ]; then
+            echo "$lib_file not found. Did you run make?"
+            exit 1
+        fi
+        mkdir -p "$prefix/bin"
+        cp $lib_file "$prefix/bin"
+        mkdir -p "$prefix/lib"
+        cp libcfish-$major_version.dll.a "$prefix/lib"
+        ;;
     *)
         lib_file=libcfish.so.$version
         if [ ! -f $lib_file ]; then


[2/2] lucy-clownfish git commit: Use rpath for test executable

Posted by nw...@apache.org.
Use rpath for test executable


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

Branch: refs/heads/master
Commit: be1957bfb5a645167d1dfbe2da1aff4d016bb7e2
Parents: f5e6cdd
Author: Nick Wellnhofer <we...@aevum.de>
Authored: Wed Jul 6 17:30:32 2016 +0200
Committer: Nick Wellnhofer <we...@aevum.de>
Committed: Wed Jul 6 17:37:56 2016 +0200

----------------------------------------------------------------------
 compiler/common/charmonizer.c   | 29 +++++++++++++++++++++++++
 runtime/common/charmonizer.c    | 42 +++++++++++++++++++++++++++---------
 runtime/common/charmonizer.main | 13 +++--------
 3 files changed, 64 insertions(+), 20 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/be1957bf/compiler/common/charmonizer.c
----------------------------------------------------------------------
diff --git a/compiler/common/charmonizer.c b/compiler/common/charmonizer.c
index 19eff00..c224853 100644
--- a/compiler/common/charmonizer.c
+++ b/compiler/common/charmonizer.c
@@ -112,6 +112,9 @@ void
 chaz_CFlags_add_external_lib(chaz_CFlags *flags, const char *library);
 
 void
+chaz_CFlags_add_rpath(chaz_CFlags *flags, const char *path);
+
+void
 chaz_CFlags_enable_code_coverage(chaz_CFlags *flags);
 
 #endif /* H_CHAZ_CFLAGS */
@@ -2024,6 +2027,27 @@ chaz_CFlags_add_external_lib(chaz_CFlags *flags, const char *library) {
 }
 
 void
+chaz_CFlags_add_rpath(chaz_CFlags *flags, const char *path) {
+    char *string;
+
+    if (chaz_CC_binary_format() != CHAZ_CC_BINFMT_ELF) { return; }
+
+    if (flags->style == CHAZ_CFLAGS_STYLE_GNU) {
+        string = chaz_Util_join("", "-Wl,-rpath,", path, NULL);
+    }
+    else if (flags->style == CHAZ_CFLAGS_STYLE_SUN_C) {
+        string = chaz_Util_join(" ", "-R", path, NULL);
+    }
+    else {
+        chaz_Util_die("Don't know how to set rpath with '%s'",
+                      chaz_CC_get_cc());
+    }
+
+    chaz_CFlags_append(flags, string);
+    free(string);
+}
+
+void
 chaz_CFlags_enable_code_coverage(chaz_CFlags *flags) {
     if (flags->style == CHAZ_CFLAGS_STYLE_GNU) {
         chaz_CFlags_append(flags, "--coverage");
@@ -5088,6 +5112,11 @@ chaz_MakeFile_write(chaz_MakeFile *self) {
         chaz_Util_die("Can't open Makefile\n");
     }
 
+    if (chaz_Make.shell_type == CHAZ_OS_CMD_EXE) {
+        /* Make sure that mingw32-make uses the cmd.exe shell. */
+        fprintf(out, "SHELL = cmd\n");
+    }
+
     for (i = 0; self->vars[i]; i++) {
         chaz_MakeVar *var = self->vars[i];
         fprintf(out, "%s = %s\n", var->name, var->value);

http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/be1957bf/runtime/common/charmonizer.c
----------------------------------------------------------------------
diff --git a/runtime/common/charmonizer.c b/runtime/common/charmonizer.c
index fda1309..5bce6b4 100644
--- a/runtime/common/charmonizer.c
+++ b/runtime/common/charmonizer.c
@@ -112,6 +112,9 @@ void
 chaz_CFlags_add_external_lib(chaz_CFlags *flags, const char *library);
 
 void
+chaz_CFlags_add_rpath(chaz_CFlags *flags, const char *path);
+
+void
 chaz_CFlags_enable_code_coverage(chaz_CFlags *flags);
 
 #endif /* H_CHAZ_CFLAGS */
@@ -2024,6 +2027,27 @@ chaz_CFlags_add_external_lib(chaz_CFlags *flags, const char *library) {
 }
 
 void
+chaz_CFlags_add_rpath(chaz_CFlags *flags, const char *path) {
+    char *string;
+
+    if (chaz_CC_binary_format() != CHAZ_CC_BINFMT_ELF) { return; }
+
+    if (flags->style == CHAZ_CFLAGS_STYLE_GNU) {
+        string = chaz_Util_join("", "-Wl,-rpath,", path, NULL);
+    }
+    else if (flags->style == CHAZ_CFLAGS_STYLE_SUN_C) {
+        string = chaz_Util_join(" ", "-R", path, NULL);
+    }
+    else {
+        chaz_Util_die("Don't know how to set rpath with '%s'",
+                      chaz_CC_get_cc());
+    }
+
+    chaz_CFlags_append(flags, string);
+    free(string);
+}
+
+void
 chaz_CFlags_enable_code_coverage(chaz_CFlags *flags) {
     if (flags->style == CHAZ_CFLAGS_STYLE_GNU) {
         chaz_CFlags_append(flags, "--coverage");
@@ -5088,6 +5112,11 @@ chaz_MakeFile_write(chaz_MakeFile *self) {
         chaz_Util_die("Can't open Makefile\n");
     }
 
+    if (chaz_Make.shell_type == CHAZ_OS_CMD_EXE) {
+        /* Make sure that mingw32-make uses the cmd.exe shell. */
+        fprintf(out, "SHELL = cmd\n");
+    }
+
     for (i = 0; self->vars[i]; i++) {
         chaz_MakeVar *var = self->vars[i];
         fprintf(out, "%s = %s\n", var->name, var->value);
@@ -9044,8 +9073,6 @@ cfish_MakeFile_write_c_test_rules(cfish_MakeFile *self) {
     chaz_CFlags     *link_cflags;
     chaz_MakeRule   *rule;
 
-    const char *test_command;
-
     exe = chaz_MakeFile_add_exe(self->makefile, "t", "test_cfish");
     chaz_MakeBinary_add_src_file(exe, "t", "test_cfish.c");
     chaz_MakeFile_add_rule(self->makefile, "$(TEST_CFISH_EXE_OBJS)",
@@ -9053,16 +9080,11 @@ cfish_MakeFile_write_c_test_rules(cfish_MakeFile *self) {
     link_cflags = chaz_MakeBinary_get_link_flags(exe);
     chaz_CFlags_add_shared_lib(link_cflags, NULL, "cfish",
                                cfish_major_version);
+    chaz_CFlags_add_rpath(link_cflags, "\"$$PWD\"");
     chaz_MakeBinary_add_prereq(exe, "$(CFISH_SHARED_LIB)");
 
     rule = chaz_MakeFile_add_rule(self->makefile, "test", "$(TEST_CFISH_EXE)");
-    if (chaz_CC_binary_format() == CHAZ_CC_BINFMT_ELF) {
-        test_command = "LD_LIBRARY_PATH=. $(TEST_CFISH_EXE)";
-    }
-    else {
-        test_command = "$(TEST_CFISH_EXE)";
-    }
-    chaz_MakeRule_add_command(rule, test_command);
+    chaz_MakeRule_add_command(rule, "$(TEST_CFISH_EXE)");
 
     if (chaz_OS_shell_type() == CHAZ_OS_POSIX) {
         const char *valgrind_command;
@@ -9091,7 +9113,7 @@ cfish_MakeFile_write_c_test_rules(cfish_MakeFile *self) {
                                   "lcov"
                                   " --zerocounters"
                                   " --directory $(BASE_DIR)");
-        chaz_MakeRule_add_command(rule, test_command);
+        chaz_MakeRule_add_command(rule, "$(TEST_CFISH_EXE)");
         chaz_MakeRule_add_command(rule,
                                   "lcov"
                                   " --capture"

http://git-wip-us.apache.org/repos/asf/lucy-clownfish/blob/be1957bf/runtime/common/charmonizer.main
----------------------------------------------------------------------
diff --git a/runtime/common/charmonizer.main b/runtime/common/charmonizer.main
index 7c8bdc7..e777c52 100644
--- a/runtime/common/charmonizer.main
+++ b/runtime/common/charmonizer.main
@@ -464,8 +464,6 @@ cfish_MakeFile_write_c_test_rules(cfish_MakeFile *self) {
     chaz_CFlags     *link_cflags;
     chaz_MakeRule   *rule;
 
-    const char *test_command;
-
     exe = chaz_MakeFile_add_exe(self->makefile, "t", "test_cfish");
     chaz_MakeBinary_add_src_file(exe, "t", "test_cfish.c");
     chaz_MakeFile_add_rule(self->makefile, "$(TEST_CFISH_EXE_OBJS)",
@@ -473,16 +471,11 @@ cfish_MakeFile_write_c_test_rules(cfish_MakeFile *self) {
     link_cflags = chaz_MakeBinary_get_link_flags(exe);
     chaz_CFlags_add_shared_lib(link_cflags, NULL, "cfish",
                                cfish_major_version);
+    chaz_CFlags_add_rpath(link_cflags, "\"$$PWD\"");
     chaz_MakeBinary_add_prereq(exe, "$(CFISH_SHARED_LIB)");
 
     rule = chaz_MakeFile_add_rule(self->makefile, "test", "$(TEST_CFISH_EXE)");
-    if (chaz_CC_binary_format() == CHAZ_CC_BINFMT_ELF) {
-        test_command = "LD_LIBRARY_PATH=. $(TEST_CFISH_EXE)";
-    }
-    else {
-        test_command = "$(TEST_CFISH_EXE)";
-    }
-    chaz_MakeRule_add_command(rule, test_command);
+    chaz_MakeRule_add_command(rule, "$(TEST_CFISH_EXE)");
 
     if (chaz_OS_shell_type() == CHAZ_OS_POSIX) {
         const char *valgrind_command;
@@ -511,7 +504,7 @@ cfish_MakeFile_write_c_test_rules(cfish_MakeFile *self) {
                                   "lcov"
                                   " --zerocounters"
                                   " --directory $(BASE_DIR)");
-        chaz_MakeRule_add_command(rule, test_command);
+        chaz_MakeRule_add_command(rule, "$(TEST_CFISH_EXE)");
         chaz_MakeRule_add_command(rule,
                                   "lcov"
                                   " --capture"