Add basic support for spaces in the install path for MinGW.

This patch adds support for spaces in the install path on MinGW.
It does this by converting the Long version of the iverilog path
into a Short version that does not have spaces in it. If we don't
do this then we can not add support for other arguments with
spaces in the path or filename. It also modifies the driver-vpi
program to support spaces in the saved ivl path. This is done by
just enclosing the include and library path argument in double
quotes.

The issue on MinGW is that if you put the executable argument to
system in double quotes to escape embedded spaces then you can
not put the arguments in double quotes as well. If you convert
to a Short name then the spaces are removed and we can in the
future escape the arguments as needed.
(cherry picked from commit dd425e8945)
This commit is contained in:
Cary R 2009-11-28 13:47:41 -08:00 committed by Stephen Williams
parent c7126c3c1f
commit 2396faac39
2 changed files with 10 additions and 8 deletions

View File

@ -410,7 +410,7 @@ static int parse(int argc, char *argv[])
static void checkMingwDir(char *root)
{
int irv, len;
int irv;
struct _stat stat_buf;
char *path, *comp, *cp;
@ -518,16 +518,16 @@ static void setup_ivl_environment()
}
/* Build up the CFLAGS option string */
assign(&gstr.pCFLAGS,IVERILOG_VPI_CFLAGS " -I");
assign(&gstr.pCFLAGS,IVERILOG_VPI_CFLAGS " -I\"");
append(&gstr.pCFLAGS,gstr.pIVL);
appendBackSlash(&gstr.pCFLAGS);
append(&gstr.pCFLAGS,"\\include\\\\iverilog" IVERILOG_SUFFIX);
append(&gstr.pCFLAGS,"\\include\\\\iverilog\"" IVERILOG_SUFFIX);
/* Build up the LDFLAGS option string */
assign(&gstr.pLDLIBS,"-L");
assign(&gstr.pLDLIBS,"-L\"");
append(&gstr.pLDLIBS,gstr.pIVL);
appendBackSlash(&gstr.pLDLIBS);
append(&gstr.pLDLIBS,"\\lib " IVERILOG_VPI_LDLIBS);
append(&gstr.pLDLIBS,"\\lib\" " IVERILOG_VPI_LDLIBS);
}
/* compile source modules */

View File

@ -704,8 +704,8 @@ int main(int argc, char **argv)
#ifdef __MINGW32__
{ char * s;
char basepath[1024];
GetModuleFileName(NULL,basepath,1024);
char basepath[1024], tmp[1024];
GetModuleFileName(NULL, tmp, sizeof(tmp));
/* Calculate the ivl_root from the path to the command. This
is necessary because of the installation process in
@ -722,7 +722,9 @@ int main(int argc, char **argv)
turning the last two \ characters to null. Then we append
the lib\ivl to finish. */
strncpy(ivl_root, basepath, MAXSIZE);
/* Convert to a short name to remove any embedded spaces. */
GetShortPathName(tmp, basepath, sizeof(basepath));
strncpy(ivl_root, basepath, MAXSIZE);
s = strrchr(ivl_root, sep);
if (s) *s = 0;
s = strrchr(ivl_root, sep);