Fix add_command_with_libpath on Cygwin Fixes LUCY-303.
Project: http://git-wip-us.apache.org/repos/asf/lucy-charmonizer/repo Commit: http://git-wip-us.apache.org/repos/asf/lucy-charmonizer/commit/76e4dbe3 Tree: http://git-wip-us.apache.org/repos/asf/lucy-charmonizer/tree/76e4dbe3 Diff: http://git-wip-us.apache.org/repos/asf/lucy-charmonizer/diff/76e4dbe3 Branch: refs/heads/master Commit: 76e4dbe39532675b31f7756cb3f84f8fea3807e4 Parents: e3b5715 Author: Nick Wellnhofer <[email protected]> Authored: Tue May 31 12:40:51 2016 +0200 Committer: Nick Wellnhofer <[email protected]> Committed: Thu Jun 2 00:03:56 2016 +0200 ---------------------------------------------------------------------- src/Charmonizer/Core/Make.c | 28 ++++++++++++++++++++-------- 1 file changed, 20 insertions(+), 8 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/lucy-charmonizer/blob/76e4dbe3/src/Charmonizer/Core/Make.c ---------------------------------------------------------------------- diff --git a/src/Charmonizer/Core/Make.c b/src/Charmonizer/Core/Make.c index d72cccc..1c1d728 100644 --- a/src/Charmonizer/Core/Make.c +++ b/src/Charmonizer/Core/Make.c @@ -688,15 +688,27 @@ chaz_MakeRule_add_command_with_libpath(chaz_MakeRule *rule, free(path); } else if (binfmt == CHAZ_CC_BINFMT_PE) { - va_start(args, command); - path = chaz_Util_vjoin(";", args); - va_end(args); + if (chaz_Make.shell_type == CHAZ_OS_CMD_EXE) { + va_start(args, command); + path = chaz_Util_vjoin(";", args); + va_end(args); + + /* 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 { + va_start(args, command); + path = chaz_Util_vjoin(":", args); + va_end(args); - /* 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); + lib_command = chaz_Util_join("", "PATH=", path, ":$$PATH ", + command, NULL); + } + + free(path); } else { /* Assume that library paths are compiled into the executable on
