Make the kconfig-style build work in mingw:
* use relative paths in ldscript.ld and crt0_includes.h
* avoid use of dd(1) in xcompile
* build libregex for kconfig, if necessary
* work around missing utsname on win32
* unlink targets before rename on win32
* implement (crude) mkstemp for win32
* avoid open/read/close, use fopen/fread/fclose instead
* don't free certain data structures in romcc on win32 to
avoid crashes (likely use-after-free())
* handle "\CRLF" and win32 style absolute paths (X:/ or X:\)
in romcc
* make lzma (part of cbfstool) build on XP
* implement ntohl/htonl on win32
* handle CRLF in awk script
* set larger stack for romcc on win32
Signed-off-by: Patrick Georgi <patrick.georgi@coresystems.de>
Acked-by: Peter Stuge <peter@stuge.se>
git-svn-id: svn://svn.coreboot.org/coreboot/trunk@4952 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
diff --git a/util/kconfig/confdata.c b/util/kconfig/confdata.c
index 05c2601..56a0eb0 100644
--- a/util/kconfig/confdata.c
+++ b/util/kconfig/confdata.c
@@ -15,6 +15,13 @@
#define LKC_DIRECT_LINK
#include "lkc.h"
+#ifdef WIN32
+#define mkdir(x,y) mkdir(x)
+#define UNLINK_IF_NECESSARY(x) unlink(x)
+#else
+#define UNLINK_IF_NECESSARY(X)
+#endif
+
static void conf_warning(const char *fmt, ...)
__attribute__ ((format (printf, 1, 2)));
@@ -539,6 +546,7 @@
if (*tmpname) {
strcat(dirname, basename);
strcat(dirname, ".old");
+ UNLINK_IF_NECESSARY(dirname);
rename(newname, dirname);
if (rename(tmpname, newname))
return 1;
@@ -775,6 +783,7 @@
name = getenv("KCONFIG_AUTOHEADER");
if (!name)
name = "include/linux/autoconf.h";
+ UNLINK_IF_NECESSARY(name);
if (rename(".tmpconfig.h", name))
return 1;
name = getenv("KCONFIG_AUTOCONFIG");
@@ -784,6 +793,7 @@
* This must be the last step, kbuild has a dependency on auto.conf
* and this marks the successful completion of the previous steps.
*/
+ UNLINK_IF_NECESSARY(name);
if (rename(".tmpconfig", name))
return 1;