nuttx/tools: Fixes for some Windows native build issues from Max Holtzberg
This commit is contained in:
parent
84596e8473
commit
b9a38cea22
3 changed files with 22 additions and 12 deletions
|
@ -6358,4 +6358,6 @@
|
|||
yet work (2014-1-1).
|
||||
* arch/arm/src/stm32/stm32_serial.c: Single-wire UART support from
|
||||
Thomas Grubler (2014-1-2).
|
||||
* tools/configure.c and mkdeps.c: Fixes for Windows build issues
|
||||
from Max Holtzberg (2014-1-4).
|
||||
|
||||
|
|
|
@ -58,6 +58,10 @@
|
|||
|
||||
#define BUFFER_SIZE 1024
|
||||
|
||||
#ifdef WIN32
|
||||
# define strndup(x, y) strdup(x)
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Private Data
|
||||
****************************************************************************/
|
||||
|
@ -630,7 +634,7 @@ static void check_configuration(void)
|
|||
}
|
||||
|
||||
g_srcdefconfig = strdup(g_buffer);
|
||||
|
||||
|
||||
snprintf(g_buffer, BUFFER_SIZE, "%s%cMake.defs", g_configpath, g_delim);
|
||||
debug("check_configuration: Checking %s\n", g_buffer);
|
||||
if (!verify_file(g_buffer))
|
||||
|
@ -789,7 +793,7 @@ static void configure(void)
|
|||
debug("configure: Copying from %s to %s\n", g_srcsetenvsh, g_buffer);
|
||||
copy_file(g_srcsetenvsh, g_buffer, 0755);
|
||||
}
|
||||
|
||||
|
||||
/* Copy the setenv.bat file if have one and need one */
|
||||
|
||||
if (g_srcsetenvbat)
|
||||
|
@ -841,7 +845,7 @@ static void configure(void)
|
|||
}
|
||||
|
||||
/* Open the file for appending */
|
||||
|
||||
|
||||
stream = fopen(destconfig, "a");
|
||||
if (!stream)
|
||||
{
|
||||
|
|
|
@ -54,6 +54,10 @@
|
|||
|
||||
#define MAX_BUFFER (4096)
|
||||
|
||||
#ifdef WIN32
|
||||
# define NAME_MAX FILENAME_MAX
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Private Types
|
||||
****************************************************************************/
|
||||
|
@ -171,7 +175,7 @@ static void append(char **base, char *str)
|
|||
oldbase = *base;
|
||||
if (!oldbase)
|
||||
{
|
||||
newbase = strdup(str);
|
||||
newbase = strdup(str);
|
||||
if (!newbase)
|
||||
{
|
||||
fprintf(stderr, "ERROR: Failed to strdup %s\n", str);
|
||||
|
@ -187,7 +191,7 @@ static void append(char **base, char *str)
|
|||
fprintf(stderr, "ERROR: Failed to allocate %d bytes\n", alloclen);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
|
||||
snprintf(newbase, alloclen, "%s %s\n", oldbase, str);
|
||||
free(oldbase);
|
||||
}
|
||||
|
@ -277,7 +281,7 @@ static void parse_args(int argc, char **argv)
|
|||
}
|
||||
else
|
||||
{
|
||||
append(&g_altpath, argv[argidx]);
|
||||
append(&g_altpath, argv[argidx]);
|
||||
}
|
||||
}
|
||||
else if (strcmp(argv[argidx], "--obj-path") == 0)
|
||||
|
@ -359,7 +363,7 @@ static void parse_args(int argc, char **argv)
|
|||
{
|
||||
fprintf(stderr, " OBJDIR : (None)\n");
|
||||
}
|
||||
|
||||
|
||||
#ifdef HAVE_WINPATH
|
||||
fprintf(stderr, " Windows Paths : [%s]\n", g_winpath ? "TRUE" : "FALSE");
|
||||
if (g_winpath)
|
||||
|
@ -544,7 +548,7 @@ static void do_dependency(const char *file, char separator)
|
|||
totallen, MAX_BUFFER);
|
||||
exit(EXIT_FAILURE);
|
||||
}
|
||||
|
||||
|
||||
strcat(g_command, file);
|
||||
|
||||
/* Check that a file actually exists at this path */
|
||||
|
@ -573,7 +577,7 @@ static void do_dependency(const char *file, char separator)
|
|||
* compiler, system() will return -1; Otherwise, the returned value
|
||||
* from the compiler is in WEXITSTATUS(ret).
|
||||
*/
|
||||
|
||||
|
||||
ret = system(g_command);
|
||||
#ifdef WEXITSTATUS
|
||||
if (ret < 0 || WEXITSTATUS(ret) != 0)
|
||||
|
@ -598,9 +602,9 @@ static void do_dependency(const char *file, char separator)
|
|||
exit(EXIT_FAILURE);
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
/* We don't really know that the command succeeded... Let's assume that it did */
|
||||
|
||||
|
||||
free(alloc);
|
||||
return;
|
||||
}
|
||||
|
@ -632,7 +636,7 @@ static char *cywin2windows(const char *str, const char *append, enum slashmode_e
|
|||
if (append)
|
||||
{
|
||||
char *tmp;
|
||||
|
||||
|
||||
alloclen = sizeof(str) + sizeof(append) + 1;
|
||||
allocpath = (char *)malloc(alloclen);
|
||||
if (!allocpath)
|
||||
|
|
Loading…
Reference in a new issue