From 26774f2b729d791c9dbf5ba0f7fcf4a59e3795a5 Mon Sep 17 00:00:00 2001 From: Patrick Georgi Date: Sat, 21 Nov 2009 19:54:02 +0000 Subject: 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 Acked-by: Peter Stuge git-svn-id: svn://svn.coreboot.org/coreboot/trunk@4952 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1 --- util/options/build_opt_tbl.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'util/options/build_opt_tbl.c') diff --git a/util/options/build_opt_tbl.c b/util/options/build_opt_tbl.c index 91ce5904ca..b606f8d7b1 100644 --- a/util/options/build_opt_tbl.c +++ b/util/options/build_opt_tbl.c @@ -21,6 +21,19 @@ void test_for_entry_overlaps(void *entry_start, void *entry_end); /* This array is used to isolate bits that are to be changed in a byte */ static unsigned char clip[9]={0,1,3,7,0x0f,0x1f,0x3f,0x7f,0xff}; +#ifdef WIN32 +#include +char* mkstemp(char* name) { + static char val='0'; + char *c=name; + while (*c!='X') c++; + *c=val++; + return open(name,O_CREAT | O_RDWR); +} +#define UNLINK_IF_NECESSARY(x) unlink(x) +#else +#define UNLINK_IF_NECESSARY(x) +#endif /* This routine loops through the entried and tests if any of the fields overlap input entry_start = the memory pointer to the start of the entries. @@ -531,6 +544,7 @@ int main(int argc, char **argv) } fclose(fp); + UNLINK_IF_NECESSARY(option); if (rename(tmpfilename, option)) { fprintf(stderr, "Error - Could not write %s: ", option); perror(NULL); @@ -584,6 +598,7 @@ int main(int argc, char **argv) } fclose(fp); + UNLINK_IF_NECESSARY(header); if (rename(tmpfilename, header)) { fprintf(stderr, "Error - Could not write %s: ", header); perror(NULL); -- cgit v1.2.3