{"thread":{"id":"20946","subject":"[RFC/PATCH v2 00/17] Build Git with MSVC","startedAt":"2009-09-14T13:11:13Z","lastAt":"2009-09-15T05:59:26Z","messageCount":35,"participants":["Marius Storm-Olsen","Alex Riesen","Frank Li","Alexey Borzenkov","Junio C Hamano","Johannes Sixt","Johannes Schindelin"],"isPatch":true,"patchVersion":2,"patchTotal":17},"messages":[{"id":"123152","messageId":"cover.1252925290.git.mstormo@gmail.com","threadId":"20946","inReplyTo":null,"subject":"[RFC/PATCH v2 00/17] Build Git with MSVC","fromName":"Marius Storm-Olsen","fromEmail":"mstormo@gmail.com","sentAt":"2009-09-14T13:11:13Z","receivedAt":"2009-09-14T13:11:13Z","isPatch":true,"sender":{"key":"mstormo@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1500?v=4"},"body":"\nHere's a second roll of the series for supporting compilation of Git\nusing Visual C++ (MSVC). (Sorry for the long delay on a followup, time\nis in short supply these days)\n\nThere's no guarantee that the compiled result will work as well as the\ncurrent MinGW compile, or at all. However, I think it's important to\nget the Git repo to a compilable state with MSVC as quickly as\npossible, to further enable contributions from the Windows developers\nwhich we are sorely lacking at the moment.\nI hope that a repo which compiles successfully with the tools they are\naccustomed to (also a very good debugger) will entice them to send more\npatches.\n\nIn addition to this series, I have also setup a repo with binaries of\nthe required libs to compile Git with MSVC. Only 32bit versions for now.\nSo, the developer can choose to either use that, or Frank's source code\nrepo to build Git with MSVC. You'll find the binary repo here:\n    http://repo.or.cz/w/msvcgit.git\n\nNote that the binaries will still require the msysgit environment for\nexecution, due to the non-binary components of Git. (Scripts, gitk,\ngit-gui, etc). You'll find that repo here:\n    http://repo.or.cz/w/msysgit.git\n\n=== V2 2009.09.14 ===\n1) Rebased ontop on current git.git 'next'.\n2) Fixed code and commit msgs based on the previous feedback.\n   Let me know if I forgot anything!\n3) Added a proper Makefile patch for MSVC support.\n   You now compile with 'make MSVC=1'.\n4) Added perl scripts (contrib) which uses GNU Make output to generate\n   MSVC IDE (.sln & .vcproj) projects and QMake projects, and picking\n   up the project settings from the Makefile, so it's all in one place.\n5) Added necessary patches to make things compile ontop of current\n   'next'.\n\n=== V1 2009.08.21 ===\nSo, Frank Li started this series, and I took it upon my self to help\nout a bit; cleaning, reorganizing, rebasing the series. Hopefully\nwe're now a bit closer to including the series into mainline..\n\nHere's a summary of what has happend:\n1) This series is rebased ontop of git.git 'next', which needed an\n   extra patch to avoid a non-constant array creation, which\n   mscv doesn't like.\n2) I've polished (tied to anyways) the commit messages a bit.\n3) I've applied much of the feedback provided to the first round of\n   the patches.\n4) I've split, merged and reordered some of the patches, so things\n   that belong together are in the same commits, and in a order of\n   'importance'\n5) I've removed the\n       #define func _func\n   stuff, as it's not needed and Microsoft cannot really kill the\n   compatibility functions anyways. So, adding the define\n       _CRT_NONSTDC_NO_DEPRECATE\n   will kill the warnings seen without the defines above.\n6) ..probably much more as well, but I forget..\n\nNote: I did not sign off on the last two commits, which involve the\nadding of the vcproj files, since I don't agree on adding them as is.\nWe need a Makefile way of compiling primarily, and second, a script\nto generate the vcproj, as already discussed. But the commits are\nincluded for completeness, at to let others compile and play with it.\n\nI've kept the original author as is, and just signed the patches..\nThanks for watching, now bring on the comments!\n\nFrank Li (8):\n  Avoid declaration after statement\n  Define SNPRINTF_SIZE_CORR=1 for Microsoft Visual C++\n  Change regerror() declaration from K&R style to ANSI C (C89)\n  mingw.c: Use the O_BINARY flag to open files\n  Fix __stdcall/WINAPI placement and function prototype\n  Test for WIN32 instead of __MINGW32_\n  Add MinGW header files to build git with MSVC\n  Add platform files for MSVC porting\n\nMarius Storm-Olsen (9):\n  boolean is a typedef under MSVC, so rename variable to 'i_boolean'\n  Add define guards to compat/win32.h\n  Add empty header files for MSVC port\n  Make usage of windows.h lean and mean\n  Define strncasecmp as _strnicmp for MSVC\n  Add ftruncate implementation for MSVC\n  Add MSVC to Makefile\n  Add README for MSVC build\n  Add scripts to generate projects for other buildsystems (MSVC vcproj,\n    QMake)\n\n .gitignore                                |   11 +\n Makefile                                  |   54 +++-\n compat/mingw.c                            |   22 +-\n compat/mingw.h                            |    2 +\n compat/msvc.c                             |   43 ++\n compat/msvc.h                             |   51 +++\n compat/regex/regex.c                      |    7 +-\n compat/snprintf.c                         |   10 +-\n compat/vcbuild/README                     |   50 +++\n compat/vcbuild/include/alloca.h           |    1 +\n compat/vcbuild/include/arpa/inet.h        |    1 +\n compat/vcbuild/include/dirent.h           |  128 ++++++\n compat/vcbuild/include/grp.h              |    1 +\n compat/vcbuild/include/inttypes.h         |    1 +\n compat/vcbuild/include/netdb.h            |    1 +\n compat/vcbuild/include/netinet/in.h       |    1 +\n compat/vcbuild/include/netinet/tcp.h      |    1 +\n compat/vcbuild/include/pwd.h              |    1 +\n compat/vcbuild/include/sys/ioctl.h        |    1 +\n compat/vcbuild/include/sys/param.h        |    1 +\n compat/vcbuild/include/sys/poll.h         |    1 +\n compat/vcbuild/include/sys/select.h       |    1 +\n compat/vcbuild/include/sys/socket.h       |    1 +\n compat/vcbuild/include/sys/time.h         |    1 +\n compat/vcbuild/include/sys/utime.h        |   34 ++\n compat/vcbuild/include/sys/wait.h         |    1 +\n compat/vcbuild/include/unistd.h           |   92 ++++\n compat/vcbuild/include/utime.h            |    1 +\n compat/vcbuild/scripts/clink.pl           |   48 +++\n compat/vcbuild/scripts/lib.pl             |   26 ++\n compat/win32.h                            |    7 +\n compat/winansi.c                          |    1 -\n contrib/buildsystems/Generators.pm        |   42 ++\n contrib/buildsystems/Generators/QMake.pm  |  189 +++++++++\n contrib/buildsystems/Generators/Vcproj.pm |  639 +++++++++++++++++++++++++++++\n contrib/buildsystems/engine.pl            |  353 ++++++++++++++++\n contrib/buildsystems/generate             |   29 ++\n contrib/buildsystems/parse.pl             |  228 ++++++++++\n git-compat-util.h                         |    9 +\n help.c                                    |    5 +-\n pager.c                                   |    4 +-\n run-command.c                             |   12 +-\n run-command.h                             |    2 +-\n setup.c                                   |    2 +-\n test-parse-options.c                      |   12 +-\n thread-utils.c                            |    5 +-\n 46 files changed, 2094 insertions(+), 39 deletions(-)\n create mode 100644 compat/msvc.c\n create mode 100644 compat/msvc.h\n create mode 100644 compat/vcbuild/README\n create mode 100644 compat/vcbuild/include/alloca.h\n create mode 100644 compat/vcbuild/include/arpa/inet.h\n create mode 100644 compat/vcbuild/include/dirent.h\n create mode 100644 compat/vcbuild/include/grp.h\n create mode 100644 compat/vcbuild/include/inttypes.h\n create mode 100644 compat/vcbuild/include/netdb.h\n create mode 100644 compat/vcbuild/include/netinet/in.h\n create mode 100644 compat/vcbuild/include/netinet/tcp.h\n create mode 100644 compat/vcbuild/include/pwd.h\n create mode 100644 compat/vcbuild/include/sys/ioctl.h\n create mode 100644 compat/vcbuild/include/sys/param.h\n create mode 100644 compat/vcbuild/include/sys/poll.h\n create mode 100644 compat/vcbuild/include/sys/select.h\n create mode 100644 compat/vcbuild/include/sys/socket.h\n create mode 100644 compat/vcbuild/include/sys/time.h\n create mode 100644 compat/vcbuild/include/sys/utime.h\n create mode 100644 compat/vcbuild/include/sys/wait.h\n create mode 100644 compat/vcbuild/include/unistd.h\n create mode 100644 compat/vcbuild/include/utime.h\n create mode 100644 compat/vcbuild/scripts/clink.pl\n create mode 100644 compat/vcbuild/scripts/lib.pl\n create mode 100644 contrib/buildsystems/Generators.pm\n create mode 100644 contrib/buildsystems/Generators/QMake.pm\n create mode 100644 contrib/buildsystems/Generators/Vcproj.pm\n create mode 100644 contrib/buildsystems/engine.pl\n create mode 100644 contrib/buildsystems/generate\n create mode 100644 contrib/buildsystems/parse.pl\n"},{"id":"123153","messageId":"1b36d8e041c9c1a6dc68f9cc3919fcf91b7a9ac6.1252925290.git.mstormo@gmail.com","threadId":"20946","inReplyTo":"cover.1252925290.git.mstormo@gmail.com","subject":"[PATCH 01/17] Avoid declaration after statement","fromName":"Marius Storm-Olsen","fromEmail":"mstormo@gmail.com","sentAt":"2009-09-14T13:11:14Z","receivedAt":"2009-09-14T13:11:14Z","isPatch":true,"sender":{"key":"mstormo@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1500?v=4"},"body":"From: Frank Li <lznuaa@gmail.com>\n\nMicrosoft Visual C++ does not understand this C99 style\n\nSigned-off-by: Frank Li <lznuaa@gmail.com>\nSigned-off-by: Marius Storm-Olsen <mstormo@gmail.com>\n---\n compat/mingw.c |   14 ++++++++++----\n help.c         |    3 ++-\n run-command.c  |    2 ++\n 3 files changed, 14 insertions(+), 5 deletions(-)\n\ndiff --git a/compat/mingw.c b/compat/mingw.c\nindex 36ef8d3..5478b74 100644\n--- a/compat/mingw.c\n+++ b/compat/mingw.c\n@@ -123,13 +123,17 @@ int mingw_open (const char *filename, int oflags, ...)\n {\n \tva_list args;\n \tunsigned mode;\n+\tint fd;\n+\n \tva_start(args, oflags);\n \tmode = va_arg(args, int);\n \tva_end(args);\n \n \tif (!strcmp(filename, \"/dev/null\"))\n \t\tfilename = \"nul\";\n-\tint fd = open(filename, oflags, mode);\n+\n+\tfd = open(filename, oflags, mode);\n+\n \tif (fd < 0 && (oflags & O_CREAT) && errno == EACCES) {\n \t\tDWORD attrs = GetFileAttributes(filename);\n \t\tif (attrs != INVALID_FILE_ATTRIBUTES && (attrs & FILE_ATTRIBUTE_DIRECTORY))\n@@ -580,10 +584,11 @@ static char **get_path_split(void)\n \n static void free_path_split(char **path)\n {\n+\tchar **p = path;\n+\n \tif (!path)\n \t\treturn;\n \n-\tchar **p = path;\n \twhile (*p)\n \t\tfree(*p++);\n \tfree(path);\n@@ -1120,9 +1125,9 @@ int sigaction(int sig, struct sigaction *in, struct sigaction *out)\n #undef signal\n sig_handler_t mingw_signal(int sig, sig_handler_t handler)\n {\n+\tsig_handler_t old = timer_fn;\n \tif (sig != SIGALRM)\n \t\treturn signal(sig, handler);\n-\tsig_handler_t old = timer_fn;\n \ttimer_fn = handler;\n \treturn old;\n }\n@@ -1209,8 +1214,9 @@ struct dirent *mingw_readdir(DIR *dir)\n \n \tif (dir->dd_handle == (long)INVALID_HANDLE_VALUE && dir->dd_stat == 0)\n \t{\n+\t\tDWORD lasterr;\n \t\thandle = FindFirstFileA(dir->dd_name, &buf);\n-\t\tDWORD lasterr = GetLastError();\n+\t\tlasterr = GetLastError();\n \t\tdir->dd_handle = (long)handle;\n \t\tif (handle == INVALID_HANDLE_VALUE && (lasterr != ERROR_NO_MORE_FILES)) {\n \t\t\terrno = err_win_to_posix(lasterr);\ndiff --git a/help.c b/help.c\nindex 294337e..fd51b8e 100644\n--- a/help.c\n+++ b/help.c\n@@ -127,7 +127,7 @@ static int is_executable(const char *name)\n \t\treturn 0;\n \n #ifdef __MINGW32__\n-\t/* cannot trust the executable bit, peek into the file instead */\n+{\t/* cannot trust the executable bit, peek into the file instead */\n \tchar buf[3] = { 0 };\n \tint n;\n \tint fd = open(name, O_RDONLY);\n@@ -140,6 +140,7 @@ static int is_executable(const char *name)\n \t\t\t\tst.st_mode |= S_IXUSR;\n \t\tclose(fd);\n \t}\n+}\n #endif\n \treturn st.st_mode & S_IXUSR;\n }\ndiff --git a/run-command.c b/run-command.c\nindex ac314a5..02aaedf 100644\n--- a/run-command.c\n+++ b/run-command.c\n@@ -134,6 +134,7 @@ fail_pipe:\n \t\terror(\"cannot fork() for %s: %s\", cmd->argv[0],\n \t\t\tstrerror(failed_errno = errno));\n #else\n+{\n \tint s0 = -1, s1 = -1, s2 = -1;\t/* backups of stdin, stdout, stderr */\n \tconst char **sargv = cmd->argv;\n \tchar **env = environ;\n@@ -197,6 +198,7 @@ fail_pipe:\n \t\tdup2(s1, 1), close(s1);\n \tif (s2 >= 0)\n \t\tdup2(s2, 2), close(s2);\n+}\n #endif\n \n \tif (cmd->pid < 0) {\n-- \n1.6.2.1.418.g33d56.dirty\n"},{"id":"123155","messageId":"7786dfa1b74b5c4974bcf2018d3991c215a9466f.1252925290.git.mstormo@gmail.com","threadId":"20946","inReplyTo":"1b36d8e041c9c1a6dc68f9cc3919fcf91b7a9ac6.1252925290.git.mstormo@gmail.com","subject":"[PATCH 02/17] boolean is a typedef under MSVC, so rename variable to 'i_boolean'","fromName":"Marius Storm-Olsen","fromEmail":"mstormo@gmail.com","sentAt":"2009-09-14T13:11:15Z","receivedAt":"2009-09-14T13:11:15Z","isPatch":true,"sender":{"key":"mstormo@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1500?v=4"},"body":"With MSVC 'boolean' is already a typedef to unsigned char in\nthe rpcndr.h in the SDK. So, just rename to 'i_boolean' to avoid\nconflicts in this one file, instead of any include magic.\n\nSigned-off-by: Marius Storm-Olsen <mstormo@gmail.com>\n---\n test-parse-options.c |   12 ++++++------\n 1 files changed, 6 insertions(+), 6 deletions(-)\n\ndiff --git a/test-parse-options.c b/test-parse-options.c\nindex efa734b..0c2d327 100644\n--- a/test-parse-options.c\n+++ b/test-parse-options.c\n@@ -1,7 +1,7 @@\n #include \"cache.h\"\n #include \"parse-options.h\"\n \n-static int boolean = 0;\n+static int i_boolean = 0;\n static int integer = 0;\n static unsigned long timestamp;\n static int abbrev = 7;\n@@ -34,10 +34,10 @@ int main(int argc, const char **argv)\n \t\tNULL\n \t};\n \tstruct option options[] = {\n-\t\tOPT_BOOLEAN('b', \"boolean\", &boolean, \"get a boolean\"),\n-\t\tOPT_BIT('4', \"or4\", &boolean,\n+\t\tOPT_BOOLEAN('b', \"boolean\", &i_boolean, \"get a boolean\"),\n+\t\tOPT_BIT('4', \"or4\", &i_boolean,\n \t\t\t\"bitwise-or boolean with ...0100\", 4),\n-\t\tOPT_NEGBIT(0, \"neg-or4\", &boolean, \"same as --no-or4\", 4),\n+\t\tOPT_NEGBIT(0, \"neg-or4\", &i_boolean, \"same as --no-or4\", 4),\n \t\tOPT_GROUP(\"\"),\n \t\tOPT_INTEGER('i', \"integer\", &integer, \"get a integer\"),\n \t\tOPT_INTEGER('j', NULL, &integer, \"get a integer, too\"),\n@@ -57,7 +57,7 @@ int main(int argc, const char **argv)\n \t\tOPT_ARGUMENT(\"quux\", \"means --quux\"),\n \t\tOPT_NUMBER_CALLBACK(&integer, \"set integer to NUM\",\n \t\t\tnumber_callback),\n-\t\t{ OPTION_BOOLEAN, '+', NULL, &boolean, NULL, \"same as -b\",\n+\t\t{ OPTION_BOOLEAN, '+', NULL, &i_boolean, NULL, \"same as -b\",\n \t\t  PARSE_OPT_NOARG | PARSE_OPT_NONEG | PARSE_OPT_NODASH },\n \t\tOPT_GROUP(\"Standard options\"),\n \t\tOPT__ABBREV(&abbrev),\n@@ -70,7 +70,7 @@ int main(int argc, const char **argv)\n \n \targc = parse_options(argc, argv, prefix, options, usage, 0);\n \n-\tprintf(\"boolean: %d\\n\", boolean);\n+\tprintf(\"boolean: %d\\n\", i_boolean);\n \tprintf(\"integer: %u\\n\", integer);\n \tprintf(\"timestamp: %lu\\n\", timestamp);\n \tprintf(\"string: %s\\n\", string ? string : \"(not set)\");\n-- \n1.6.2.1.418.g33d56.dirty\n"},{"id":"123154","messageId":"e2eff51e8d956e7cf854bea9fb9f10491f6d6543.1252925290.git.mstormo@gmail.com","threadId":"20946","inReplyTo":"7786dfa1b74b5c4974bcf2018d3991c215a9466f.1252925290.git.mstormo@gmail.com","subject":"[PATCH 03/17] Define SNPRINTF_SIZE_CORR=1 for Microsoft Visual C++","fromName":"Marius Storm-Olsen","fromEmail":"mstormo@gmail.com","sentAt":"2009-09-14T13:11:16Z","receivedAt":"2009-09-14T13:11:16Z","isPatch":true,"sender":{"key":"mstormo@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1500?v=4"},"body":"From: Frank Li <lznuaa@gmail.com>\n\nMicrosoft's vsnprintf function does not add NUL at the end\nof the buffer, if the result fits the buffer size exactly.\n\nSigned-off-by: Frank Li <lznuaa@gmail.com>\nSigned-off-by: Marius Storm-Olsen <mstormo@gmail.com>\n---\n compat/snprintf.c |   10 ++++++----\n 1 files changed, 6 insertions(+), 4 deletions(-)\n\ndiff --git a/compat/snprintf.c b/compat/snprintf.c\nindex 4d07087..e1e0e75 100644\n--- a/compat/snprintf.c\n+++ b/compat/snprintf.c\n@@ -2,12 +2,14 @@\n \n /*\n  * The size parameter specifies the available space, i.e. includes\n- * the trailing NUL byte; but Windows's vsnprintf expects the\n- * number of characters to write, and does not necessarily write the\n- * trailing NUL.\n+ * the trailing NUL byte; but Windows's vsnprintf uses the entire\n+ * buffer and avoids the trailing NUL, should the buffer be exactly\n+ * big enough for the result. Defining SNPRINTF_SIZE_CORR to 1 will\n+ * therefore remove 1 byte from the reported buffer size, so we\n+ * always have room for a trailing NUL byte.\n  */\n #ifndef SNPRINTF_SIZE_CORR\n-#if defined(__MINGW32__) && defined(__GNUC__) && __GNUC__ < 4\n+#if defined(WIN32) && (!defined(__GNUC__) || __GNUC__ < 4)\n #define SNPRINTF_SIZE_CORR 1\n #else\n #define SNPRINTF_SIZE_CORR 0\n-- \n1.6.2.1.418.g33d56.dirty\n"},{"id":"123156","messageId":"baa73a58d459d9cd29227b1f0fb02306c14db807.1252925290.git.mstormo@gmail.com","threadId":"20946","inReplyTo":"e2eff51e8d956e7cf854bea9fb9f10491f6d6543.1252925290.git.mstormo@gmail.com","subject":"[PATCH 04/17] Add define guards to compat/win32.h","fromName":"Marius Storm-Olsen","fromEmail":"mstormo@gmail.com","sentAt":"2009-09-14T13:11:17Z","receivedAt":"2009-09-14T13:11:17Z","isPatch":true,"sender":{"key":"mstormo@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1500?v=4"},"body":"Signed-off-by: Marius Storm-Olsen <mstormo@gmail.com>\n---\n compat/win32.h |    5 +++++\n 1 files changed, 5 insertions(+), 0 deletions(-)\n\ndiff --git a/compat/win32.h b/compat/win32.h\nindex c26384e..e8c178d 100644\n--- a/compat/win32.h\n+++ b/compat/win32.h\n@@ -1,3 +1,6 @@\n+#ifndef WIN32_H\n+#define WIN32_H\n+\n /* common Win32 functions for MinGW and Cygwin */\n #include <windows.h>\n \n@@ -32,3 +35,5 @@ static inline int get_file_attr(const char *fname, WIN32_FILE_ATTRIBUTE_DATA *fd\n \t\treturn ENOENT;\n \t}\n }\n+\n+#endif\n-- \n1.6.2.1.418.g33d56.dirty\n"},{"id":"123157","messageId":"54b586ed58d1e9b4204658871f6f34453b48758b.1252925290.git.mstormo@gmail.com","threadId":"20946","inReplyTo":"baa73a58d459d9cd29227b1f0fb02306c14db807.1252925290.git.mstormo@gmail.com","subject":"[PATCH 05/17] Change regerror() declaration from K&R style to ANSI C (C89)","fromName":"Marius Storm-Olsen","fromEmail":"mstormo@gmail.com","sentAt":"2009-09-14T13:11:18Z","receivedAt":"2009-09-14T13:11:18Z","isPatch":true,"sender":{"key":"mstormo@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1500?v=4"},"body":"From: Frank Li <lznuaa@gmail.com>\n\nThe MSVC headers typedef errcode as int, and thus confused the\ncompiler in the K&R style definition. ANSI style deconfuses it.\n\nSigned-off-by: Frank Li <lznuaa@gmail.com>\nSigned-off-by: Marius Storm-Olsen <mstormo@gmail.com>\n---\n compat/regex/regex.c |    7 ++-----\n 1 files changed, 2 insertions(+), 5 deletions(-)\n\ndiff --git a/compat/regex/regex.c b/compat/regex/regex.c\nindex 5ea0075..67d5c37 100644\n--- a/compat/regex/regex.c\n+++ b/compat/regex/regex.c\n@@ -4852,11 +4852,8 @@ regexec (preg, string, nmatch, pmatch, eflags)\n    from either regcomp or regexec.   We don't use PREG here.  */\n \n size_t\n-regerror (errcode, preg, errbuf, errbuf_size)\n-    int errcode;\n-    const regex_t *preg;\n-    char *errbuf;\n-    size_t errbuf_size;\n+regerror(int errcode, const regex_t *preg,\n+\t char *errbuf, size_t errbuf_size)\n {\n   const char *msg;\n   size_t msg_size;\n-- \n1.6.2.1.418.g33d56.dirty\n"},{"id":"123159","messageId":"160ceafba5f58cfcadb13380e3d8ef724009b700.1252925290.git.mstormo@gmail.com","threadId":"20946","inReplyTo":"54b586ed58d1e9b4204658871f6f34453b48758b.1252925290.git.mstormo@gmail.com","subject":"[PATCH 06/17] mingw.c: Use the O_BINARY flag to open files","fromName":"Marius Storm-Olsen","fromEmail":"mstormo@gmail.com","sentAt":"2009-09-14T13:11:19Z","receivedAt":"2009-09-14T13:11:19Z","isPatch":true,"sender":{"key":"mstormo@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1500?v=4"},"body":"\nFrom: Frank Li <lznuaa@gmail.com>\n\nOn Windows, binary files must be opened using the O_BINARY flag for\nuntranslated mode. MinGW does this for us automatically, but Microsoft\nVisual C++ does not.\n\nSigned-off-by: Frank Li <lznuaa@gmail.com>\nSigned-off-by: Marius Storm-Olsen <mstormo@gmail.com>\n---\n compat/mingw.c |    4 ++--\n 1 files changed, 2 insertions(+), 2 deletions(-)\n\ndiff --git a/compat/mingw.c b/compat/mingw.c\nindex 5478b74..12db9a6 100644\n--- a/compat/mingw.c\n+++ b/compat/mingw.c\n@@ -132,7 +132,7 @@ int mingw_open (const char *filename, int oflags, ...)\n \tif (!strcmp(filename, \"/dev/null\"))\n \t\tfilename = \"nul\";\n \n-\tfd = open(filename, oflags, mode);\n+\tfd = open(filename, oflags | O_BINARY, mode);\n \n \tif (fd < 0 && (oflags & O_CREAT) && errno == EACCES) {\n \t\tDWORD attrs = GetFileAttributes(filename);\n@@ -278,7 +278,7 @@ int mkstemp(char *template)\n \tchar *filename = mktemp(template);\n \tif (filename == NULL)\n \t\treturn -1;\n-\treturn open(filename, O_RDWR | O_CREAT, 0600);\n+\treturn open(filename, O_RDWR | O_CREAT | O_BINARY, 0600);\n }\n \n int gettimeofday(struct timeval *tv, void *tz)\n-- \n1.6.2.1.418.g33d56.dirty\n"},{"id":"123158","messageId":"1d699897d4163224ce22db9400569fab20547e9d.1252925290.git.mstormo@gmail.com","threadId":"20946","inReplyTo":"160ceafba5f58cfcadb13380e3d8ef724009b700.1252925290.git.mstormo@gmail.com","subject":"[PATCH 07/17] Fix __stdcall/WINAPI placement and function prototype","fromName":"Marius Storm-Olsen","fromEmail":"mstormo@gmail.com","sentAt":"2009-09-14T13:11:20Z","receivedAt":"2009-09-14T13:11:20Z","isPatch":true,"sender":{"key":"mstormo@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1500?v=4"},"body":"\nFrom: Frank Li <lznuaa@gmail.com>\n\nWINAPI is a macro which translates into the proper calling convention, so\nreplace __stdcall with that.\n\nMSVC requires WINAPI to be between the functions return value and the\nfunction name, and that the function pointer type is in the form of\n    return_type (WINAPI *function_name)(arguments...)\n\nSigned-off-by: Frank Li <lznuaa@gmail.com>\nSigned-off-by: Marius Storm-Olsen <mstormo@gmail.com>\n---\n compat/mingw.c |    4 ++--\n run-command.c  |    2 +-\n 2 files changed, 3 insertions(+), 3 deletions(-)\n\ndiff --git a/compat/mingw.c b/compat/mingw.c\nindex 12db9a6..90764eb 100644\n--- a/compat/mingw.c\n+++ b/compat/mingw.c\n@@ -1029,7 +1029,7 @@ static sig_handler_t timer_fn = SIG_DFL;\n  * length to call the signal handler.\n  */\n \n-static __stdcall unsigned ticktack(void *dummy)\n+static unsigned WINAPI ticktack(void *dummy)\n {\n \twhile (WaitForSingleObject(timer_event, timer_interval) == WAIT_TIMEOUT) {\n \t\tif (timer_fn == SIG_DFL)\n@@ -1156,7 +1156,7 @@ void mingw_open_html(const char *unixpath)\n \n int link(const char *oldpath, const char *newpath)\n {\n-\ttypedef BOOL WINAPI (*T)(const char*, const char*, LPSECURITY_ATTRIBUTES);\n+\ttypedef BOOL (WINAPI *T)(const char*, const char*, LPSECURITY_ATTRIBUTES);\n \tstatic T create_hard_link = NULL;\n \tif (!create_hard_link) {\n \t\tcreate_hard_link = (T) GetProcAddress(\ndiff --git a/run-command.c b/run-command.c\nindex 02aaedf..91f6d2e 100644\n--- a/run-command.c\n+++ b/run-command.c\n@@ -316,7 +316,7 @@ int run_command_v_opt_cd_env(const char **argv, int opt, const char *dir, const\n }\n \n #ifdef __MINGW32__\n-static __stdcall unsigned run_thread(void *data)\n+static unsigned WINAPI run_thread(void *data)\n {\n \tstruct async *async = data;\n \treturn async->proc(async->fd_for_proc, async->data);\n-- \n1.6.2.1.418.g33d56.dirty\n"},{"id":"123161","messageId":"8da5dcea21ce49b3a57fd224c088785a9f98e867.1252925290.git.mstormo@gmail.com","threadId":"20946","inReplyTo":"1d699897d4163224ce22db9400569fab20547e9d.1252925290.git.mstormo@gmail.com","subject":"[PATCH 08/17] Test for WIN32 instead of __MINGW32_","fromName":"Marius Storm-Olsen","fromEmail":"mstormo@gmail.com","sentAt":"2009-09-14T13:11:21Z","receivedAt":"2009-09-14T13:11:21Z","isPatch":true,"sender":{"key":"mstormo@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1500?v=4"},"body":"\nFrom: Frank Li <lznuaa@gmail.com>\n\nThe code which is conditional on MinGW32 is actually conditional on Windows.\nUse the WIN32 symbol, which is defined by the MINGW32 and MSVC environments,\nbut not by Cygwin.\n\nSigned-off-by: Frank Li <lznuaa@gmail.com>\nSigned-off-by: Marius Storm-Olsen <mstormo@gmail.com>\n---\n help.c        |    2 +-\n pager.c       |    4 ++--\n run-command.c |    8 ++++----\n run-command.h |    2 +-\n setup.c       |    2 +-\n 5 files changed, 9 insertions(+), 9 deletions(-)\n\ndiff --git a/help.c b/help.c\nindex fd51b8e..e8db31f 100644\n--- a/help.c\n+++ b/help.c\n@@ -126,7 +126,7 @@ static int is_executable(const char *name)\n \t    !S_ISREG(st.st_mode))\n \t\treturn 0;\n \n-#ifdef __MINGW32__\n+#ifdef WIN32\n {\t/* cannot trust the executable bit, peek into the file instead */\n \tchar buf[3] = { 0 };\n \tint n;\ndiff --git a/pager.c b/pager.c\nindex f416d38..86facec 100644\n--- a/pager.c\n+++ b/pager.c\n@@ -9,7 +9,7 @@\n \n static int spawned_pager;\n \n-#ifndef __MINGW32__\n+#ifndef WIN32\n static void pager_preexec(void)\n {\n \t/*\n@@ -72,7 +72,7 @@ void setup_pager(void)\n \t\tstatic const char *env[] = { \"LESS=FRSX\", NULL };\n \t\tpager_process.env = env;\n \t}\n-#ifndef __MINGW32__\n+#ifndef WIN32\n \tpager_process.preexec_cb = pager_preexec;\n #endif\n \tif (start_command(&pager_process))\ndiff --git a/run-command.c b/run-command.c\nindex 91f6d2e..cb006e7 100644\n--- a/run-command.c\n+++ b/run-command.c\n@@ -75,7 +75,7 @@ fail_pipe:\n \n \ttrace_argv_printf(cmd->argv, \"trace: run_command:\");\n \n-#ifndef __MINGW32__\n+#ifndef WIN32\n \tfflush(NULL);\n \tcmd->pid = fork();\n \tif (!cmd->pid) {\n@@ -315,7 +315,7 @@ int run_command_v_opt_cd_env(const char **argv, int opt, const char *dir, const\n \treturn run_command(&cmd);\n }\n \n-#ifdef __MINGW32__\n+#ifdef WIN32\n static unsigned WINAPI run_thread(void *data)\n {\n \tstruct async *async = data;\n@@ -331,7 +331,7 @@ int start_async(struct async *async)\n \t\treturn error(\"cannot create pipe: %s\", strerror(errno));\n \tasync->out = pipe_out[0];\n \n-#ifndef __MINGW32__\n+#ifndef WIN32\n \t/* Flush stdio before fork() to avoid cloning buffers */\n \tfflush(NULL);\n \n@@ -360,7 +360,7 @@ int start_async(struct async *async)\n \n int finish_async(struct async *async)\n {\n-#ifndef __MINGW32__\n+#ifndef WIN32\n \tint ret = wait_or_whine(async->pid, \"child process\", 0);\n #else\n \tDWORD ret = 0;\ndiff --git a/run-command.h b/run-command.h\nindex 0c00b25..fb34209 100644\n--- a/run-command.h\n+++ b/run-command.h\n@@ -70,7 +70,7 @@ struct async {\n \tint (*proc)(int fd, void *data);\n \tvoid *data;\n \tint out;\t/* caller reads from here and closes it */\n-#ifndef __MINGW32__\n+#ifndef WIN32\n \tpid_t pid;\n #else\n \tHANDLE tid;\ndiff --git a/setup.c b/setup.c\nindex e3781b6..029371e 100644\n--- a/setup.c\n+++ b/setup.c\n@@ -41,7 +41,7 @@ const char *prefix_path(const char *prefix, int len, const char *path)\n const char *prefix_filename(const char *pfx, int pfx_len, const char *arg)\n {\n \tstatic char path[PATH_MAX];\n-#ifndef __MINGW32__\n+#ifndef WIN32\n \tif (!pfx || !*pfx || is_absolute_path(arg))\n \t\treturn arg;\n \tmemcpy(path, pfx, pfx_len);\n-- \n1.6.2.1.418.g33d56.dirty\n"},{"id":"123160","messageId":"a48108513bf13247ba9b42fd703ba679804e8d8a.1252925290.git.mstormo@gmail.com","threadId":"20946","inReplyTo":"8da5dcea21ce49b3a57fd224c088785a9f98e867.1252925290.git.mstormo@gmail.com","subject":"[PATCH 09/17] Add empty header files for MSVC port","fromName":"Marius Storm-Olsen","fromEmail":"mstormo@gmail.com","sentAt":"2009-09-14T13:11:22Z","receivedAt":"2009-09-14T13:11:22Z","isPatch":true,"sender":{"key":"mstormo@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1500?v=4"},"body":"\nMSVC lacks many of the header files included by git-compat-util.h,\nso add blank header files for these instead of going ifdef crazy.\n\nSigned-off-by: Marius Storm-Olsen <mstormo@gmail.com>\n---\n compat/vcbuild/include/arpa/inet.h   |    1 +\n compat/vcbuild/include/grp.h         |    1 +\n compat/vcbuild/include/inttypes.h    |    1 +\n compat/vcbuild/include/netdb.h       |    1 +\n compat/vcbuild/include/netinet/in.h  |    1 +\n compat/vcbuild/include/netinet/tcp.h |    1 +\n compat/vcbuild/include/pwd.h         |    1 +\n compat/vcbuild/include/sys/ioctl.h   |    1 +\n compat/vcbuild/include/sys/param.h   |    1 +\n compat/vcbuild/include/sys/poll.h    |    1 +\n compat/vcbuild/include/sys/select.h  |    1 +\n compat/vcbuild/include/sys/socket.h  |    1 +\n compat/vcbuild/include/sys/time.h    |    1 +\n compat/vcbuild/include/sys/wait.h    |    1 +\n 14 files changed, 14 insertions(+), 0 deletions(-)\n create mode 100644 compat/vcbuild/include/arpa/inet.h\n create mode 100644 compat/vcbuild/include/grp.h\n create mode 100644 compat/vcbuild/include/inttypes.h\n create mode 100644 compat/vcbuild/include/netdb.h\n create mode 100644 compat/vcbuild/include/netinet/in.h\n create mode 100644 compat/vcbuild/include/netinet/tcp.h\n create mode 100644 compat/vcbuild/include/pwd.h\n create mode 100644 compat/vcbuild/include/sys/ioctl.h\n create mode 100644 compat/vcbuild/include/sys/param.h\n create mode 100644 compat/vcbuild/include/sys/poll.h\n create mode 100644 compat/vcbuild/include/sys/select.h\n create mode 100644 compat/vcbuild/include/sys/socket.h\n create mode 100644 compat/vcbuild/include/sys/time.h\n create mode 100644 compat/vcbuild/include/sys/wait.h\n\ndiff --git a/compat/vcbuild/include/arpa/inet.h b/compat/vcbuild/include/arpa/inet.h\nnew file mode 100644\nindex 0000000..0d8552a\n--- /dev/null\n+++ b/compat/vcbuild/include/arpa/inet.h\n@@ -0,0 +1 @@\n+/* Intentionally empty file to support building git with MSVC */\ndiff --git a/compat/vcbuild/include/grp.h b/compat/vcbuild/include/grp.h\nnew file mode 100644\nindex 0000000..0d8552a\n--- /dev/null\n+++ b/compat/vcbuild/include/grp.h\n@@ -0,0 +1 @@\n+/* Intentionally empty file to support building git with MSVC */\ndiff --git a/compat/vcbuild/include/inttypes.h b/compat/vcbuild/include/inttypes.h\nnew file mode 100644\nindex 0000000..0d8552a\n--- /dev/null\n+++ b/compat/vcbuild/include/inttypes.h\n@@ -0,0 +1 @@\n+/* Intentionally empty file to support building git with MSVC */\ndiff --git a/compat/vcbuild/include/netdb.h b/compat/vcbuild/include/netdb.h\nnew file mode 100644\nindex 0000000..0d8552a\n--- /dev/null\n+++ b/compat/vcbuild/include/netdb.h\n@@ -0,0 +1 @@\n+/* Intentionally empty file to support building git with MSVC */\ndiff --git a/compat/vcbuild/include/netinet/in.h b/compat/vcbuild/include/netinet/in.h\nnew file mode 100644\nindex 0000000..0d8552a\n--- /dev/null\n+++ b/compat/vcbuild/include/netinet/in.h\n@@ -0,0 +1 @@\n+/* Intentionally empty file to support building git with MSVC */\ndiff --git a/compat/vcbuild/include/netinet/tcp.h b/compat/vcbuild/include/netinet/tcp.h\nnew file mode 100644\nindex 0000000..0d8552a\n--- /dev/null\n+++ b/compat/vcbuild/include/netinet/tcp.h\n@@ -0,0 +1 @@\n+/* Intentionally empty file to support building git with MSVC */\ndiff --git a/compat/vcbuild/include/pwd.h b/compat/vcbuild/include/pwd.h\nnew file mode 100644\nindex 0000000..0d8552a\n--- /dev/null\n+++ b/compat/vcbuild/include/pwd.h\n@@ -0,0 +1 @@\n+/* Intentionally empty file to support building git with MSVC */\ndiff --git a/compat/vcbuild/include/sys/ioctl.h b/compat/vcbuild/include/sys/ioctl.h\nnew file mode 100644\nindex 0000000..0d8552a\n--- /dev/null\n+++ b/compat/vcbuild/include/sys/ioctl.h\n@@ -0,0 +1 @@\n+/* Intentionally empty file to support building git with MSVC */\ndiff --git a/compat/vcbuild/include/sys/param.h b/compat/vcbuild/include/sys/param.h\nnew file mode 100644\nindex 0000000..0d8552a\n--- /dev/null\n+++ b/compat/vcbuild/include/sys/param.h\n@@ -0,0 +1 @@\n+/* Intentionally empty file to support building git with MSVC */\ndiff --git a/compat/vcbuild/include/sys/poll.h b/compat/vcbuild/include/sys/poll.h\nnew file mode 100644\nindex 0000000..0d8552a\n--- /dev/null\n+++ b/compat/vcbuild/include/sys/poll.h\n@@ -0,0 +1 @@\n+/* Intentionally empty file to support building git with MSVC */\ndiff --git a/compat/vcbuild/include/sys/select.h b/compat/vcbuild/include/sys/select.h\nnew file mode 100644\nindex 0000000..0d8552a\n--- /dev/null\n+++ b/compat/vcbuild/include/sys/select.h\n@@ -0,0 +1 @@\n+/* Intentionally empty file to support building git with MSVC */\ndiff --git a/compat/vcbuild/include/sys/socket.h b/compat/vcbuild/include/sys/socket.h\nnew file mode 100644\nindex 0000000..0d8552a\n--- /dev/null\n+++ b/compat/vcbuild/include/sys/socket.h\n@@ -0,0 +1 @@\n+/* Intentionally empty file to support building git with MSVC */\ndiff --git a/compat/vcbuild/include/sys/time.h b/compat/vcbuild/include/sys/time.h\nnew file mode 100644\nindex 0000000..0d8552a\n--- /dev/null\n+++ b/compat/vcbuild/include/sys/time.h\n@@ -0,0 +1 @@\n+/* Intentionally empty file to support building git with MSVC */\ndiff --git a/compat/vcbuild/include/sys/wait.h b/compat/vcbuild/include/sys/wait.h\nnew file mode 100644\nindex 0000000..0d8552a\n--- /dev/null\n+++ b/compat/vcbuild/include/sys/wait.h\n@@ -0,0 +1 @@\n+/* Intentionally empty file to support building git with MSVC */\n-- \n1.6.2.1.418.g33d56.dirty\n"},{"id":"123164","messageId":"aed24a7f9524c9872f8a2455cfc5dd8baf6c3c0b.1252925290.git.mstormo@gmail.com","threadId":"20946","inReplyTo":"a48108513bf13247ba9b42fd703ba679804e8d8a.1252925290.git.mstormo@gmail.com","subject":"[PATCH 10/17] Add MinGW header files to build git with MSVC","fromName":"Marius Storm-Olsen","fromEmail":"mstormo@gmail.com","sentAt":"2009-09-14T13:11:23Z","receivedAt":"2009-09-14T13:11:23Z","isPatch":true,"sender":{"key":"mstormo@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1500?v=4"},"body":"\nFrom: Frank Li <lznuaa@gmail.com>\n\nAdded the header files dirent.h, unistd.h and utime.h\nAdd alloca.h, which simply includes malloc.h, which defines alloca\n\nSigned-off-by: Frank Li <lznuaa@gmail.com>\nSigned-off-by: Marius Storm-Olsen <mstormo@gmail.com>\n---\n compat/vcbuild/include/alloca.h    |    1 +\n compat/vcbuild/include/dirent.h    |  128 ++++++++++++++++++++++++++++++++++++\n compat/vcbuild/include/sys/utime.h |   34 ++++++++++\n compat/vcbuild/include/unistd.h    |   92 ++++++++++++++++++++++++++\n compat/vcbuild/include/utime.h     |    1 +\n 5 files changed, 256 insertions(+), 0 deletions(-)\n create mode 100644 compat/vcbuild/include/alloca.h\n create mode 100644 compat/vcbuild/include/dirent.h\n create mode 100644 compat/vcbuild/include/sys/utime.h\n create mode 100644 compat/vcbuild/include/unistd.h\n create mode 100644 compat/vcbuild/include/utime.h\n\ndiff --git a/compat/vcbuild/include/alloca.h b/compat/vcbuild/include/alloca.h\nnew file mode 100644\nindex 0000000..c0d7985\n--- /dev/null\n+++ b/compat/vcbuild/include/alloca.h\n@@ -0,0 +1 @@\n+#include <malloc.h>\ndiff --git a/compat/vcbuild/include/dirent.h b/compat/vcbuild/include/dirent.h\nnew file mode 100644\nindex 0000000..440618d\n--- /dev/null\n+++ b/compat/vcbuild/include/dirent.h\n@@ -0,0 +1,128 @@\n+/*\n+ * DIRENT.H (formerly DIRLIB.H)\n+ * This file has no copyright assigned and is placed in the Public Domain.\n+ * This file is a part of the mingw-runtime package.\n+ *\n+ * The mingw-runtime package and its code is distributed in the hope that it\n+ * will be useful but WITHOUT ANY WARRANTY.  ALL WARRANTIES, EXPRESSED OR\n+ * IMPLIED ARE HEREBY DISCLAIMED.  This includes but is not limited to\n+ * warranties of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n+ *\n+ * You are free to use this package and its code without limitation.\n+ */\n+#ifndef _DIRENT_H_\n+#define _DIRENT_H_\n+#include <io.h>\n+\n+#define PATH_MAX 512\n+\n+#define __MINGW_NOTHROW\n+\n+#ifndef RC_INVOKED\n+\n+#ifdef __cplusplus\n+extern \"C\" {\n+#endif\n+\n+struct dirent\n+{\n+\tlong\t\td_ino;\t\t/* Always zero. */\n+\tunsigned short\td_reclen;\t/* Always zero. */\n+\tunsigned short\td_namlen;\t/* Length of name in d_name. */\n+\tchar\t\td_name[FILENAME_MAX]; /* File name. */\n+};\n+\n+/*\n+ * This is an internal data structure. Good programmers will not use it\n+ * except as an argument to one of the functions below.\n+ * dd_stat field is now int (was short in older versions).\n+ */\n+typedef struct\n+{\n+\t/* disk transfer area for this dir */\n+\tstruct _finddata_t\tdd_dta;\n+\n+\t/* dirent struct to return from dir (NOTE: this makes this thread\n+\t * safe as long as only one thread uses a particular DIR struct at\n+\t * a time) */\n+\tstruct dirent\t\tdd_dir;\n+\n+\t/* _findnext handle */\n+\tlong\t\t\tdd_handle;\n+\n+\t/*\n+\t * Status of search:\n+\t *   0 = not started yet (next entry to read is first entry)\n+\t *  -1 = off the end\n+\t *   positive = 0 based index of next entry\n+\t */\n+\tint\t\t\tdd_stat;\n+\n+\t/* given path for dir with search pattern (struct is extended) */\n+\tchar\t\t\tdd_name[PATH_MAX+3];\n+} DIR;\n+\n+DIR* __cdecl __MINGW_NOTHROW opendir (const char*);\n+struct dirent* __cdecl __MINGW_NOTHROW readdir (DIR*);\n+int __cdecl __MINGW_NOTHROW closedir (DIR*);\n+void __cdecl __MINGW_NOTHROW rewinddir (DIR*);\n+long __cdecl __MINGW_NOTHROW telldir (DIR*);\n+void __cdecl __MINGW_NOTHROW seekdir (DIR*, long);\n+\n+\n+/* wide char versions */\n+\n+struct _wdirent\n+{\n+\tlong\t\td_ino;\t\t/* Always zero. */\n+\tunsigned short\td_reclen;\t/* Always zero. */\n+\tunsigned short\td_namlen;\t/* Length of name in d_name. */\n+\twchar_t\t\td_name[FILENAME_MAX]; /* File name. */\n+};\n+\n+/*\n+ * This is an internal data structure. Good programmers will not use it\n+ * except as an argument to one of the functions below.\n+ */\n+typedef struct\n+{\n+\t/* disk transfer area for this dir */\n+\t//struct _wfinddata_t\tdd_dta;\n+\n+\t/* dirent struct to return from dir (NOTE: this makes this thread\n+\t * safe as long as only one thread uses a particular DIR struct at\n+\t * a time) */\n+\tstruct _wdirent\t\tdd_dir;\n+\n+\t/* _findnext handle */\n+\tlong\t\t\tdd_handle;\n+\n+\t/*\n+\t * Status of search:\n+\t *   0 = not started yet (next entry to read is first entry)\n+\t *  -1 = off the end\n+\t *   positive = 0 based index of next entry\n+\t */\n+\tint\t\t\tdd_stat;\n+\n+\t/* given path for dir with search pattern (struct is extended) */\n+\twchar_t\t\t\tdd_name[1];\n+} _WDIR;\n+\n+\n+\n+_WDIR* __cdecl __MINGW_NOTHROW _wopendir (const wchar_t*);\n+struct _wdirent*  __cdecl __MINGW_NOTHROW _wreaddir (_WDIR*);\n+int __cdecl __MINGW_NOTHROW _wclosedir (_WDIR*);\n+void __cdecl __MINGW_NOTHROW _wrewinddir (_WDIR*);\n+long __cdecl __MINGW_NOTHROW _wtelldir (_WDIR*);\n+void __cdecl __MINGW_NOTHROW _wseekdir (_WDIR*, long);\n+\n+\n+#ifdef\t__cplusplus\n+}\n+#endif\n+\n+#endif\t/* Not RC_INVOKED */\n+\n+#endif\t/* Not _DIRENT_H_ */\ndiff --git a/compat/vcbuild/include/sys/utime.h b/compat/vcbuild/include/sys/utime.h\nnew file mode 100644\nindex 0000000..582589c\n--- /dev/null\n+++ b/compat/vcbuild/include/sys/utime.h\n@@ -0,0 +1,34 @@\n+#ifndef\t_UTIME_H_\n+#define\t_UTIME_H_\n+/*\n+ * UTIME.H\n+ * This file has no copyright assigned and is placed in the Public Domain.\n+ * This file is a part of the mingw-runtime package.\n+ *\n+ * The mingw-runtime package and its code is distributed in the hope that it\n+ * will be useful but WITHOUT ANY WARRANTY.  ALL WARRANTIES, EXPRESSED OR\n+ * IMPLIED ARE HEREBY DISCLAIMED.  This includes but is not limited to\n+ * warranties of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n+ *\n+ * You are free to use this package and its code without limitation.\n+ */\n+\n+/*\n+ * Structure used by _utime function.\n+ */\n+struct _utimbuf\n+{\n+\ttime_t\tactime;\t\t/* Access time */\n+\ttime_t\tmodtime;\t/* Modification time */\n+};\n+\n+#ifndef\t_NO_OLDNAMES\n+/* NOTE: Must be the same as _utimbuf above. */\n+struct utimbuf\n+{\n+\ttime_t\tactime;\n+\ttime_t\tmodtime;\n+};\n+#endif\t/* Not _NO_OLDNAMES */\n+\n+#endif\ndiff --git a/compat/vcbuild/include/unistd.h b/compat/vcbuild/include/unistd.h\nnew file mode 100644\nindex 0000000..2a4f276\n--- /dev/null\n+++ b/compat/vcbuild/include/unistd.h\n@@ -0,0 +1,92 @@\n+#ifndef _UNISTD_\n+#define _UNISTD_\n+\n+/* Win32 define for porting git*/\n+\n+#ifndef _MODE_T_\n+#define\t_MODE_T_\n+typedef unsigned short _mode_t;\n+\n+#ifndef\t_NO_OLDNAMES\n+typedef _mode_t\tmode_t;\n+#endif\n+#endif\t/* Not _MODE_T_ */\n+\n+#ifndef _SSIZE_T_\n+#define _SSIZE_T_\n+typedef long _ssize_t;\n+\n+#ifndef\t_OFF_T_\n+#define\t_OFF_T_\n+typedef long _off_t;\n+\n+#ifndef\t_NO_OLDNAMES\n+typedef _off_t\toff_t;\n+#endif\n+#endif\t/* Not _OFF_T_ */\n+\n+\n+#ifndef\t_NO_OLDNAMES\n+typedef _ssize_t ssize_t;\n+#endif\n+#endif /* Not _SSIZE_T_ */\n+\n+typedef signed char int8_t;\n+typedef unsigned char   uint8_t;\n+typedef short  int16_t;\n+typedef unsigned short  uint16_t;\n+typedef int  int32_t;\n+typedef unsigned   uint32_t;\n+typedef long long  int64_t;\n+typedef unsigned long long   uint64_t;\n+\n+typedef long long  intmax_t;\n+typedef unsigned long long uintmax_t;\n+\n+typedef int64_t off64_t;\n+\n+#define STDOUT_FILENO 1\n+#define STDERR_FILENO 2\n+\n+/* Some defines for _access nAccessMode (MS doesn't define them, but\n+ * it doesn't seem to hurt to add them). */\n+#define\tF_OK\t0\t/* Check for file existence */\n+/* Well maybe it does hurt.  On newer versions of MSVCRT, an access mode\n+   of 1 causes invalid parameter error. */\n+#define\tX_OK\t0\t/* MS access() doesn't check for execute permission. */\n+#define\tW_OK\t2\t/* Check for write permission */\n+#define\tR_OK\t4\t/* Check for read permission */\n+\n+#define\t_S_IFIFO\t0x1000\t/* FIFO */\n+#define\t_S_IFCHR\t0x2000\t/* Character */\n+#define\t_S_IFBLK\t0x3000\t/* Block: Is this ever set under w32? */\n+#define\t_S_IFDIR\t0x4000\t/* Directory */\n+#define\t_S_IFREG\t0x8000\t/* Regular */\n+\n+#define\t_S_IFMT\t\t0xF000\t/* File type mask */\n+\n+#define\t_S_IXUSR\t_S_IEXEC\n+#define\t_S_IWUSR\t_S_IWRITE\n+#define\t_S_IRUSR\t_S_IREAD\n+#define\t_S_ISDIR(m)\t(((m) & _S_IFMT) == _S_IFDIR)\n+\n+#define\tS_IFIFO\t\t_S_IFIFO\n+#define\tS_IFCHR\t\t_S_IFCHR\n+#define\tS_IFBLK\t\t_S_IFBLK\n+#define\tS_IFDIR\t\t_S_IFDIR\n+#define\tS_IFREG\t\t_S_IFREG\n+#define\tS_IFMT\t\t_S_IFMT\n+#define\tS_IEXEC\t\t_S_IEXEC\n+#define\tS_IWRITE\t_S_IWRITE\n+#define\tS_IREAD\t\t_S_IREAD\n+#define\tS_IRWXU\t\t_S_IRWXU\n+#define\tS_IXUSR\t\t_S_IXUSR\n+#define\tS_IWUSR\t\t_S_IWUSR\n+#define\tS_IRUSR\t\t_S_IRUSR\n+\n+\n+#define\tS_ISDIR(m)\t(((m) & S_IFMT) == S_IFDIR)\n+#define\tS_ISREG(m)\t(((m) & S_IFMT) == S_IFREG)\n+#define\tS_ISFIFO(m)\t(((m) & S_IFMT) == S_IFIFO)\n+\n+#endif\ndiff --git a/compat/vcbuild/include/utime.h b/compat/vcbuild/include/utime.h\nnew file mode 100644\nindex 0000000..8285f38\n--- /dev/null\n+++ b/compat/vcbuild/include/utime.h\n@@ -0,0 +1 @@\n+#include <sys/utime.h>\n-- \n1.6.2.1.418.g33d56.dirty\n"},{"id":"123162","messageId":"4931b7ac3102ee259353fe6b3c5ceeb2a67c53ba.1252925290.git.mstormo@gmail.com","threadId":"20946","inReplyTo":"aed24a7f9524c9872f8a2455cfc5dd8baf6c3c0b.1252925290.git.mstormo@gmail.com","subject":"[PATCH 11/17] Add platform files for MSVC porting","fromName":"Marius Storm-Olsen","fromEmail":"mstormo@gmail.com","sentAt":"2009-09-14T13:11:24Z","receivedAt":"2009-09-14T13:11:24Z","isPatch":true,"sender":{"key":"mstormo@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1500?v=4"},"body":"\nFrom: Frank Li <lznuaa@gmail.com>\n\nAdd msvc.c and msvc.h to build git under MSVC\n\nSigned-off-by: Frank Li <lznuaa@gmail.com>\nSigned-off-by: Marius Storm-Olsen <mstormo@gmail.com>\n---\n compat/msvc.c     |   35 +++++++++++++++++++++++++++++++++\n compat/msvc.h     |   55 +++++++++++++++++++++++++++++++++++++++++++++++++++++\n git-compat-util.h |    3 ++\n 3 files changed, 93 insertions(+), 0 deletions(-)\n create mode 100644 compat/msvc.c\n create mode 100644 compat/msvc.h\n\ndiff --git a/compat/msvc.c b/compat/msvc.c\nnew file mode 100644\nindex 0000000..ac04a4c\n--- /dev/null\n+++ b/compat/msvc.c\n@@ -0,0 +1,35 @@\n+#include \"../git-compat-util.h\"\n+#include \"win32.h\"\n+#include <conio.h>\n+#include \"../strbuf.h\"\n+\n+DIR *opendir(const char *name)\n+{\n+\tint len;\n+\tDIR *p;\n+\tp = (DIR*)malloc(sizeof(DIR));\n+\tmemset(p, 0, sizeof(DIR));\n+\tstrncpy(p->dd_name, name, PATH_MAX);\n+\tlen = strlen(p->dd_name);\n+\tp->dd_name[len] = '/';\n+\tp->dd_name[len+1] = '*';\n+\n+\tif (p == NULL)\n+\t\treturn NULL;\n+\n+\tp->dd_handle = _findfirst(p->dd_name, &p->dd_dta);\n+\n+\tif (p->dd_handle == -1) {\n+\t\tfree(p);\n+\t\treturn NULL;\n+\t}\n+\treturn p;\n+}\n+int closedir(DIR *dir)\n+{\n+\t_findclose(dir->dd_handle);\n+\tfree(dir);\n+\treturn 0;\n+}\n+\n+#include \"mingw.c\"\ndiff --git a/compat/msvc.h b/compat/msvc.h\nnew file mode 100644\nindex 0000000..6daf313\n--- /dev/null\n+++ b/compat/msvc.h\n@@ -0,0 +1,55 @@\n+#ifndef __MSVC__HEAD\n+#define __MSVC__HEAD\n+\n+/* Define minimize windows version */\n+#define WINVER 0x0500\n+#define _WIN32_WINNT 0x0500\n+#define _WIN32_WINDOWS 0x0410\n+#define _WIN32_IE 0x0700\n+#define NTDDI_VERSION NTDDI_WIN2KSP1\n+#include <winsock2.h>\n+#include <direct.h>\n+#include <process.h>\n+#include <malloc.h>\n+\n+/* porting function */\n+#define inline __inline\n+#define __inline__ __inline\n+#define __attribute__(x)\n+#define va_copy(dst, src)     ((dst) = (src))\n+\n+static __inline int strcasecmp (const char *s1, const char *s2)\n+{\n+\tint size1 = strlen(s1);\n+\tint sisz2 = strlen(s2);\n+\treturn _strnicmp(s1, s2, sisz2 > size1 ? sisz2 : size1);\n+}\n+\n+#undef ERROR\n+#undef stat\n+#undef _stati64\n+#include \"compat/mingw.h\"\n+#undef stat\n+#define stat _stati64\n+#define _stat64(x,y) mingw_lstat(x,y)\n+\n+/*\n+   Even though _stati64 is normally just defined at _stat64\n+   on Windows, we specify it here as a proper struct to avoid\n+   compiler warnings about macro redefinition due to magic in\n+   mingw.h. Struct taken from ReactOS (GNU GPL license).\n+*/\n+struct _stati64 {\n+\t_dev_t  st_dev;\n+\t_ino_t  st_ino;\n+\tunsigned short st_mode;\n+\tshort   st_nlink;\n+\tshort   st_uid;\n+\tshort   st_gid;\n+\t_dev_t  st_rdev;\n+\t__int64 st_size;\n+\ttime_t  st_atime;\n+\ttime_t  st_mtime;\n+\ttime_t  st_ctime;\n+};\n+#endif\ndiff --git a/git-compat-util.h b/git-compat-util.h\nindex e5e9f39..8ea444f 100644\n--- a/git-compat-util.h\n+++ b/git-compat-util.h\n@@ -113,6 +113,9 @@\n /* pull in Windows compatibility stuff */\n #include \"compat/mingw.h\"\n #endif\t/* __MINGW32__ */\n+#ifdef _MSC_VER\n+#include \"compat/msvc.h\"\n+#endif\n \n #ifndef NO_LIBGEN_H\n #include <libgen.h>\n-- \n1.6.2.1.418.g33d56.dirty\n"},{"id":"123163","messageId":"1b5c5e90392e813ffab4fd510b70e57903a451cc.1252925290.git.mstormo@gmail.com","threadId":"20946","inReplyTo":"4931b7ac3102ee259353fe6b3c5ceeb2a67c53ba.1252925290.git.mstormo@gmail.com","subject":"[PATCH 12/17] Make usage of windows.h lean and mean","fromName":"Marius Storm-Olsen","fromEmail":"mstormo@gmail.com","sentAt":"2009-09-14T13:11:25Z","receivedAt":"2009-09-14T13:11:25Z","isPatch":true,"sender":{"key":"mstormo@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1500?v=4"},"body":"\nCentralize the include of windows.h in git-compat-util.h, turn on\nWIN32_LEAN_AND_MEAN to avoid including plenty of other header files\nwhich is not needed in Git. Also ensure we load winsock2.h first,\nso we don't load the older winsock definitions at a later stage,\nsince they contain duplicate definitions.\n\nWhen moving windows.h into git-compat-util.h, we need to protect\nthe definition of struct pollfd in mingw.h, since this file is used\nby both MinGW and MSVC, and the latter defines this struct in\nwinsock2.h.\n\nWe need to keep the windows.h include in compat/win32.h, since its\nshared by both MinGW and Cygwin, and we're not touching Cygwin in\nthis commit. The include in git-compat-util.h is protected with an\nifdef WIN32, which is not the case when compiling for Cygwin.\n\nSigned-off-by: Marius Storm-Olsen <mstormo@gmail.com>\n---\n compat/mingw.c    |    2 ++\n compat/mingw.h    |    2 ++\n compat/msvc.h     |    7 -------\n compat/win32.h    |    2 ++\n compat/winansi.c  |    1 -\n git-compat-util.h |    6 ++++++\n thread-utils.c    |    5 +----\n 7 files changed, 13 insertions(+), 12 deletions(-)\n\ndiff --git a/compat/mingw.c b/compat/mingw.c\nindex 90764eb..fe21c29 100644\n--- a/compat/mingw.c\n+++ b/compat/mingw.c\n@@ -3,6 +3,8 @@\n #include <conio.h>\n #include \"../strbuf.h\"\n \n+#include <shellapi.h>\n+\n unsigned int _CRT_fmode = _O_BINARY;\n \n static int err_win_to_posix(DWORD winerr)\ndiff --git a/compat/mingw.h b/compat/mingw.h\nindex c43917c..4784adc 100644\n--- a/compat/mingw.h\n+++ b/compat/mingw.h\n@@ -41,6 +41,7 @@ struct passwd {\n \n extern char *getpass(const char *prompt);\n \n+#ifndef POLLIN\n struct pollfd {\n \tint fd;           /* file descriptor */\n \tshort events;     /* requested events */\n@@ -48,6 +49,7 @@ struct pollfd {\n };\n #define POLLIN 1\n #define POLLHUP 2\n+#endif\n \n typedef void (__cdecl *sig_handler_t)(int);\n struct sigaction {\ndiff --git a/compat/msvc.h b/compat/msvc.h\nindex 6daf313..53a6d30 100644\n--- a/compat/msvc.h\n+++ b/compat/msvc.h\n@@ -1,13 +1,6 @@\n #ifndef __MSVC__HEAD\n #define __MSVC__HEAD\n \n-/* Define minimize windows version */\n-#define WINVER 0x0500\n-#define _WIN32_WINNT 0x0500\n-#define _WIN32_WINDOWS 0x0410\n-#define _WIN32_IE 0x0700\n-#define NTDDI_VERSION NTDDI_WIN2KSP1\n-#include <winsock2.h>\n #include <direct.h>\n #include <process.h>\n #include <malloc.h>\ndiff --git a/compat/win32.h b/compat/win32.h\nindex e8c178d..8ce9104 100644\n--- a/compat/win32.h\n+++ b/compat/win32.h\n@@ -2,7 +2,9 @@\n #define WIN32_H\n \n /* common Win32 functions for MinGW and Cygwin */\n+#ifndef WIN32         /* Not defined by Cygwin */\n #include <windows.h>\n+#endif\n \n static inline int file_attr_to_st_mode (DWORD attr)\n {\ndiff --git a/compat/winansi.c b/compat/winansi.c\nindex 9217c24..dedce21 100644\n--- a/compat/winansi.c\n+++ b/compat/winansi.c\n@@ -2,7 +2,6 @@\n  * Copyright 2008 Peter Harris <git@peter.is-a-geek.org>\n  */\n \n-#include <windows.h>\n #include \"../git-compat-util.h\"\n \n /*\ndiff --git a/git-compat-util.h b/git-compat-util.h\nindex 8ea444f..8d6e29c 100644\n--- a/git-compat-util.h\n+++ b/git-compat-util.h\n@@ -65,6 +65,12 @@\n #define _NETBSD_SOURCE 1\n #define _SGI_SOURCE 1\n \n+#ifdef WIN32 /* Both MinGW and MSVC */\n+#define WIN32_LEAN_AND_MEAN  /* stops windows.h including winsock.h */\n+#include <winsock2.h>\n+#include <windows.h>\n+#endif\n+\n #include <unistd.h>\n #include <stdio.h>\n #include <sys/stat.h>\ndiff --git a/thread-utils.c b/thread-utils.c\nindex 55e7e29..4f9c829 100644\n--- a/thread-utils.c\n+++ b/thread-utils.c\n@@ -1,9 +1,6 @@\n #include \"cache.h\"\n \n-#ifdef _WIN32\n-#  define WIN32_LEAN_AND_MEAN\n-#  include <windows.h>\n-#elif defined(hpux) || defined(__hpux) || defined(_hpux)\n+#if defined(hpux) || defined(__hpux) || defined(_hpux)\n #  include <sys/pstat.h>\n #endif\n \n-- \n1.6.2.1.418.g33d56.dirty\n"},{"id":"123168","messageId":"9c5670f92cd0b3b8b74dd2204698e9c45ad03c90.1252925290.git.mstormo@gmail.com","threadId":"20946","inReplyTo":"1b5c5e90392e813ffab4fd510b70e57903a451cc.1252925290.git.mstormo@gmail.com","subject":"[PATCH 13/17] Define strncasecmp as _strnicmp for MSVC","fromName":"Marius Storm-Olsen","fromEmail":"mstormo@gmail.com","sentAt":"2009-09-14T13:11:26Z","receivedAt":"2009-09-14T13:11:26Z","isPatch":true,"sender":{"key":"mstormo@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1500?v=4"},"body":"\nSigned-off-by: Marius Storm-Olsen <mstormo@gmail.com>\n---\n compat/msvc.h |    1 +\n 1 files changed, 1 insertions(+), 0 deletions(-)\n\ndiff --git a/compat/msvc.h b/compat/msvc.h\nindex 53a6d30..a62507f 100644\n--- a/compat/msvc.h\n+++ b/compat/msvc.h\n@@ -10,6 +10,7 @@\n #define __inline__ __inline\n #define __attribute__(x)\n #define va_copy(dst, src)     ((dst) = (src))\n+#define strncasecmp(s1, s2, n) _strnicmp(s1, s2, n)\n \n static __inline int strcasecmp (const char *s1, const char *s2)\n {\n-- \n1.6.2.1.418.g33d56.dirty\n"},{"id":"123165","messageId":"c95a367520435feec0833d2d0edc33d86cf939a8.1252925290.git.mstormo@gmail.com","threadId":"20946","inReplyTo":"9c5670f92cd0b3b8b74dd2204698e9c45ad03c90.1252925290.git.mstormo@gmail.com","subject":"[PATCH 14/17] Add ftruncate implementation for MSVC","fromName":"Marius Storm-Olsen","fromEmail":"mstormo@gmail.com","sentAt":"2009-09-14T13:11:27Z","receivedAt":"2009-09-14T13:11:27Z","isPatch":true,"sender":{"key":"mstormo@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1500?v=4"},"body":"\nThe MSVC Posix implementation doesn't contain ftruncate, so add our own\nwhich can handle large files (64bit offsets).\n\nSigned-off-by: Marius Storm-Olsen <mstormo@gmail.com>\n---\n compat/msvc.c |    8 ++++++++\n compat/msvc.h |    2 ++\n 2 files changed, 10 insertions(+), 0 deletions(-)\n\ndiff --git a/compat/msvc.c b/compat/msvc.c\nindex ac04a4c..b96b045 100644\n--- a/compat/msvc.c\n+++ b/compat/msvc.c\n@@ -32,4 +32,12 @@ int closedir(DIR *dir)\n \treturn 0;\n }\n \n+int ftruncate(int fd, __int64 length)\n+{\n+\tHANDLE fh = (HANDLE)_get_osfhandle(fd);\n+\tif (!fh || _lseeki64(fd, length, SEEK_SET))\n+\t\treturn -1;\n+\treturn SetEndOfFile(fh) ? 0 : -1;\n+}\n+\n #include \"mingw.c\"\ndiff --git a/compat/msvc.h b/compat/msvc.h\nindex a62507f..d9fc04b 100644\n--- a/compat/msvc.h\n+++ b/compat/msvc.h\n@@ -46,4 +46,6 @@ struct _stati64 {\n \ttime_t  st_mtime;\n \ttime_t  st_ctime;\n };\n+\n+int ftruncate(int fd, __int64 length);\n #endif\n-- \n1.6.2.1.418.g33d56.dirty\n"},{"id":"123166","messageId":"abaa803c30801c570f4b8e1baf6648a482bf295d.1252925290.git.mstormo@gmail.com","threadId":"20946","inReplyTo":"c95a367520435feec0833d2d0edc33d86cf939a8.1252925290.git.mstormo@gmail.com","subject":"[PATCH 15/17] Add MSVC to Makefile","fromName":"Marius Storm-Olsen","fromEmail":"mstormo@gmail.com","sentAt":"2009-09-14T13:11:28Z","receivedAt":"2009-09-14T13:11:28Z","isPatch":true,"sender":{"key":"mstormo@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1500?v=4"},"body":"\nEnable MSVC builds with GNU Make by simply calling\n    make MSVC=1\n(Debug build possible by adding DEBUG=1 as well)\n\nTwo scripts, clink.pl and lib.pl, are used to convert certain GCC\nspecific command line options into something MSVC understands.\nBy building for MSVC with GNU Make, we can ensure that the MSVC\nport always follows the latest code, and does not lag behind due\nto unmaintained NMake Makefile or IDE projects.\n\nSigned-off-by: Marius Storm-Olsen <mstormo@gmail.com>\n---\n Makefile                        |   54 ++++++++++++++++++++++++++++++++++++++-\n compat/vcbuild/scripts/clink.pl |   48 ++++++++++++++++++++++++++++++++++\n compat/vcbuild/scripts/lib.pl   |   26 ++++++++++++++++++\n 3 files changed, 127 insertions(+), 1 deletions(-)\n create mode 100644 compat/vcbuild/scripts/clink.pl\n create mode 100644 compat/vcbuild/scripts/lib.pl\n\ndiff --git a/Makefile b/Makefile\nindex bde2acd..3bdd749 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -877,6 +877,57 @@ ifneq (,$(findstring CYGWIN,$(uname_S)))\n \tCOMPAT_OBJS += compat/cygwin.o\n \tUNRELIABLE_FSTAT = UnfortunatelyYes\n endif\n+ifdef MSVC\n+\tpathsep = ;\n+\tNO_PREAD = YesPlease\n+\tNO_OPENSSL = YesPlease\n+\tNO_LIBGEN_H = YesPlease\n+\tNO_SYMLINK_HEAD = YesPlease\n+\tNO_IPV6 = YesPlease\n+\tNO_SETENV = YesPlease\n+\tNO_UNSETENV = YesPlease\n+\tNO_STRCASESTR = YesPlease\n+\tNO_STRLCPY = YesPlease\n+\tNO_MEMMEM = YesPlease\n+\t# NEEDS_LIBICONV = YesPlease\n+\tNO_ICONV = YesPlease\n+\tNO_C99_FORMAT = YesPlease\n+\tNO_STRTOUMAX = YesPlease\n+\tNO_STRTOULL = YesPlease\n+\tNO_MKDTEMP = YesPlease\n+\tNO_MKSTEMPS = YesPlease\n+\tSNPRINTF_RETURNS_BOGUS = YesPlease\n+\tNO_SVN_TESTS = YesPlease\n+\tNO_PERL_MAKEMAKER = YesPlease\n+\tRUNTIME_PREFIX = YesPlease\n+\tNO_POSIX_ONLY_PROGRAMS = YesPlease\n+\tNO_ST_BLOCKS_IN_STRUCT_STAT = YesPlease\n+\tNO_NSEC = YesPlease\n+\tUSE_WIN32_MMAP = YesPlease\n+\t# USE_NED_ALLOCATOR = YesPlease\n+\tUNRELIABLE_FSTAT = UnfortunatelyYes\n+\tOBJECT_CREATION_USES_RENAMES = UnfortunatelyNeedsTo\n+\tNO_REGEX = YesPlease\n+\tNO_CURL = YesPlease\n+\tNO_PTHREADS = YesPlease\n+\n+\tCC = compat/vcbuild/scripts/clink.pl\n+\tAR = compat/vcbuild/scripts/lib.pl\n+\tCFLAGS =\n+\tBASIC_CFLAGS = -nologo -I. -I../zlib -Icompat/vcbuild -Icompat/vcbuild/include -DWIN32-D_CONSOLE -DHAVE_STRING_H -D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_DEPRECATE\n+\tCOMPAT_OBJS = compat/msvc.o compat/fnmatch/fnmatch.o compat/winansi.o\n+\tCOMPAT_CFLAGS = -D__USE_MINGW_ACCESS -DNOGDI -DHAVE_STRING_H -DHAVE_ALLOCA_H -Icompat -Icompat/fnmatch -Icompat/regex -Icompat/fnmatch -DSTRIP_EXTENSION=\\\".exe\\\"\n+\tBASIC_LDFLAGS = -IGNORE:4217 -IGNORE:4049 -NOLOGO -SUBSYSTEM:CONSOLE -NODEFAULTLIB:MSVCRT.lib\n+\tEXTLIBS = advapi32.lib shell32.lib wininet.lib ws2_32.lib\n+\tlib =\n+ifndef DEBUG\n+\tBASIC_CFLAGS += -GL -Os -MT\n+\tBASIC_LDFLAGS += -LTCG\n+else\n+\tBASIC_CFLAGS += -Zi -MTd\n+endif\n+\tX = .exe\n+else\n ifneq (,$(findstring MINGW,$(uname_S)))\n \tpathsep = ;\n \tNO_PREAD = YesPlease\n@@ -925,6 +976,7 @@ else\n \tNO_PTHREADS = YesPlease\n endif\n endif\n+endif\n \n -include config.mak.autogen\n -include config.mak\n@@ -1327,7 +1379,7 @@ strip: $(PROGRAMS) git$X\n git.o: git.c common-cmds.h GIT-CFLAGS\n \t$(QUIET_CC)$(CC) -DGIT_VERSION='\"$(GIT_VERSION)\"' \\\n \t\t'-DGIT_HTML_PATH=\"$(htmldir_SQ)\"' \\\n-\t\t$(ALL_CFLAGS) -c $(filter %.c,$^)\n+\t\t$(ALL_CFLAGS) -o git.o -c $(filter %.c,$^)\n \n git$X: git.o $(BUILTIN_OBJS) $(GITLIBS)\n \t$(QUIET_LINK)$(CC) $(ALL_CFLAGS) -o $@ git.o \\\ndiff --git a/compat/vcbuild/scripts/clink.pl b/compat/vcbuild/scripts/clink.pl\nnew file mode 100644\nindex 0000000..0ffd59f\n--- /dev/null\n+++ b/compat/vcbuild/scripts/clink.pl\n@@ -0,0 +1,48 @@\n+#!/usr/bin/perl -w\n+######################################################################\n+# Compiles or links files\n+#\n+# This is a wrapper to facilitate the compilation of Git with MSVC\n+# using GNU Make as the build system. So, instead of manipulating the\n+# Makefile into something nasty, just to support non-space arguments\n+# etc, we use this wrapper to fix the command line options\n+#\n+# Copyright (C) 2009 Marius Storm-Olsen <mstormo@gmail.com>\n+######################################################################\n+use strict;\n+my @args = ();\n+my @cflags = ();\n+my $is_linking = 0;\n+while (@ARGV) {\n+\tmy $arg = shift @ARGV;\n+\tif (\"$arg\" =~ /^-[DIMGO]/) {\n+\t\tpush(@cflags, $arg);\n+\t} elsif (\"$arg\" eq \"-o\") {\n+\t\tmy $file_out = shift @ARGV;\n+\t\tif (\"$file_out\" =~ /exe$/) {\n+\t\t\t$is_linking = 1;\n+\t\t\tpush(@args, \"-OUT:$file_out\");\n+\t\t} else {\n+\t\t\tpush(@args, \"-Fo$file_out\");\n+\t\t}\n+\t} elsif (\"$arg\" eq \"-lz\") {\n+\t\tpush(@args, \"zlib.lib\");\n+\t} elsif (\"$arg\" eq \"-liconv\") {\n+\t\tpush(@args, \"iconv.lib\");\n+\t} elsif (\"$arg\" =~ /^-L/ && \"$arg\" ne \"-LTCG\") {\n+\t\t$arg =~ s/^-L/-LIBPATH:/;\n+\t\tpush(@args, $arg);\n+\t} elsif (\"$arg\" =~ /^-R/) {\n+\t\t# eat\n+\t} else {\n+\t\tpush(@args, $arg);\n+\t}\n+}\n+if ($is_linking) {\n+\tunshift(@args, \"link.exe\");\n+} else {\n+\tunshift(@args, \"cl.exe\");\n+\tpush(@args, @cflags);\n+}\n+#printf(\"**** @args\\n\");\n+exit system(@args);\ndiff --git a/compat/vcbuild/scripts/lib.pl b/compat/vcbuild/scripts/lib.pl\nnew file mode 100644\nindex 0000000..68f6644\n--- /dev/null\n+++ b/compat/vcbuild/scripts/lib.pl\n@@ -0,0 +1,26 @@\n+#!/usr/bin/perl -w\n+######################################################################\n+# Libifies files on Windows\n+#\n+# This is a wrapper to facilitate the compilation of Git with MSVC\n+# using GNU Make as the build system. So, instead of manipulating the\n+# Makefile into something nasty, just to support non-space arguments\n+# etc, we use this wrapper to fix the command line options\n+#\n+# Copyright (C) 2009 Marius Storm-Olsen <mstormo@gmail.com>\n+######################################################################\n+use strict;\n+my @args = ();\n+while (@ARGV) {\n+\tmy $arg = shift @ARGV;\n+\tif (\"$arg\" eq \"rcs\") {\n+\t\t# Consume the rcs option\n+\t} elsif (\"$arg\" =~ /\\.a$/) {\n+\t\tpush(@args, \"-OUT:$arg\");\n+\t} else {\n+\t\tpush(@args, $arg);\n+\t}\n+}\n+unshift(@args, \"lib.exe\");\n+# printf(\"**** @args\\n\");\n+exit system(@args);\n-- \n1.6.2.1.418.g33d56.dirty\n"},{"id":"123170","messageId":"686c174b95c6e20977cbb43e462f6d280a228035.1252925290.git.mstormo@gmail.com","threadId":"20946","inReplyTo":"abaa803c30801c570f4b8e1baf6648a482bf295d.1252925290.git.mstormo@gmail.com","subject":"[PATCH 16/17] Add README for MSVC build","fromName":"Marius Storm-Olsen","fromEmail":"mstormo@gmail.com","sentAt":"2009-09-14T13:11:29Z","receivedAt":"2009-09-14T13:11:29Z","isPatch":true,"sender":{"key":"mstormo@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1500?v=4"},"body":"\nBased on original README patch from Frank Li\n\nSigned-off-by: Marius Storm-Olsen <mstormo@gmail.com>\n---\n compat/vcbuild/README |   39 +++++++++++++++++++++++++++++++++++++++\n 1 files changed, 39 insertions(+), 0 deletions(-)\n create mode 100644 compat/vcbuild/README\n\ndiff --git a/compat/vcbuild/README b/compat/vcbuild/README\nnew file mode 100644\nindex 0000000..5d7a07a\n--- /dev/null\n+++ b/compat/vcbuild/README\n@@ -0,0 +1,39 @@\n+The Steps of Build Git with VS2008\n+\n+1. You need the build environment, which contains the Git dependencies\n+   to be able to compile, link and run Git with MSVC.\n+\n+   You can either use the binary repository:\n+\n+       WWW: http://repo.or.cz/w/msvcgit.git\n+       Git: git clone git://repo.or.cz/msvcgit.git\n+       Zip: http://repo.or.cz/w/msvcgit.git?a=snapshot;h=master;sf=zip\n+\n+   and call the setup_32bit_env.cmd batch script before compiling Git,\n+   (see repo/package README for details), or the source repository:\n+\n+       WWW: http://repo.or.cz/w/gitbuild.git\n+       Git: git clone git://repo.or.cz/gitbuild.git\n+       Zip: (None, as it's a project with submodules)\n+\n+   and build the support libs as instructed in that repo/package.\n+\n+2. Ensure you have the msysgit environment in your path, so you have\n+   GNU Make, bash and perl available.\n+\n+       WWW: http://repo.or.cz/w/msysgit.git\n+       Git: git clone git://repo.or.cz/msysgit.git\n+       Zip: http://repo.or.cz/w/msysgit.git?a=snapshot;h=master;sf=zip\n+\n+   This environment is also needed when you use the resulting\n+   executables, since Git might need to run scripts which are part of\n+   the git operations.\n+\n+4. Inside Git's directory run the command:\n+       make common-cmds.h\n+   to generate the common-cmds.h file needed to compile git.\n+\n+5. Then build Git with the GNU Make Makefile in the Git projects root\n+       make MSVC=1\n+\n+Done!\n-- \n1.6.2.1.418.g33d56.dirty\n"},{"id":"123167","messageId":"ef1959875c3ea5bd8fb33bc7aa24a1455b7cd441.1252925290.git.mstormo@gmail.com","threadId":"20946","inReplyTo":"686c174b95c6e20977cbb43e462f6d280a228035.1252925290.git.mstormo@gmail.com","subject":"[PATCH 17/17] Add scripts to generate projects for other buildsystems (MSVC vcproj, QMake)","fromName":"Marius Storm-Olsen","fromEmail":"mstormo@gmail.com","sentAt":"2009-09-14T13:11:30Z","receivedAt":"2009-09-14T13:11:30Z","isPatch":true,"sender":{"key":"mstormo@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1500?v=4"},"body":"\nThese scripts generate projects for the MSVC IDE (.vcproj files) or\nQMake (.pro files), based on the output of a 'make -n MSVC=1 V=1' run.\n\nThis enables us to simply do the necesarry changes in the Makefile, and you\ncan update the other buildsystems by regenerating the files. Keeping the\nother buildsystems up-to-date with main development.\n\nThe generator system is designed to easily drop in pm's for other\nbuildsystems as well, if someone has an itch. However, the focus has been\nWindows development, so the 'engine' might need patches to support any\nplatform.\n\nAlso add some .gitignore entries for MSVC files.\n\nSigned-off-by: Marius Storm-Olsen <mstormo@gmail.com>\n---\n NOTE: Be aware that these scripts are written only with Windows in mind,\n but could be rewritten to support any platform; and that I'm no Perl Guru.\n Anyone with an itch, feel free to send improvements, more generators, and\n what not, so it's more useful, stable and cross-platform. I guess some\n might want CMake, Scons, Eclipse or KDevelop generators too.. maybe.\n\n .gitignore                                |   11 +\n compat/vcbuild/README                     |   13 +-\n contrib/buildsystems/Generators.pm        |   42 ++\n contrib/buildsystems/Generators/QMake.pm  |  189 +++++++++\n contrib/buildsystems/Generators/Vcproj.pm |  639 +++++++++++++++++++++++++++++\n contrib/buildsystems/engine.pl            |  353 ++++++++++++++++\n contrib/buildsystems/generate             |   29 ++\n contrib/buildsystems/parse.pl             |  228 ++++++++++\n 8 files changed, 1503 insertions(+), 1 deletions(-)\n create mode 100644 contrib/buildsystems/Generators.pm\n create mode 100644 contrib/buildsystems/Generators/QMake.pm\n create mode 100644 contrib/buildsystems/Generators/Vcproj.pm\n create mode 100644 contrib/buildsystems/engine.pl\n create mode 100644 contrib/buildsystems/generate\n create mode 100644 contrib/buildsystems/parse.pl\n\ndiff --git a/.gitignore b/.gitignore\nindex 47672b0..51a37b1 100644\n--- a/.gitignore\n+++ b/.gitignore\n@@ -179,3 +179,14 @@ configure\n tags\n TAGS\n cscope*\n+*.obj\n+*.lib\n+*.sln\n+*.suo\n+*.ncb\n+*.vcproj\n+*.user\n+*.idb\n+*.pdb\n+Debug/\n+Release/\ndiff --git a/compat/vcbuild/README b/compat/vcbuild/README\nindex 5d7a07a..e64f7e5 100644\n--- a/compat/vcbuild/README\n+++ b/compat/vcbuild/README\n@@ -33,7 +33,18 @@ The Steps of Build Git with VS2008\n        make common-cmds.h\n    to generate the common-cmds.h file needed to compile git.\n \n-5. Then build Git with the GNU Make Makefile in the Git projects root\n+5. Then either build Git with the GNU Make Makefile in the Git projects\n+   root\n        make MSVC=1\n+   or generate Visual Studio solution/projects (.sln/.vcproj) with the\n+   command\n+       perl contrib/buildsystems/generate -g Vcproj\n+   and open and build the solution with the IDE\n+       devenv git.sln /useenv\n+   or build with the IDE build engine directly from the command line\n+       devenv git.sln /useenv /build \"Release|Win32\"\n+   The /useenv option is required, so Visual Studio picks up the\n+   environment variables for the support libraries required to build\n+   Git, which you set up in step 1.\n \n Done!\ndiff --git a/contrib/buildsystems/Generators.pm b/contrib/buildsystems/Generators.pm\nnew file mode 100644\nindex 0000000..408ef71\n--- /dev/null\n+++ b/contrib/buildsystems/Generators.pm\n@@ -0,0 +1,42 @@\n+package Generators;\n+require Exporter;\n+\n+use strict;\n+use File::Basename;\n+no strict 'refs';\n+use vars qw($VERSION @AVAILABLE);\n+\n+our $VERSION = '1.00';\n+our(@ISA, @EXPORT, @EXPORT_OK, @AVAILABLE);\n+@ISA = qw(Exporter);\n+\n+BEGIN {\n+    local(*D);\n+    my $me = $INC{\"Generators.pm\"};\n+    die \"Couldn't find myself in \\@INC, which is required to load the generators!\" if (\"$me\" eq \"\");\n+    $me = dirname($me);\n+    if (opendir(D,\"$me/Generators\")) {\n+        foreach my $gen (readdir(D)) {\n+            next if ($gen  =~ /^\\.\\.?$/);\n+            require \"${me}/Generators/$gen\";\n+            $gen =~ s,\\.pm,,;\n+            push(@AVAILABLE, $gen);\n+        }\n+        closedir(D);\n+        my $gens = join(', ', @AVAILABLE);\n+    }\n+\n+    push @EXPORT_OK, qw(available);\n+}\n+\n+sub available {\n+    return @AVAILABLE;\n+}\n+\n+sub generate {\n+    my ($gen, $git_dir, $out_dir, $rel_dir, %build_structure) = @_;\n+    return eval(\"Generators::${gen}::generate(\\$git_dir, \\$out_dir, \\$rel_dir, \\%build_structure)\") if grep(/^$gen$/, @AVAILABLE);\n+    die \"Generator \\\"${gen}\\\" is not available!\\nAvailable generators are: @AVAILABLE\\n\";\n+}\n+\n+1;\ndiff --git a/contrib/buildsystems/Generators/QMake.pm b/contrib/buildsystems/Generators/QMake.pm\nnew file mode 100644\nindex 0000000..ff3b657\n--- /dev/null\n+++ b/contrib/buildsystems/Generators/QMake.pm\n@@ -0,0 +1,189 @@\n+package Generators::QMake;\n+require Exporter;\n+\n+use strict;\n+use vars qw($VERSION);\n+\n+our $VERSION = '1.00';\n+our(@ISA, @EXPORT, @EXPORT_OK, @AVAILABLE);\n+@ISA = qw(Exporter);\n+\n+BEGIN {\n+    push @EXPORT_OK, qw(generate);\n+}\n+\n+sub generate {\n+    my ($git_dir, $out_dir, $rel_dir, %build_structure) = @_;\n+\n+    my @libs = @{$build_structure{\"LIBS\"}};\n+    foreach (@libs) {\n+        createLibProject($_, $git_dir, $out_dir, $rel_dir, %build_structure);\n+    }\n+\n+    my @apps = @{$build_structure{\"APPS\"}};\n+    foreach (@apps) {\n+        createAppProject($_, $git_dir, $out_dir, $rel_dir, %build_structure);\n+    }\n+\n+    createGlueProject($git_dir, $out_dir, $rel_dir, %build_structure);\n+    return 0;\n+}\n+\n+sub createLibProject {\n+    my ($libname, $git_dir, $out_dir, $rel_dir, %build_structure) = @_;\n+    print \"Generate $libname lib project\\n\";\n+    $rel_dir = \"../$rel_dir\";\n+\n+    my $sources = join(\" \\\\\\n\\t\", sort(map(\"$rel_dir/$_\", @{$build_structure{\"LIBS_${libname}_SOURCES\"}})));\n+    my $defines = join(\" \\\\\\n\\t\", sort(@{$build_structure{\"LIBS_${libname}_DEFINES\"}}));\n+    my $includes= join(\" \\\\\\n\\t\", sort(map(\"$rel_dir/$_\", @{$build_structure{\"LIBS_${libname}_INCLUDES\"}})));\n+    my $cflags  = join(\" \", sort(@{$build_structure{\"LIBS_${libname}_CFLAGS\"}}));\n+\n+    my $cflags_debug = $cflags;\n+    $cflags_debug =~ s/-MT/-MTd/;\n+    $cflags_debug =~ s/-O.//;\n+\n+    my $cflags_release = $cflags;\n+    $cflags_release =~ s/-MTd/-MT/;\n+\n+    my @tmp  = @{$build_structure{\"LIBS_${libname}_LFLAGS\"}};\n+    my @tmp2 = ();\n+    foreach (@tmp) {\n+        if (/^-LTCG/) {\n+        } elsif (/^-L/) {\n+            $_ =~ s/^-L/-LIBPATH:$rel_dir\\//;\n+        }\n+        push(@tmp2, $_);\n+    }\n+    my $lflags = join(\" \", sort(@tmp));\n+\n+    my $target = $libname;\n+    $target =~ s/\\//_/g;\n+    $defines =~ s/-D//g;\n+    $defines =~ s/\"/\\\\\\\\\"/g;\n+    $includes =~ s/-I//g;\n+    mkdir \"$target\" || die \"Could not create the directory $target for lib project!\\n\";\n+    open F, \">$target/$target.pro\" || die \"Could not open $target/$target.pro for writing!\\n\";\n+    print F << \"EOM\";\n+TEMPLATE = lib\n+TARGET = $target\n+DESTDIR = $rel_dir\n+\n+CONFIG -= qt\n+CONFIG += static\n+\n+QMAKE_CFLAGS =\n+QMAKE_CFLAGS_RELEASE = $cflags_release\n+QMAKE_CFLAGS_DEBUG = $cflags_debug\n+QMAKE_LIBFLAGS = $lflags\n+\n+DEFINES += \\\\\n+        $defines\n+\n+INCLUDEPATH += \\\\\n+        $includes\n+\n+SOURCES += \\\\\n+        $sources\n+EOM\n+    close F;\n+}\n+\n+sub createAppProject {\n+    my ($appname, $git_dir, $out_dir, $rel_dir, %build_structure) = @_;\n+    print \"Generate $appname app project\\n\";\n+    $rel_dir = \"../$rel_dir\";\n+\n+    my $sources = join(\" \\\\\\n\\t\", sort(map(\"$rel_dir/$_\", @{$build_structure{\"APPS_${appname}_SOURCES\"}})));\n+    my $defines = join(\" \\\\\\n\\t\", sort(@{$build_structure{\"APPS_${appname}_DEFINES\"}}));\n+    my $includes= join(\" \\\\\\n\\t\", sort(map(\"$rel_dir/$_\", @{$build_structure{\"APPS_${appname}_INCLUDES\"}})));\n+    my $cflags  = join(\" \", sort(@{$build_structure{\"APPS_${appname}_CFLAGS\"}}));\n+\n+    my $cflags_debug = $cflags;\n+    $cflags_debug =~ s/-MT/-MTd/;\n+    $cflags_debug =~ s/-O.//;\n+\n+    my $cflags_release = $cflags;\n+    $cflags_release =~ s/-MTd/-MT/;\n+\n+    my $libs;\n+    foreach (sort(@{$build_structure{\"APPS_${appname}_LIBS\"}})) {\n+        $_ =~ s/\\//_/g;\n+        $libs .= \" $_\";\n+    }\n+    my @tmp  = @{$build_structure{\"APPS_${appname}_LFLAGS\"}};\n+    my @tmp2 = ();\n+    foreach (@tmp) {\n+        # next if ($_ eq \"-NODEFAULTLIB:MSVCRT.lib\");\n+        if (/^-LTCG/) {\n+        } elsif (/^-L/) {\n+            $_ =~ s/^-L/-LIBPATH:$rel_dir\\//;\n+        }\n+        push(@tmp2, $_);\n+    }\n+    my $lflags = join(\" \", sort(@tmp));\n+\n+    my $target = $appname;\n+    $target =~ s/\\.exe//;\n+    $target =~ s/\\//_/g;\n+    $defines =~ s/-D//g;\n+    $defines =~ s/\"/\\\\\\\\\"/g;\n+    $includes =~ s/-I//g;\n+    mkdir \"$target\" || die \"Could not create the directory $target for app project!\\n\";\n+    open F, \">$target/$target.pro\" || die \"Could not open $target/$target.pro for writing!\\n\";\n+    print F << \"EOM\";\n+TEMPLATE = app\n+TARGET = $target\n+DESTDIR = $rel_dir\n+\n+CONFIG -= qt embed_manifest_exe\n+CONFIG += console\n+\n+QMAKE_CFLAGS =\n+QMAKE_CFLAGS_RELEASE = $cflags_release\n+QMAKE_CFLAGS_DEBUG = $cflags_debug\n+QMAKE_LFLAGS = $lflags\n+LIBS   = $libs\n+\n+DEFINES += \\\\\n+        $defines\n+\n+INCLUDEPATH += \\\\\n+        $includes\n+\n+win32:QMAKE_LFLAGS += -LIBPATH:$rel_dir\n+else: QMAKE_LFLAGS += -L$rel_dir\n+\n+SOURCES += \\\\\n+        $sources\n+EOM\n+    close F;\n+}\n+\n+sub createGlueProject {\n+    my ($git_dir, $out_dir, $rel_dir, %build_structure) = @_;\n+    my $libs = join(\" \\\\ \\n\", map(\"\\t$_|$_.pro\", @{$build_structure{\"LIBS\"}}));\n+    my $apps = join(\" \\\\ \\n\", map(\"\\t$_|$_.pro\", @{$build_structure{\"APPS\"}}));\n+    $libs =~ s/\\.a//g;\n+    $libs =~ s/\\//_/g;\n+    $libs =~ s/\\|/\\//g;\n+    $apps =~ s/\\.exe//g;\n+    $apps =~ s/\\//_/g;\n+    $apps =~ s/\\|/\\//g;\n+\n+    my $filename = $out_dir;\n+    $filename =~ s/.*\\/([^\\/]+)$/$1/;\n+    $filename =~ s/\\/$//;\n+    print \"Generate glue project $filename.pro\\n\";\n+    open F, \">$filename.pro\" || die \"Could not open $filename.pro for writing!\\n\";\n+    print F << \"EOM\";\n+TEMPLATE = subdirs\n+CONFIG += ordered\n+SUBDIRS += \\\\\n+$libs \\\\\n+$apps\n+EOM\n+    close F;\n+}\n+\n+1;\ndiff --git a/contrib/buildsystems/Generators/Vcproj.pm b/contrib/buildsystems/Generators/Vcproj.pm\nnew file mode 100644\nindex 0000000..00ec0c1\n--- /dev/null\n+++ b/contrib/buildsystems/Generators/Vcproj.pm\n@@ -0,0 +1,639 @@\n+package Generators::Vcproj;\n+require Exporter;\n+\n+use strict;\n+use vars qw($VERSION);\n+\n+our $VERSION = '1.00';\n+our(@ISA, @EXPORT, @EXPORT_OK, @AVAILABLE);\n+@ISA = qw(Exporter);\n+\n+BEGIN {\n+    push @EXPORT_OK, qw(generate);\n+}\n+\n+my $guid_index = 0;\n+my @GUIDS = (\n+    \"{E07B9989-2BF7-4F21-8918-BE22BA467AC3}\",\n+    \"{278FFB51-0296-4A44-A81A-22B87B7C3592}\",\n+    \"{7346A2C4-F0FD-444F-9EBE-1AF23B2B5650}\",\n+    \"{67F421AC-EB34-4D49-820B-3196807B423F}\",\n+    \"{385DCFE1-CC8C-4211-A451-80FCFC31CA51}\",\n+    \"{97CC46C5-D2CC-4D26-B634-E75792B79916}\",\n+    \"{C7CE21FE-6EF8-4012-A5C7-A22BCEDFBA11}\",\n+    \"{51575134-3FDF-42D1-BABD-3FB12669C6C9}\",\n+    \"{0AE195E4-9823-4B87-8E6F-20C5614AF2FF}\",\n+    \"{4B918255-67CA-43BB-A46C-26704B666E6B}\",\n+    \"{18CCFEEF-C8EE-4CC1-A265-26F95C9F4649}\",\n+    \"{5D5D90FA-01B7-4973-AFE5-CA88C53AC197}\",\n+    \"{1F054320-036D-49E1-B384-FB5DF0BC8AC0}\",\n+    \"{7CED65EE-F2D9-4171-825B-C7D561FE5786}\",\n+    \"{8D341679-0F07-4664-9A56-3BA0DE88B9BC}\",\n+    \"{C189FEDC-2957-4BD7-9FA4-7622241EA145}\",\n+    \"{66844203-1B9F-4C53-9274-164FFF95B847}\",\n+    \"{E4FEA145-DECC-440D-AEEA-598CF381FD43}\",\n+    \"{73300A8E-C8AC-41B0-B555-4F596B681BA7}\",\n+    \"{873FDEB1-D01D-40BF-A1BF-8BBC58EC0F51}\",\n+    \"{7922C8BE-76C5-4AC6-8BF7-885C0F93B782}\",\n+    \"{E245D370-308B-4A49-BFC1-1E527827975F}\",\n+    \"{F6FA957B-66FC-4ED7-B260-E59BBE4FE813}\",\n+    \"{E6055070-0198-431A-BC49-8DB6CEE770AE}\",\n+    \"{54159234-C3EB-43DA-906B-CE5DA5C74654}\",\n+    \"{594CFC35-0B60-46F6-B8EF-9983ACC1187D}\",\n+    \"{D93FCAB7-1F01-48D2-B832-F761B83231A5}\",\n+    \"{DBA5E6AC-E7BE-42D3-8703-4E787141526E}\",\n+    \"{6171953F-DD26-44C7-A3BE-CC45F86FC11F}\",\n+    \"{9E19DDBE-F5E4-4A26-A2FE-0616E04879B8}\",\n+    \"{AE81A615-99E3-4885-9CE0-D9CAA193E867}\",\n+    \"{FBF4067E-1855-4F6C-8BCD-4D62E801A04D}\",\n+    \"{17007948-6593-4AEB-8106-F7884B4F2C19}\",\n+    \"{199D4C8D-8639-4DA6-82EF-08668C35DEE0}\",\n+    \"{E085E50E-C140-4CF3-BE4B-094B14F0DDD6}\",\n+    \"{00785268-A9CC-4E40-AC29-BAC0019159CE}\",\n+    \"{4C06F56A-DCDB-46A6-B67C-02339935CF12}\",\n+    \"{3A62D3FD-519E-4EC9-8171-D2C1BFEA022F}\",\n+    \"{3A62D3FD-519E-4EC9-8171-D2C1BFEA022F}\",\n+    \"{9392EB58-D7BA-410B-B1F0-B2FAA6BC89A7}\",\n+    \"{2ACAB2D5-E0CE-4027-BCA0-D78B2D7A6C66}\",\n+    \"{86E216C3-43CE-481A-BCB2-BE5E62850635}\",\n+    \"{FB631291-7923-4B91-9A57-7B18FDBB7A42}\",\n+    \"{0A176EC9-E934-45B8-B87F-16C7F4C80039}\",\n+    \"{DF55CA80-46E8-4C53-B65B-4990A23DD444}\",\n+    \"{3A0F9895-55D2-4710-BE5E-AD7498B5BF44}\",\n+    \"{294BDC5A-F448-48B6-8110-DD0A81820F8C}\",\n+    \"{4B9F66E9-FAC9-47AB-B1EF-C16756FBFD06}\",\n+    \"{72EA49C6-2806-48BD-B81B-D4905102E19C}\",\n+    \"{5728EB7E-8929-486C-8CD5-3238D060E768}\"\n+);\n+\n+sub generate {\n+    my ($git_dir, $out_dir, $rel_dir, %build_structure) = @_;\n+    my @libs = @{$build_structure{\"LIBS\"}};\n+    foreach (@libs) {\n+        createLibProject($_, $git_dir, $out_dir, $rel_dir, \\%build_structure);\n+    }\n+\n+    my @apps = @{$build_structure{\"APPS\"}};\n+    foreach (@apps) {\n+        createAppProject($_, $git_dir, $out_dir, $rel_dir, \\%build_structure);\n+    }\n+\n+    createGlueProject($git_dir, $out_dir, $rel_dir, %build_structure);\n+    return 0;\n+}\n+\n+sub createLibProject {\n+    my ($libname, $git_dir, $out_dir, $rel_dir, $build_structure) = @_;\n+    print \"Generate $libname vcproj lib project\\n\";\n+    $rel_dir = \"..\\\\$rel_dir\";\n+    $rel_dir =~ s/\\//\\\\/g;\n+\n+    my $target = $libname;\n+    $target =~ s/\\//_/g;\n+    $target =~ s/\\.a//;\n+\n+    my $uuid = $GUIDS[$guid_index];\n+    $$build_structure{\"LIBS_${target}_GUID\"} = $uuid;\n+    $guid_index += 1;\n+\n+    my @srcs = sort(map(\"$rel_dir\\\\$_\", @{$$build_structure{\"LIBS_${libname}_SOURCES\"}}));\n+    my @sources;\n+    foreach (@srcs) {\n+        $_ =~ s/\\//\\\\/g;\n+        push(@sources, $_);\n+    }\n+    my $defines = join(\",\", sort(@{$$build_structure{\"LIBS_${libname}_DEFINES\"}}));\n+    my $includes= join(\";\", sort(map(\"&quot;$rel_dir\\\\$_&quot;\", @{$$build_structure{\"LIBS_${libname}_INCLUDES\"}})));\n+    my $cflags  = join(\" \", sort(@{$$build_structure{\"LIBS_${libname}_CFLAGS\"}}));\n+    $cflags =~ s/\\\"/&quot;/g;\n+\n+    my $cflags_debug = $cflags;\n+    $cflags_debug =~ s/-MT/-MTd/;\n+    $cflags_debug =~ s/-O.//;\n+\n+    my $cflags_release = $cflags;\n+    $cflags_release =~ s/-MTd/-MT/;\n+\n+    my @tmp  = @{$$build_structure{\"LIBS_${libname}_LFLAGS\"}};\n+    my @tmp2 = ();\n+    foreach (@tmp) {\n+        if (/^-LTCG/) {\n+        } elsif (/^-L/) {\n+            $_ =~ s/^-L/-LIBPATH:$rel_dir\\//;\n+        }\n+        push(@tmp2, $_);\n+    }\n+    my $lflags = join(\" \", sort(@tmp));\n+\n+    $defines =~ s/-D//g;\n+    $defines =~ s/\\\"/\\\\&quot;/g;\n+    $defines =~ s/\\'//g;\n+    $includes =~ s/-I//g;\n+    mkdir \"$target\" || die \"Could not create the directory $target for lib project!\\n\";\n+    open F, \">$target/$target.vcproj\" || die \"Could not open $target/$target.pro for writing!\\n\";\n+    print F << \"EOM\";\n+<?xml version=\"1.0\" encoding = \"Windows-1252\"?>\n+<VisualStudioProject\n+\tProjectType=\"Visual C++\"\n+\tVersion=\"9,00\"\n+\tName=\"$target\"\n+\tProjectGUID=\"$uuid\">\n+\t<Platforms>\n+\t\t<Platform\n+\t\t\tName=\"Win32\"/>\n+\t</Platforms>\n+\t<ToolFiles>\n+\t</ToolFiles>\n+\t<Configurations>\n+\t\t<Configuration\n+\t\t\tName=\"Debug|Win32\"\n+\t\t\tOutputDirectory=\"$rel_dir\"\n+\t\t\tConfigurationType=\"4\"\n+\t\t\tCharacterSet=\"0\"\n+\t\t\tIntermediateDirectory=\"\\$(ProjectDir)\\$(ConfigurationName)\"\n+\t\t\t>\n+\t\t\t<Tool\n+\t\t\t\tName=\"VCPreBuildEventTool\"\n+\t\t\t/>\n+\t\t\t<Tool\n+\t\t\t\tName=\"VCCustomBuildTool\"\n+\t\t\t/>\n+\t\t\t<Tool\n+\t\t\t\tName=\"VCXMLDataGeneratorTool\"\n+\t\t\t/>\n+\t\t\t<Tool\n+\t\t\t\tName=\"VCWebServiceProxyGeneratorTool\"\n+\t\t\t/>\n+\t\t\t<Tool\n+\t\t\t\tName=\"VCMIDLTool\"\n+\t\t\t/>\n+\t\t\t<Tool\n+\t\t\t\tName=\"VCCLCompilerTool\"\n+\t\t\t\tAdditionalOptions=\"$cflags_debug\"\n+\t\t\t\tOptimization=\"0\"\n+\t\t\t\tInlineFunctionExpansion=\"1\"\n+\t\t\t\tAdditionalIncludeDirectories=\"$includes\"\n+\t\t\t\tPreprocessorDefinitions=\"UNICODE,WIN32,_DEBUG,$defines\"\n+\t\t\t\tMinimalRebuild=\"true\"\n+\t\t\t\tRuntimeLibrary=\"1\"\n+\t\t\t\tUsePrecompiledHeader=\"0\"\n+\t\t\t\tWarningLevel=\"3\"\n+\t\t\t\tDebugInformationFormat=\"3\"\n+\t\t\t/>\n+\t\t\t<Tool\n+\t\t\t\tName=\"VCManagedResourceCompilerTool\"\n+\t\t\t/>\n+\t\t\t<Tool\n+\t\t\t\tName=\"VCResourceCompilerTool\"\n+\t\t\t/>\n+\t\t\t<Tool\n+\t\t\t\tName=\"VCPreLinkEventTool\"\n+\t\t\t/>\n+\t\t\t<Tool\n+\t\t\t\tName=\"VCLibrarianTool\"\n+\t\t\t\tSuppressStartupBanner=\"true\"\n+\t\t\t/>\n+\t\t\t<Tool\n+\t\t\t\tName=\"VCALinkTool\"\n+\t\t\t/>\n+\t\t\t<Tool\n+\t\t\t\tName=\"VCXDCMakeTool\"\n+\t\t\t/>\n+\t\t\t<Tool\n+\t\t\t\tName=\"VCBscMakeTool\"\n+\t\t\t/>\n+\t\t\t<Tool\n+\t\t\t\tName=\"VCFxCopTool\"\n+\t\t\t/>\n+\t\t\t<Tool\n+\t\t\t\tName=\"VCPostBuildEventTool\"\n+\t\t\t/>\n+\t\t</Configuration>\n+\t\t<Configuration\n+\t\t\tName=\"Release|Win32\"\n+\t\t\tOutputDirectory=\"$rel_dir\"\n+\t\t\tConfigurationType=\"4\"\n+\t\t\tCharacterSet=\"0\"\n+\t\t\tWholeProgramOptimization=\"1\"\n+\t\t\tIntermediateDirectory=\"\\$(ProjectDir)\\$(ConfigurationName)\"\n+\t\t\t>\n+\t\t\t<Tool\n+\t\t\t\tName=\"VCPreBuildEventTool\"\n+\t\t\t/>\n+\t\t\t<Tool\n+\t\t\t\tName=\"VCCustomBuildTool\"\n+\t\t\t/>\n+\t\t\t<Tool\n+\t\t\t\tName=\"VCXMLDataGeneratorTool\"\n+\t\t\t/>\n+\t\t\t<Tool\n+\t\t\t\tName=\"VCWebServiceProxyGeneratorTool\"\n+\t\t\t/>\n+\t\t\t<Tool\n+\t\t\t\tName=\"VCMIDLTool\"\n+\t\t\t/>\n+\t\t\t<Tool\n+\t\t\t\tName=\"VCCLCompilerTool\"\n+\t\t\t\tAdditionalOptions=\"$cflags_release\"\n+\t\t\t\tOptimization=\"2\"\n+\t\t\t\tInlineFunctionExpansion=\"1\"\n+\t\t\t\tEnableIntrinsicFunctions=\"true\"\n+\t\t\t\tAdditionalIncludeDirectories=\"$includes\"\n+\t\t\t\tPreprocessorDefinitions=\"UNICODE,WIN32,NDEBUG,$defines\"\n+\t\t\t\tRuntimeLibrary=\"0\"\n+\t\t\t\tEnableFunctionLevelLinking=\"true\"\n+\t\t\t\tUsePrecompiledHeader=\"0\"\n+\t\t\t\tWarningLevel=\"3\"\n+\t\t\t\tDebugInformationFormat=\"3\"\n+\t\t\t/>\n+\t\t\t<Tool\n+\t\t\t\tName=\"VCManagedResourceCompilerTool\"\n+\t\t\t/>\n+\t\t\t<Tool\n+\t\t\t\tName=\"VCResourceCompilerTool\"\n+\t\t\t/>\n+\t\t\t<Tool\n+\t\t\t\tName=\"VCPreLinkEventTool\"\n+\t\t\t/>\n+\t\t\t<Tool\n+\t\t\t\tName=\"VCLibrarianTool\"\n+\t\t\t\tSuppressStartupBanner=\"true\"\n+\t\t\t/>\n+\t\t\t<Tool\n+\t\t\t\tName=\"VCALinkTool\"\n+\t\t\t/>\n+\t\t\t<Tool\n+\t\t\t\tName=\"VCXDCMakeTool\"\n+\t\t\t/>\n+\t\t\t<Tool\n+\t\t\t\tName=\"VCBscMakeTool\"\n+\t\t\t/>\n+\t\t\t<Tool\n+\t\t\t\tName=\"VCFxCopTool\"\n+\t\t\t/>\n+\t\t\t<Tool\n+\t\t\t\tName=\"VCPostBuildEventTool\"\n+\t\t\t/>\n+\t\t</Configuration>\n+\t</Configurations>\n+\t<Files>\n+\t\t<Filter\n+\t\t\tName=\"Source Files\"\n+\t\t\tFilter=\"cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx\"\n+\t\t\tUniqueIdentifier=\"{4FC737F1-C7A5-4376-A066-2A32D752A2FF}\">\n+EOM\n+    foreach(@sources) {\n+        print F << \"EOM\";\n+\t\t\t<File\n+\t\t\t\tRelativePath=\"$_\"/>\n+EOM\n+    }\n+    print F << \"EOM\";\n+\t\t</Filter>\n+\t</Files>\n+\t<Globals>\n+\t</Globals>\n+</VisualStudioProject>\n+EOM\n+    close F;\n+}\n+\n+sub createAppProject {\n+    my ($appname, $git_dir, $out_dir, $rel_dir, $build_structure) = @_;\n+    print \"Generate $appname vcproj app project\\n\";\n+    $rel_dir = \"..\\\\$rel_dir\";\n+    $rel_dir =~ s/\\//\\\\/g;\n+\n+    my $target = $appname;\n+    $target =~ s/\\//_/g;\n+    $target =~ s/\\.exe//;\n+\n+    my $uuid = $GUIDS[$guid_index];\n+    $$build_structure{\"APPS_${target}_GUID\"} = $uuid;\n+    $guid_index += 1;\n+\n+    my @srcs = sort(map(\"$rel_dir\\\\$_\", @{$$build_structure{\"APPS_${appname}_SOURCES\"}}));\n+    my @sources;\n+    foreach (@srcs) {\n+        $_ =~ s/\\//\\\\/g;\n+        push(@sources, $_);\n+    }\n+    my $defines = join(\",\", sort(@{$$build_structure{\"APPS_${appname}_DEFINES\"}}));\n+    my $includes= join(\";\", sort(map(\"&quot;$rel_dir\\\\$_&quot;\", @{$$build_structure{\"APPS_${appname}_INCLUDES\"}})));\n+    my $cflags  = join(\" \", sort(@{$$build_structure{\"APPS_${appname}_CFLAGS\"}}));\n+    $cflags =~ s/\\\"/&quot;/g;\n+\n+    my $cflags_debug = $cflags;\n+    $cflags_debug =~ s/-MT/-MTd/;\n+    $cflags_debug =~ s/-O.//;\n+\n+    my $cflags_release = $cflags;\n+    $cflags_release =~ s/-MTd/-MT/;\n+\n+    my $libs;\n+    foreach (sort(@{$$build_structure{\"APPS_${appname}_LIBS\"}})) {\n+        $_ =~ s/\\//_/g;\n+        $libs .= \" $_\";\n+    }\n+    my @tmp  = @{$$build_structure{\"APPS_${appname}_LFLAGS\"}};\n+    my @tmp2 = ();\n+    foreach (@tmp) {\n+        if (/^-LTCG/) {\n+        } elsif (/^-L/) {\n+            $_ =~ s/^-L/-LIBPATH:$rel_dir\\//;\n+        }\n+        push(@tmp2, $_);\n+    }\n+    my $lflags = join(\" \", sort(@tmp)) . \" -LIBPATH:$rel_dir\";\n+\n+    $defines =~ s/-D//g;\n+    $defines =~ s/\\\"/\\\\&quot;/g;\n+    $defines =~ s/\\'//g;\n+    $defines =~ s/\\\\\\\\/\\\\/g;\n+    $includes =~ s/-I//g;\n+    mkdir \"$target\" || die \"Could not create the directory $target for lib project!\\n\";\n+    open F, \">$target/$target.vcproj\" || die \"Could not open $target/$target.pro for writing!\\n\";\n+    print F << \"EOM\";\n+<?xml version=\"1.0\" encoding = \"Windows-1252\"?>\n+<VisualStudioProject\n+\tProjectType=\"Visual C++\"\n+\tVersion=\"9,00\"\n+\tName=\"$target\"\n+\tProjectGUID=\"$uuid\">\n+\t<Platforms>\n+\t\t<Platform\n+\t\t\tName=\"Win32\"/>\n+\t</Platforms>\n+\t<ToolFiles>\n+\t</ToolFiles>\n+\t<Configurations>\n+\t\t<Configuration\n+\t\t\tName=\"Debug|Win32\"\n+\t\t\tOutputDirectory=\"$rel_dir\"\n+\t\t\tConfigurationType=\"1\"\n+\t\t\tCharacterSet=\"0\"\n+\t\t\tIntermediateDirectory=\"\\$(ProjectDir)\\$(ConfigurationName)\"\n+\t\t\t>\n+\t\t\t<Tool\n+\t\t\t\tName=\"VCPreBuildEventTool\"\n+\t\t\t/>\n+\t\t\t<Tool\n+\t\t\t\tName=\"VCCustomBuildTool\"\n+\t\t\t/>\n+\t\t\t<Tool\n+\t\t\t\tName=\"VCXMLDataGeneratorTool\"\n+\t\t\t/>\n+\t\t\t<Tool\n+\t\t\t\tName=\"VCWebServiceProxyGeneratorTool\"\n+\t\t\t/>\n+\t\t\t<Tool\n+\t\t\t\tName=\"VCMIDLTool\"\n+\t\t\t/>\n+\t\t\t<Tool\n+\t\t\t\tName=\"VCCLCompilerTool\"\n+\t\t\t\tAdditionalOptions=\"$cflags_debug\"\n+\t\t\t\tOptimization=\"0\"\n+\t\t\t\tInlineFunctionExpansion=\"1\"\n+\t\t\t\tAdditionalIncludeDirectories=\"$includes\"\n+\t\t\t\tPreprocessorDefinitions=\"UNICODE,WIN32,_DEBUG,$defines\"\n+\t\t\t\tMinimalRebuild=\"true\"\n+\t\t\t\tRuntimeLibrary=\"1\"\n+\t\t\t\tUsePrecompiledHeader=\"0\"\n+\t\t\t\tWarningLevel=\"3\"\n+\t\t\t\tDebugInformationFormat=\"3\"\n+\t\t\t/>\n+\t\t\t<Tool\n+\t\t\t\tName=\"VCManagedResourceCompilerTool\"\n+\t\t\t/>\n+\t\t\t<Tool\n+\t\t\t\tName=\"VCResourceCompilerTool\"\n+\t\t\t/>\n+\t\t\t<Tool\n+\t\t\t\tName=\"VCPreLinkEventTool\"\n+\t\t\t/>\n+\t\t\t<Tool\n+\t\t\t\tName=\"VCLinkerTool\"\n+\t\t\t\tAdditionalDependencies=\"$libs\"\n+\t\t\t\tAdditionalOptions=\"$lflags\"\n+\t\t\t\tLinkIncremental=\"2\"\n+\t\t\t\tGenerateDebugInformation=\"true\"\n+\t\t\t\tSubSystem=\"1\"\n+\t\t\t\tTargetMachine=\"1\"\n+\t\t\t/>\n+\t\t\t<Tool\n+\t\t\t\tName=\"VCALinkTool\"\n+\t\t\t/>\n+\t\t\t<Tool\n+\t\t\t\tName=\"VCXDCMakeTool\"\n+\t\t\t/>\n+\t\t\t<Tool\n+\t\t\t\tName=\"VCBscMakeTool\"\n+\t\t\t/>\n+\t\t\t<Tool\n+\t\t\t\tName=\"VCFxCopTool\"\n+\t\t\t/>\n+\t\t\t<Tool\n+\t\t\t\tName=\"VCPostBuildEventTool\"\n+\t\t\t/>\n+\t\t</Configuration>\n+\t\t<Configuration\n+\t\t\tName=\"Release|Win32\"\n+\t\t\tOutputDirectory=\"$rel_dir\"\n+\t\t\tConfigurationType=\"1\"\n+\t\t\tCharacterSet=\"0\"\n+\t\t\tWholeProgramOptimization=\"1\"\n+\t\t\tIntermediateDirectory=\"\\$(ProjectDir)\\$(ConfigurationName)\"\n+\t\t\t>\n+\t\t\t<Tool\n+\t\t\t\tName=\"VCPreBuildEventTool\"\n+\t\t\t/>\n+\t\t\t<Tool\n+\t\t\t\tName=\"VCCustomBuildTool\"\n+\t\t\t/>\n+\t\t\t<Tool\n+\t\t\t\tName=\"VCXMLDataGeneratorTool\"\n+\t\t\t/>\n+\t\t\t<Tool\n+\t\t\t\tName=\"VCWebServiceProxyGeneratorTool\"\n+\t\t\t/>\n+\t\t\t<Tool\n+\t\t\t\tName=\"VCMIDLTool\"\n+\t\t\t/>\n+\t\t\t<Tool\n+\t\t\t\tName=\"VCCLCompilerTool\"\n+\t\t\t\tAdditionalOptions=\"$cflags_release\"\n+\t\t\t\tOptimization=\"2\"\n+\t\t\t\tInlineFunctionExpansion=\"1\"\n+\t\t\t\tEnableIntrinsicFunctions=\"true\"\n+\t\t\t\tAdditionalIncludeDirectories=\"$includes\"\n+\t\t\t\tPreprocessorDefinitions=\"UNICODE,WIN32,NDEBUG,$defines\"\n+\t\t\t\tRuntimeLibrary=\"0\"\n+\t\t\t\tEnableFunctionLevelLinking=\"true\"\n+\t\t\t\tUsePrecompiledHeader=\"0\"\n+\t\t\t\tWarningLevel=\"3\"\n+\t\t\t\tDebugInformationFormat=\"3\"\n+\t\t\t/>\n+\t\t\t<Tool\n+\t\t\t\tName=\"VCManagedResourceCompilerTool\"\n+\t\t\t/>\n+\t\t\t<Tool\n+\t\t\t\tName=\"VCResourceCompilerTool\"\n+\t\t\t/>\n+\t\t\t<Tool\n+\t\t\t\tName=\"VCPreLinkEventTool\"\n+\t\t\t/>\n+\t\t\t<Tool\n+\t\t\t\tName=\"VCLinkerTool\"\n+\t\t\t\tAdditionalDependencies=\"$libs\"\n+\t\t\t\tAdditionalOptions=\"$lflags\"\n+\t\t\t\tLinkIncremental=\"1\"\n+\t\t\t\tGenerateDebugInformation=\"true\"\n+\t\t\t\tSubSystem=\"1\"\n+\t\t\t\tTargetMachine=\"1\"\n+\t\t\t\tOptimizeReferences=\"2\"\n+\t\t\t\tEnableCOMDATFolding=\"2\"\n+\t\t\t/>\n+\t\t\t<Tool\n+\t\t\t\tName=\"VCALinkTool\"\n+\t\t\t/>\n+\t\t\t<Tool\n+\t\t\t\tName=\"VCXDCMakeTool\"\n+\t\t\t/>\n+\t\t\t<Tool\n+\t\t\t\tName=\"VCBscMakeTool\"\n+\t\t\t/>\n+\t\t\t<Tool\n+\t\t\t\tName=\"VCFxCopTool\"\n+\t\t\t/>\n+\t\t\t<Tool\n+\t\t\t\tName=\"VCPostBuildEventTool\"\n+\t\t\t/>\n+\t\t</Configuration>\n+\t</Configurations>\n+\t<Files>\n+\t\t<Filter\n+\t\t\tName=\"Source Files\"\n+\t\t\tFilter=\"cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx\"\n+\t\t\tUniqueIdentifier=\"{4FC737F1-C7A5-4376-A066-2A32D752A2FF}\">\n+EOM\n+    foreach(@sources) {\n+        print F << \"EOM\";\n+\t\t\t<File\n+\t\t\t\tRelativePath=\"$_\"/>\n+EOM\n+    }\n+    print F << \"EOM\";\n+\t\t</Filter>\n+\t</Files>\n+\t<Globals>\n+\t</Globals>\n+</VisualStudioProject>\n+EOM\n+    close F;\n+}\n+\n+sub createGlueProject {\n+    my ($git_dir, $out_dir, $rel_dir, %build_structure) = @_;\n+    print \"Generate solutions file\\n\";\n+    $rel_dir = \"..\\\\$rel_dir\";\n+    $rel_dir =~ s/\\//\\\\/g;\n+    my $SLN_HEAD = \"Microsoft Visual Studio Solution File, Format Version 10.00\\n\";\n+    my $SLN_PRE  = \"Project(\\\"{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}\\\") = \";\n+    my $SLN_POST = \"\\nEndProject\\n\";\n+\n+    my @libs = @{$build_structure{\"LIBS\"}};\n+    my @tmp;\n+    foreach (@libs) {\n+        $_ =~ s/\\//_/g;\n+        $_ =~ s/\\.a//;\n+        push(@tmp, $_);\n+    }\n+    @libs = @tmp;\n+\n+    my @apps = @{$build_structure{\"APPS\"}};\n+    @tmp = ();\n+    foreach (@apps) {\n+        $_ =~ s/\\//_/g;\n+        $_ =~ s/\\.exe//;\n+        push(@tmp, $_);\n+    }\n+    @apps = @tmp;\n+\n+    open F, \">git.sln\" || die \"Could not open git.sln for writing!\\n\";\n+    print F \"$SLN_HEAD\";\n+    foreach (@libs) {\n+        my $libname = $_;\n+        my $uuid = $build_structure{\"LIBS_${libname}_GUID\"};\n+        print F \"$SLN_PRE\";\n+        print F \"\\\"${libname}\\\", \\\"${libname}\\\\${libname}.vcproj\\\", \\\"${uuid}\\\"\";\n+        print F \"$SLN_POST\";\n+    }\n+    foreach (@apps) {\n+        my $appname = $_;\n+        my $uuid = $build_structure{\"APPS_${appname}_GUID\"};\n+        print F \"$SLN_PRE\";\n+        print F \"\\\"${appname}\\\", \\\"${appname}\\\\${appname}.vcproj\\\", \\\"${uuid}\\\"\";\n+        print F \"$SLN_POST\";\n+    }\n+\n+    print F << \"EOM\";\n+Global\n+\tGlobalSection(SolutionConfiguration) = preSolution\n+\t\tConfigName.0 = Debug|Win32\n+\t\tConfigName.1 = Release|Win32\n+\tEndGlobalSection\n+\tGlobalSection(ProjectDependencies) = postSolution\n+EOM\n+    foreach (@{$build_structure{\"APPS\"}}) {\n+        my $appname = $_;\n+        my $appname_clean = $_;\n+        $appname_clean =~ s/\\//_/g;\n+        $appname_clean =~ s/\\.exe//;\n+\n+        my $uuid = $build_structure{\"APPS_${appname_clean}_GUID\"};\n+        my $dep_index = 0;\n+        foreach(@{$build_structure{\"APPS_${appname}_LIBS\"}}) {\n+            my $libname = $_;\n+            $libname =~ s/\\//_/g;\n+            $libname =~ s/\\.(a|lib)//;\n+            my $libuuid = $build_structure{\"LIBS_${libname}_GUID\"};\n+            if (defined $libuuid) {\n+                print F \"\\t\\t${uuid}.${dep_index} = ${libuuid}\\n\";\n+                $dep_index += 1;\n+            }\n+        }\n+    }\n+\n+    print F << \"EOM\";\n+\tEndGlobalSection\n+\tGlobalSection(ProjectConfiguration) = postSolution\n+EOM\n+    foreach (@libs) {\n+        my $libname = $_;\n+        my $uuid = $build_structure{\"LIBS_${libname}_GUID\"};\n+        print F \"\\t\\t${uuid}.Debug|Win32.ActiveCfg = Debug|Win32\\n\";\n+        print F \"\\t\\t${uuid}.Debug|Win32.Build.0 = Debug|Win32\\n\";\n+        print F \"\\t\\t${uuid}.Release|Win32.ActiveCfg = Release|Win32\\n\";\n+        print F \"\\t\\t${uuid}.Release|Win32.Build.0 = Release|Win32\\n\";\n+    }\n+    foreach (@apps) {\n+        my $appname = $_;\n+        my $uuid = $build_structure{\"APPS_${appname}_GUID\"};\n+        print F \"\\t\\t${uuid}.Debug|Win32.ActiveCfg = Debug|Win32\\n\";\n+        print F \"\\t\\t${uuid}.Debug|Win32.Build.0 = Debug|Win32\\n\";\n+        print F \"\\t\\t${uuid}.Release|Win32.ActiveCfg = Release|Win32\\n\";\n+        print F \"\\t\\t${uuid}.Release|Win32.Build.0 = Release|Win32\\n\";\n+    }\n+\n+    print F << \"EOM\";\n+\tEndGlobalSection\n+\tGlobalSection(ExtensibilityGlobals) = postSolution\n+\tEndGlobalSection\n+\tGlobalSection(ExtensibilityAddIns) = postSolution\n+\tEndGlobalSection\n+EndGlobal\n+EOM\n+    close F;\n+}\n+\n+1;\ndiff --git a/contrib/buildsystems/engine.pl b/contrib/buildsystems/engine.pl\nnew file mode 100644\nindex 0000000..20bd061\n--- /dev/null\n+++ b/contrib/buildsystems/engine.pl\n@@ -0,0 +1,353 @@\n+#!/usr/bin/perl -w\n+######################################################################\n+# Do not call this script directly!\n+#\n+# The generate script ensures that @INC is correct before the engine\n+# is executed.\n+#\n+# Copyright (C) 2009 Marius Storm-Olsen <mstormo@gmail.com>\n+######################################################################\n+use strict;\n+use File::Basename;\n+use File::Spec;\n+use Cwd;\n+use Generators;\n+\n+my (%build_structure, %compile_options, @makedry);\n+my $out_dir = getcwd();\n+my $git_dir = $out_dir;\n+$git_dir =~ s=\\\\=/=g;\n+$git_dir = dirname($git_dir) while (!-e \"$git_dir/git.c\" && \"$git_dir\" ne \"\");\n+die \"Couldn't find Git repo\" if (\"$git_dir\" eq \"\");\n+\n+my @gens = Generators::available();\n+my $gen = \"Vcproj\";\n+\n+sub showUsage\n+{\n+    my $genlist = join(', ', @gens);\n+    print << \"EOM\";\n+generate usage:\n+  -g <GENERATOR>  --gen <GENERATOR> Specify the buildsystem generator    (default: $gen)\n+                                    Available: $genlist\n+  -o <PATH>       --out <PATH>      Specify output directory generation  (default: .)\n+  -i <FILE>       --in <FILE>       Specify input file, instead of running GNU Make\n+  -h,-?           --help            This help\n+EOM\n+    exit 0;\n+}\n+\n+# Parse command-line options\n+while (@ARGV) {\n+    my $arg = shift @ARGV;\n+    if (\"$arg\" eq \"-h\" || \"$arg\" eq \"--help\" || \"$arg\" eq \"-?\") {\n+\tshowUsage();\n+\texit(0);\n+    } elsif(\"$arg\" eq \"--out\" || \"$arg\" eq \"-o\") {\n+\t$out_dir = shift @ARGV;\n+    } elsif(\"$arg\" eq \"--gen\" || \"$arg\" eq \"-g\") {\n+\t$gen = shift @ARGV;\n+    } elsif(\"$arg\" eq \"--in\" || \"$arg\" eq \"-i\") {\n+\tmy $infile = shift @ARGV;\n+        open(F, \"<$infile\") || die \"Couldn't open file $infile\";\n+        @makedry = <F>;\n+        close(F);\n+    }\n+}\n+\n+# NOT using File::Spec->rel2abs($path, $base) here, as\n+# it fails badly for me in the msysgit environment\n+$git_dir = File::Spec->rel2abs($git_dir);\n+$out_dir = File::Spec->rel2abs($out_dir);\n+my $rel_dir = makeOutRel2Git($git_dir, $out_dir);\n+\n+# Print some information so the user feels informed\n+print << \"EOM\";\n+-----\n+Generator: $gen\n+Git dir:   $git_dir\n+Out dir:   $out_dir\n+-----\n+Running GNU Make to figure out build structure...\n+EOM\n+\n+# Pipe a make --dry-run into a variable, if not already loaded from file\n+@makedry = `cd $git_dir && make -n MSVC=1 V=1 2>/dev/null` if !@makedry;\n+\n+# Parse the make output into usable info\n+parseMakeOutput();\n+\n+# Finally, ask the generator to start generating..\n+Generators::generate($gen, $git_dir, $out_dir, $rel_dir, %build_structure);\n+\n+# main flow ends here\n+# -------------------------------------------------------------------------------------------------\n+\n+\n+# 1) path: /foo/bar/baz        2) path: /foo/bar/baz   3) path: /foo/bar/baz\n+#    base: /foo/bar/baz/temp      base: /foo/bar          base: /tmp\n+#    rel:  ..                     rel:  baz               rel:  ../foo/bar/baz\n+sub makeOutRel2Git\n+{\n+    my ($path, $base) = @_;\n+    my $rel;\n+    if (\"$path\" eq \"$base\") {\n+        return \".\";\n+    } elsif ($base =~ /^$path/) {\n+        # case 1\n+        my $tmp = $base;\n+        $tmp =~ s/^$path//;\n+        foreach (split('/', $tmp)) {\n+            $rel .= \"../\" if (\"$_\" ne \"\");\n+        }\n+    } elsif ($path =~ /^$base/) {\n+        # case 2\n+        $rel = $path;\n+        $rel =~ s/^$base//;\n+        $rel = \"./$rel\";\n+    } else {\n+        my $tmp = $base;\n+        foreach (split('/', $tmp)) {\n+            $rel .= \"../\" if (\"$_\" ne \"\");\n+        }\n+        $rel .= $path;\n+    }\n+    $rel =~ s/\\/\\//\\//g; # simplify\n+    $rel =~ s/\\/$//;     # don't end with /\n+    return $rel;\n+}\n+\n+sub parseMakeOutput\n+{\n+    print \"Parsing GNU Make output to figure out build structure...\\n\";\n+    my $line = 0;\n+    while (my $text = shift @makedry) {\n+        my $ate_next;\n+        do {\n+            $ate_next = 0;\n+            $line++;\n+            chomp $text;\n+            chop $text if ($text =~ /\\r$/);\n+            if ($text =~ /\\\\$/) {\n+                $text =~ s/\\\\$//;\n+                $text .= shift @makedry;\n+                $ate_next = 1;\n+            }\n+        } while($ate_next);\n+\n+        if($text =~ / -c /) {\n+            # compilation\n+            handleCompileLine($text, $line);\n+\n+        } elsif ($text =~ / -o /) {\n+            # linking executable\n+            handleLinkLine($text, $line);\n+\n+        } elsif ($text =~ /\\.o / && $text =~ /\\.a /) {\n+            # libifying\n+            handleLibLine($text, $line);\n+#\n+#        } elsif ($text =~ /^cp /) {\n+#            # copy file around\n+#\n+#        } elsif ($text =~ /^rm -f /) {\n+#            # shell command\n+#\n+#        } elsif ($text =~ /^make[ \\[]/) {\n+#            # make output\n+#\n+#        } elsif ($text =~ /^echo /) {\n+#            # echo to file\n+#\n+#        } elsif ($text =~ /^if /) {\n+#            # shell conditional\n+#\n+#        } elsif ($text =~ /^tclsh /) {\n+#            # translation stuff\n+#\n+#        } elsif ($text =~ /^umask /) {\n+#            # handling boilerplates\n+#\n+#        } elsif ($text =~ /\\$\\(\\:\\)/) {\n+#            # ignore\n+#\n+#        } elsif ($text =~ /^FLAGS=/) {\n+#            # flags check for dependencies\n+#\n+#        } elsif ($text =~ /^'\\/usr\\/bin\\/perl' -MError -e/) {\n+#            # perl commands for copying files\n+#\n+#        } elsif ($text =~ /generate-cmdlist\\.sh/) {\n+#            # command for generating list of commands\n+#\n+#        } elsif ($text =~ /^test / && $text =~ /|| rm -f /) {\n+#            # commands removing executables, if they exist\n+#\n+#        } elsif ($text =~ /new locations or Tcl/) {\n+#            # command for detecting Tcl/Tk changes\n+#\n+#        } elsif ($text =~ /mkdir -p/) {\n+#            # command creating path\n+#\n+#        } elsif ($text =~ /: no custom templates yet/) {\n+#            # whatever\n+#\n+#        } else {\n+#            print \"Unhandled (line: $line): $text\\n\";\n+        }\n+    }\n+\n+#    use Data::Dumper;\n+#    print \"Parsed build structure:\\n\";\n+#    print Dumper(%build_structure);\n+}\n+\n+# variables for the compilation part of each step\n+my (@defines, @incpaths, @cflags, @sources);\n+\n+sub clearCompileStep\n+{\n+    @defines = ();\n+    @incpaths = ();\n+    @cflags = ();\n+    @sources = ();\n+}\n+\n+sub removeDuplicates\n+{\n+    my (%dupHash, $entry);\n+    %dupHash = map { $_, 1 } @defines;\n+    @defines = keys %dupHash;\n+\n+    %dupHash = map { $_, 1 } @incpaths;\n+    @incpaths = keys %dupHash;\n+\n+    %dupHash = map { $_, 1 } @cflags;\n+    @cflags = keys %dupHash;\n+}\n+\n+sub handleCompileLine\n+{\n+    my ($line, $lineno) = @_;\n+    my @parts = split(' ', $line);\n+    my $sourcefile;\n+    shift(@parts); # ignore cmd\n+    while (my $part = shift @parts) {\n+        if (\"$part\" eq \"-o\") {\n+            # ignore object file\n+            shift @parts;\n+        } elsif (\"$part\" eq \"-c\") {\n+            # ignore compile flag\n+        } elsif (\"$part\" eq \"-c\") {\n+        } elsif ($part =~ /^.?-I/) {\n+            push(@incpaths, $part);\n+        } elsif ($part =~ /^.?-D/) {\n+            push(@defines, $part);\n+        } elsif ($part =~ /^-/) {\n+            push(@cflags, $part);\n+        } elsif ($part =~ /\\.(c|cc|cpp)$/) {\n+            $sourcefile = $part;\n+        } else {\n+            die \"Unhandled compiler option @ line $lineno: $part\";\n+        }\n+    }\n+    @{$compile_options{\"${sourcefile}_CFLAGS\"}} = @cflags;\n+    @{$compile_options{\"${sourcefile}_DEFINES\"}} = @defines;\n+    @{$compile_options{\"${sourcefile}_INCPATHS\"}} = @incpaths;\n+    clearCompileStep();\n+}\n+\n+sub handleLibLine\n+{\n+    my ($line, $lineno) = @_;\n+    my (@objfiles, @lflags, $libout, $part);\n+    # kill cmd and rm 'prefix'\n+    $line =~ s/^rm -f .* && .* rcs //;\n+    my @parts = split(' ', $line);\n+    while ($part = shift @parts) {\n+        if ($part =~ /^-/) {\n+            push(@lflags, $part);\n+        } elsif ($part =~ /\\.(o|obj)$/) {\n+            push(@objfiles, $part);\n+        } elsif ($part =~ /\\.(a|lib)$/) {\n+            $libout = $part;\n+            $libout =~ s/\\.a$//;\n+        } else {\n+            die \"Unhandled lib option @ line $lineno: $part\";\n+        }\n+    }\n+#    print \"LibOut: '$libout'\\nLFlags: @lflags\\nOfiles: @objfiles\\n\";\n+#    exit(1);\n+    foreach (@objfiles) {\n+        my $sourcefile = $_;\n+        $sourcefile =~ s/\\.o/.c/;\n+        push(@sources, $sourcefile);\n+        push(@cflags, @{$compile_options{\"${sourcefile}_CFLAGS\"}});\n+        push(@defines, @{$compile_options{\"${sourcefile}_DEFINES\"}});\n+        push(@incpaths, @{$compile_options{\"${sourcefile}_INCPATHS\"}});\n+    }\n+    removeDuplicates();\n+\n+    push(@{$build_structure{\"LIBS\"}}, $libout);\n+    @{$build_structure{\"LIBS_${libout}\"}} = (\"_DEFINES\", \"_INCLUDES\", \"_CFLAGS\", \"_SOURCES\",\n+                                             \"_OBJECTS\");\n+    @{$build_structure{\"LIBS_${libout}_DEFINES\"}} = @defines;\n+    @{$build_structure{\"LIBS_${libout}_INCLUDES\"}} = @incpaths;\n+    @{$build_structure{\"LIBS_${libout}_CFLAGS\"}} = @cflags;\n+    @{$build_structure{\"LIBS_${libout}_LFLAGS\"}} = @lflags;\n+    @{$build_structure{\"LIBS_${libout}_SOURCES\"}} = @sources;\n+    @{$build_structure{\"LIBS_${libout}_OBJECTS\"}} = @objfiles;\n+    clearCompileStep();\n+}\n+\n+sub handleLinkLine\n+{\n+    my ($line, $lineno) = @_;\n+    my (@objfiles, @lflags, @libs, $appout, $part);\n+    my @parts = split(' ', $line);\n+    shift(@parts); # ignore cmd\n+    while ($part = shift @parts) {\n+        if ($part =~ /^-IGNORE/) {\n+            push(@lflags, $part);\n+        } elsif ($part =~ /^-[GRIMDO]/) {\n+            # eat compiler flags\n+        } elsif (\"$part\" eq \"-o\") {\n+            $appout = shift @parts;\n+        } elsif (\"$part\" eq \"-lz\") {\n+            push(@libs, \"zlib.lib\");\n+        } elsif ($part =~ /^-/) {\n+            push(@lflags, $part);\n+        } elsif ($part =~ /\\.(a|lib)$/) {\n+            $part =~ s/\\.a$/.lib/;\n+            push(@libs, $part);\n+        } elsif ($part =~ /\\.(o|obj)$/) {\n+            push(@objfiles, $part);\n+        } else {\n+            die \"Unhandled lib option @ line $lineno: $part\";\n+        }\n+    }\n+#    print \"AppOut: '$appout'\\nLFlags: @lflags\\nLibs  : @libs\\nOfiles: @objfiles\\n\";\n+#    exit(1);\n+    foreach (@objfiles) {\n+        my $sourcefile = $_;\n+        $sourcefile =~ s/\\.o/.c/;\n+        push(@sources, $sourcefile);\n+        push(@cflags, @{$compile_options{\"${sourcefile}_CFLAGS\"}});\n+        push(@defines, @{$compile_options{\"${sourcefile}_DEFINES\"}});\n+        push(@incpaths, @{$compile_options{\"${sourcefile}_INCPATHS\"}});\n+    }\n+    removeDuplicates();\n+\n+    removeDuplicates();\n+    push(@{$build_structure{\"APPS\"}}, $appout);\n+    @{$build_structure{\"APPS_${appout}\"}} = (\"_DEFINES\", \"_INCLUDES\", \"_CFLAGS\", \"_LFLAGS\",\n+                                             \"_SOURCES\", \"_OBJECTS\", \"_LIBS\");\n+    @{$build_structure{\"APPS_${appout}_DEFINES\"}} = @defines;\n+    @{$build_structure{\"APPS_${appout}_INCLUDES\"}} = @incpaths;\n+    @{$build_structure{\"APPS_${appout}_CFLAGS\"}} = @cflags;\n+    @{$build_structure{\"APPS_${appout}_LFLAGS\"}} = @lflags;\n+    @{$build_structure{\"APPS_${appout}_SOURCES\"}} = @sources;\n+    @{$build_structure{\"APPS_${appout}_OBJECTS\"}} = @objfiles;\n+    @{$build_structure{\"APPS_${appout}_LIBS\"}} = @libs;\n+    clearCompileStep();\n+}\ndiff --git a/contrib/buildsystems/generate b/contrib/buildsystems/generate\nnew file mode 100644\nindex 0000000..bc10f25\n--- /dev/null\n+++ b/contrib/buildsystems/generate\n@@ -0,0 +1,29 @@\n+#!/usr/bin/perl -w\n+######################################################################\n+# Generate buildsystem files\n+#\n+# This script generate buildsystem files based on the output of a\n+# GNU Make --dry-run, enabling Windows users to develop Git with their\n+# trusted IDE with native projects.\n+#\n+# Note:\n+# It is not meant as *the* way of building Git with MSVC, but merely a\n+# convenience. The correct way of building Git with MSVC is to use the\n+# GNU Make tool to build with the maintained Makefile in the root of\n+# the project. If you have the msysgit environment installed and\n+# available in your current console, together with the Visual Studio\n+# environment you wish to build for, all you have to do is run the\n+# command:\n+#     make MSVC=1\n+#\n+# Copyright (C) 2009 Marius Storm-Olsen <mstormo@gmail.com>\n+######################################################################\n+use strict;\n+use File::Basename;\n+use Cwd;\n+\n+my $git_dir = getcwd();\n+$git_dir =~ s=\\\\=/=g;\n+$git_dir = dirname($git_dir) while (!-e \"$git_dir/git.c\" && \"$git_dir\" ne \"\");\n+die \"Couldn't find Git repo\" if (\"$git_dir\" eq \"\");\n+exec join(\" \", (\"PERL5LIB=${git_dir}/contrib/buildsystems ${git_dir}/contrib/buildsystems/engine.pl\", @ARGV));\ndiff --git a/contrib/buildsystems/parse.pl b/contrib/buildsystems/parse.pl\nnew file mode 100644\nindex 0000000..c9656ec\n--- /dev/null\n+++ b/contrib/buildsystems/parse.pl\n@@ -0,0 +1,228 @@\n+#!/usr/bin/perl -w\n+######################################################################\n+# Do not call this script directly!\n+#\n+# The generate script ensures that @INC is correct before the engine\n+# is executed.\n+#\n+# Copyright (C) 2009 Marius Storm-Olsen <mstormo@gmail.com>\n+######################################################################\n+use strict;\n+use File::Basename;\n+use Cwd;\n+\n+my $file = $ARGV[0];\n+die \"No file provided!\" if !defined $file;\n+\n+my ($cflags, $target, $type, $line);\n+\n+open(F, \"<$file\") || die \"Couldn't open file $file\";\n+my @data = <F>;\n+close(F);\n+\n+while (my $text = shift @data) {\n+    my $ate_next;\n+    do {\n+        $ate_next = 0;\n+        $line++;\n+        chomp $text;\n+        chop $text if ($text =~ /\\r$/);\n+        if ($text =~ /\\\\$/) {\n+            $text =~ s/\\\\$//;\n+            $text .= shift @data;\n+            $ate_next = 1;\n+        }\n+    } while($ate_next);\n+\n+    if($text =~ / -c /) {\n+        # compilation\n+        handleCompileLine($text, $line);\n+\n+    } elsif ($text =~ / -o /) {\n+        # linking executable\n+        handleLinkLine($text, $line);\n+\n+    } elsif ($text =~ /\\.o / && $text =~ /\\.a /) {\n+        # libifying\n+        handleLibLine($text, $line);\n+\n+#    } elsif ($text =~ /^cp /) {\n+#        # copy file around\n+#\n+#    } elsif ($text =~ /^rm -f /) {\n+#        # shell command\n+#\n+#    } elsif ($text =~ /^make[ \\[]/) {\n+#        # make output\n+#\n+#    } elsif ($text =~ /^echo /) {\n+#        # echo to file\n+#\n+#    } elsif ($text =~ /^if /) {\n+#        # shell conditional\n+#\n+#    } elsif ($text =~ /^tclsh /) {\n+#        # translation stuff\n+#\n+#    } elsif ($text =~ /^umask /) {\n+#        # handling boilerplates\n+#\n+#    } elsif ($text =~ /\\$\\(\\:\\)/) {\n+#        # ignore\n+#\n+#    } elsif ($text =~ /^FLAGS=/) {\n+#        # flags check for dependencies\n+#\n+#    } elsif ($text =~ /^'\\/usr\\/bin\\/perl' -MError -e/) {\n+#        # perl commands for copying files\n+#\n+#    } elsif ($text =~ /generate-cmdlist\\.sh/) {\n+#        # command for generating list of commands\n+#\n+#    } elsif ($text =~ /^test / && $text =~ /|| rm -f /) {\n+#        # commands removing executables, if they exist\n+#\n+#    } elsif ($text =~ /new locations or Tcl/) {\n+#        # command for detecting Tcl/Tk changes\n+#\n+#    } elsif ($text =~ /mkdir -p/) {\n+#        # command creating path\n+#\n+#    } elsif ($text =~ /: no custom templates yet/) {\n+#        # whatever\n+\n+    } else {\n+#        print \"Unhandled (line: $line): $text\\n\";\n+    }\n+}\n+close(F);\n+\n+# use Data::Dumper;\n+# print \"Parsed build structure:\\n\";\n+# print Dumper(%build_structure);\n+\n+# -------------------------------------------------------------------\n+# Functions under here\n+# -------------------------------------------------------------------\n+my (%build_structure, @defines, @incpaths, @cflags, @sources);\n+\n+sub clearCompileStep\n+{\n+    @defines = ();\n+    @incpaths = ();\n+    @cflags = ();\n+    @sources = ();\n+}\n+\n+sub removeDuplicates\n+{\n+    my (%dupHash, $entry);\n+    %dupHash = map { $_, 1 } @defines;\n+    @defines = keys %dupHash;\n+\n+    %dupHash = map { $_, 1 } @incpaths;\n+    @incpaths = keys %dupHash;\n+\n+    %dupHash = map { $_, 1 } @cflags;\n+    @cflags = keys %dupHash;\n+\n+    %dupHash = map { $_, 1 } @sources;\n+    @sources = keys %dupHash;\n+}\n+\n+sub handleCompileLine\n+{\n+    my ($line, $lineno) = @_;\n+    my @parts = split(' ', $line);\n+    shift(@parts); # ignore cmd\n+    while (my $part = shift @parts) {\n+        if (\"$part\" eq \"-o\") {\n+            # ignore object file\n+            shift @parts;\n+        } elsif (\"$part\" eq \"-c\") {\n+            # ignore compile flag\n+        } elsif (\"$part\" eq \"-c\") {\n+        } elsif ($part =~ /^.?-I/) {\n+            push(@incpaths, $part);\n+        } elsif ($part =~ /^.?-D/) {\n+            push(@defines, $part);\n+        } elsif ($part =~ /^-/) {\n+            push(@cflags, $part);\n+        } elsif ($part =~ /\\.(c|cc|cpp)$/) {\n+            push(@sources, $part);\n+        } else {\n+            die \"Unhandled compiler option @ line $lineno: $part\";\n+        }\n+    }\n+    #print \"Sources: @sources\\nCFlags: @cflags\\nDefine: @defines\\nIncpat: @incpaths\\n\";\n+    #exit(1);\n+}\n+\n+sub handleLibLine\n+{\n+    my ($line, $lineno) = @_;\n+    my (@objfiles, @lflags, $libout, $part);\n+    # kill cmd and rm 'prefix'\n+    $line =~ s/^rm -f .* && .* rcs //;\n+    my @parts = split(' ', $line);\n+    while ($part = shift @parts) {\n+        if ($part =~ /^-/) {\n+            push(@lflags, $part);\n+        } elsif ($part =~ /\\.(o|obj)$/) {\n+            push(@objfiles, $part);\n+        } elsif ($part =~ /\\.(a|lib)$/) {\n+            $libout = $part;\n+        } else {\n+            die \"Unhandled lib option @ line $lineno: $part\";\n+        }\n+    }\n+    #print \"LibOut: '$libout'\\nLFlags: @lflags\\nOfiles: @objfiles\\n\";\n+    #exit(1);\n+    removeDuplicates();\n+    push(@{$build_structure{\"LIBS\"}}, $libout);\n+    @{$build_structure{\"LIBS_${libout}\"}} = (\"_DEFINES\", \"_INCLUDES\", \"_CFLAGS\", \"_SOURCES\",\n+                                             \"_OBJECTS\");\n+    @{$build_structure{\"LIBS_${libout}_DEFINES\"}} = @defines;\n+    @{$build_structure{\"LIBS_${libout}_INCLUDES\"}} = @incpaths;\n+    @{$build_structure{\"LIBS_${libout}_CFLAGS\"}} = @cflags;\n+    @{$build_structure{\"LIBS_${libout}_SOURCES\"}} = @sources;\n+    @{$build_structure{\"LIBS_${libout}_OBJECTS\"}} = @objfiles;\n+    clearCompileStep();\n+}\n+\n+sub handleLinkLine\n+{\n+    my ($line, $lineno) = @_;\n+    my (@objfiles, @lflags, @libs, $appout, $part);\n+    my @parts = split(' ', $line);\n+    shift(@parts); # ignore cmd\n+    while ($part = shift @parts) {\n+        if ($part =~ /^-[GRIDO]/) {\n+            # eat compiler flags\n+        } elsif (\"$part\" eq \"-o\") {\n+            $appout = shift @parts;\n+        } elsif ($part =~ /^-/) {\n+            push(@lflags, $part);\n+        } elsif ($part =~ /\\.(a|lib)$/) {\n+            push(@libs, $part);\n+        } elsif ($part =~ /\\.(o|obj)$/) {\n+            push(@objfiles, $part);\n+        } else {\n+            die \"Unhandled lib option @ line $lineno: $part\";\n+        }\n+    }\n+    #print \"AppOut: '$appout'\\nLFlags: @lflags\\nLibs  : @libs\\nOfiles: @objfiles\\n\";\n+    #exit(1);\n+    removeDuplicates();\n+    push(@{$build_structure{\"APPS\"}}, $appout);\n+    @{$build_structure{\"APPS_${appout}\"}} = (\"_DEFINES\", \"_INCLUDES\", \"_CFLAGS\", \"_LFLAGS\",\n+                                             \"_SOURCES\", \"_OBJECTS\", \"_LIBS\");\n+    @{$build_structure{\"APPS_${appout}_DEFINES\"}} = @defines;\n+    @{$build_structure{\"APPS_${appout}_INCLUDES\"}} = @incpaths;\n+    @{$build_structure{\"APPS_${appout}_CFLAGS\"}} = @cflags;\n+    @{$build_structure{\"APPS_${appout}_LFLAGS\"}} = @lflags;\n+    @{$build_structure{\"APPS_${appout}_SOURCES\"}} = @sources;\n+    @{$build_structure{\"APPS_${appout}_OBJECTS\"}} = @objfiles;\n+    @{$build_structure{\"APPS_${appout}_LIBS\"}} = @libs;\n+    clearCompileStep();\n+}\n-- \n1.6.2.1.418.g33d56.dirty\n"},{"id":"123175","messageId":"4AAE4814.8060902@gmail.com","threadId":"20946","inReplyTo":"7786dfa1b74b5c4974bcf2018d3991c215a9466f.1252925290.git.mstormo@gmail.com","subject":"Re: [PATCH 02/17] boolean is a typedef under MSVC, so rename variable to 'i_boolean'","fromName":"Marius Storm-Olsen","fromEmail":"mstormo@gmail.com","sentAt":"2009-09-14T13:41:40Z","receivedAt":"2009-09-14T13:41:40Z","isPatch":true,"sender":{"key":"mstormo@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1500?v=4"},"body":"Marius Storm-Olsen said the following on 14.09.2009 15:11:\n> With MSVC 'boolean' is already a typedef to unsigned char in the\n> rpcndr.h in the SDK. So, just rename to 'i_boolean' to avoid \n> conflicts in this one file, instead of any include magic.\n\nThis patch can actually be dropped, since patch 12 makes the windows.h \ninclude \"Lean and Mean\", and rpcndr.h is not indirectly include \nanymore. Sorry for not spotting this before sending the series..\n\n--\n.marius\n"},{"id":"123176","messageId":"81b0412b0909140659p2472c026gaece8b9388fb21d6@mail.gmail.com","threadId":"20946","inReplyTo":"1b36d8e041c9c1a6dc68f9cc3919fcf91b7a9ac6.1252925290.git.mstormo@gmail.com","subject":"Re: [PATCH 01/17] Avoid declaration after statement","fromName":"Alex Riesen","fromEmail":"raa.lkml@gmail.com","sentAt":"2009-09-14T13:59:40Z","receivedAt":"2009-09-14T13:59:40Z","isPatch":true,"sender":{"key":"raa.lkml@gmail.com","avatar":"https://avatars.githubusercontent.com/u/324101?v=4"},"body":"On Mon, Sep 14, 2009 at 15:11, Marius Storm-Olsen <mstormo@gmail.com> wrote:\n> From: Frank Li <lznuaa@gmail.com>\n>\n> Microsoft Visual C++ does not understand this C99 style\n>\n\nBut you don't use the C++ compiler (which does understand that syntax).\n"},{"id":"123177","messageId":"4AAE4CBC.6050307@gmail.com","threadId":"20946","inReplyTo":"81b0412b0909140659p2472c026gaece8b9388fb21d6@mail.gmail.com","subject":"Re: [PATCH 01/17] Avoid declaration after statement","fromName":"Marius Storm-Olsen","fromEmail":"mstormo@gmail.com","sentAt":"2009-09-14T14:01:32Z","receivedAt":"2009-09-14T14:01:32Z","isPatch":true,"sender":{"key":"mstormo@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1500?v=4"},"body":"\nAlex Riesen said the following on 14.09.2009 15:59:\n> On Mon, Sep 14, 2009 at 15:11, Marius Storm-Olsen <mstormo@gmail.com> wrote:\n>> From: Frank Li <lznuaa@gmail.com>\n>>\n>> Microsoft Visual C++ does not understand this C99 style\n> \n> But you don't use the C++ compiler (which does understand that syntax).\n\nIt doesn't change the name of the compiler which is called \"Microsoft \nVisual C++\". We're just using the C part of it :)\n\n--\n.marius\n"},{"id":"123178","messageId":"1976ea660909140704r4b730002o5d3f42463b57828d@mail.gmail.com","threadId":"20946","inReplyTo":"81b0412b0909140659p2472c026gaece8b9388fb21d6@mail.gmail.com","subject":"Re: [PATCH 01/17] Avoid declaration after statement","fromName":"Frank Li","fromEmail":"lznuaa@gmail.com","sentAt":"2009-09-14T14:04:37Z","receivedAt":"2009-09-14T14:04:37Z","isPatch":true,"sender":{"key":"lznuaa@gmail.com","avatar":"https://avatars.githubusercontent.com/u/40642?v=4"},"body":">>\n>> Microsoft Visual C++ does not understand this C99 style\n>>\n>\n> But you don't use the C++ compiler (which does understand that syntax).\n>\n\nMicrosoft Visual C++ is product name. If you think it is confuse, it\ncan change to \"MSVC\"\n"},{"id":"123179","messageId":"81b0412b0909140706s32e888ddwe4bbd668c3a7ccfd@mail.gmail.com","threadId":"20946","inReplyTo":"abaa803c30801c570f4b8e1baf6648a482bf295d.1252925290.git.mstormo@gmail.com","subject":"Re: [PATCH 15/17] Add MSVC to Makefile","fromName":"Alex Riesen","fromEmail":"raa.lkml@gmail.com","sentAt":"2009-09-14T14:06:34Z","receivedAt":"2009-09-14T14:06:34Z","isPatch":true,"sender":{"key":"raa.lkml@gmail.com","avatar":"https://avatars.githubusercontent.com/u/324101?v=4"},"body":"On Mon, Sep 14, 2009 at 15:11, Marius Storm-Olsen <mstormo@gmail.com> wrote:\n> @@ -1327,7 +1379,7 @@ strip: $(PROGRAMS) git$X\n>  git.o: git.c common-cmds.h GIT-CFLAGS\n>        $(QUIET_CC)$(CC) -DGIT_VERSION='\"$(GIT_VERSION)\"' \\\n>                '-DGIT_HTML_PATH=\"$(htmldir_SQ)\"' \\\n> -               $(ALL_CFLAGS) -c $(filter %.c,$^)\n> +               $(ALL_CFLAGS) -o git.o -c $(filter %.c,$^)\n\nWhy do you use \"-o git.o\" instead of \"-o $@\"?\n"},{"id":"123180","messageId":"81b0412b0909140710y586f0464vc7a3b08460f453d@mail.gmail.com","threadId":"20946","inReplyTo":"1976ea660909140704r4b730002o5d3f42463b57828d@mail.gmail.com","subject":"Re: [PATCH 01/17] Avoid declaration after statement","fromName":"Alex Riesen","fromEmail":"raa.lkml@gmail.com","sentAt":"2009-09-14T14:10:35Z","receivedAt":"2009-09-14T14:10:35Z","isPatch":true,"sender":{"key":"raa.lkml@gmail.com","avatar":"https://avatars.githubusercontent.com/u/324101?v=4"},"body":"On Mon, Sep 14, 2009 at 16:04, Frank Li <lznuaa@gmail.com> wrote:\n>>>\n>>> Microsoft Visual C++ does not understand this C99 style\n>>>\n>>\n>> But you don't use the C++ compiler (which does understand that syntax).\n>>\n>\n> Microsoft Visual C++ is product name. If you think it is confuse, it\n> can change to \"MSVC\"\n>\n\nI do. OTOH, some people actually use a \"product\" to compile \"software\",\nso maybe it is okay.\n"},{"id":"123181","messageId":"81b0412b0909140718i7d2c4e3cpc96477f8374d80b4@mail.gmail.com","threadId":"20946","inReplyTo":"c95a367520435feec0833d2d0edc33d86cf939a8.1252925290.git.mstormo@gmail.com","subject":"Re: [PATCH 14/17] Add ftruncate implementation for MSVC","fromName":"Alex Riesen","fromEmail":"raa.lkml@gmail.com","sentAt":"2009-09-14T14:18:23Z","receivedAt":"2009-09-14T14:18:23Z","isPatch":true,"sender":{"key":"raa.lkml@gmail.com","avatar":"https://avatars.githubusercontent.com/u/324101?v=4"},"body":"On Mon, Sep 14, 2009 at 15:11, Marius Storm-Olsen <mstormo@gmail.com> wrote:\n> +int ftruncate(int fd, __int64 length)\n> +{\n> +       HANDLE fh = (HANDLE)_get_osfhandle(fd);\n> +       if (!fh || _lseeki64(fd, length, SEEK_SET))\n\nAccording to MSDN, error is manifested by returning INVALID_HANDLE_VALUE (–1):\n\nhttp://msdn.microsoft.com/en-us/library/ks2530z6.aspx\n"},{"id":"123183","messageId":"4AAE92E1.20608@gmail.com","threadId":"20946","inReplyTo":"81b0412b0909140710y586f0464vc7a3b08460f453d@mail.gmail.com","subject":"Re: [PATCH 01/17] Avoid declaration after statement","fromName":"Marius Storm-Olsen","fromEmail":"marius@storm-olsen.com","sentAt":"2009-09-14T19:00:49Z","receivedAt":"2009-09-14T19:00:49Z","isPatch":true,"sender":{"key":"marius@storm-olsen.com","avatar":"https://avatars.githubusercontent.com/u/1500?v=4"},"body":"Alex Riesen said the following on 14.09.2009 16:10:\n> On Mon, Sep 14, 2009 at 16:04, Frank Li <lznuaa@gmail.com> wrote:\n>>>> Microsoft Visual C++ does not understand this C99 style\n>>>> \n>>> But you don't use the C++ compiler (which does understand that\n>>> syntax).\n>>> \n>> Microsoft Visual C++ is product name. If you think it is confuse,\n>> it can change to \"MSVC\"\n> \n> I do. OTOH, some people actually use a \"product\" to compile\n> \"software\", so maybe it is okay.\n\nOk, I'll s/Microsoft Visual C++/MSVC/ and resend tomorrow, just to be \nconsistent with the other patches.\n\n--\n.marius\n"},{"id":"123184","messageId":"4AAE9369.8030007@gmail.com","threadId":"20946","inReplyTo":"81b0412b0909140718i7d2c4e3cpc96477f8374d80b4@mail.gmail.com","subject":"Re: [PATCH 14/17] Add ftruncate implementation for MSVC","fromName":"Marius Storm-Olsen","fromEmail":"marius@storm-olsen.com","sentAt":"2009-09-14T19:03:05Z","receivedAt":"2009-09-14T19:03:05Z","isPatch":true,"sender":{"key":"marius@storm-olsen.com","avatar":"https://avatars.githubusercontent.com/u/1500?v=4"},"body":"Alex Riesen said the following on 14.09.2009 16:18:\n> On Mon, Sep 14, 2009 at 15:11, Marius Storm-Olsen <mstormo@gmail.com> wrote:\n>> +int ftruncate(int fd, __int64 length)\n>> +{\n>> +       HANDLE fh = (HANDLE)_get_osfhandle(fd);\n>> +       if (!fh || _lseeki64(fd, length, SEEK_SET))\n> \n> According to MSDN, error is manifested by returning INVALID_HANDLE_VALUE (–1):\n\nYou're absolutely right. I was too deep in Posix-land when writing this.\nUpdated patch will follow tomorrow.\n\n--\n.marius\n"},{"id":"123186","messageId":"e2480c70909141206r3618a291l7317696bdc98b4fb@mail.gmail.com","threadId":"20946","inReplyTo":"160ceafba5f58cfcadb13380e3d8ef724009b700.1252925290.git.mstormo@gmail.com","subject":"Re: [msysGit] [PATCH 06/17] mingw.c: Use the O_BINARY flag to open files","fromName":"Alexey Borzenkov","fromEmail":"snaury@gmail.com","sentAt":"2009-09-14T19:06:14Z","receivedAt":"2009-09-14T19:06:14Z","isPatch":true,"sender":{"key":"snaury@gmail.com","avatar":"https://gravatar.com/avatar/dd9f652303405e256f31e18690cea19ffcf21b83b04f746957334f62e399d95d?d=mp&s=160"},"body":"On Mon, Sep 14, 2009 at 5:11 PM, Marius Storm-Olsen <mstormo@gmail.com> wrote:\n> On Windows, binary files must be opened using the O_BINARY flag for\n> untranslated mode. MinGW does this for us automatically, but Microsoft\n> Visual C++ does not.\n\nWouldn't it be better to set explicitly set _fmode = _O_BINARY when\n_MSC_VER is defined? _CRT_fmode is mingw specific, that in addition to\nsetting _fmode also sets mode on stdin/stdout/stderr (see\nhttp://www.koders.com/c/fid2B507DE94598397757D615EDF52267578AD838A2.aspx).\nCurrent patch will not set binary mode for files opened with fopen, as\nwell as stdin/stdout/stderr. One catch might be that declaring it like\n\"unsigned int _fmode = _O_BINARY\" might not work, it seems that you\nare supposed to set it somewhere in the code (see\nhttp://msdn.microsoft.com/en-us/library/ee2849wt(VS.80).aspx). Perhaps\nimplementing a function like _mingw32_init_fmode in crc1.c in\nmingw-runtime and calling it early in main() would be better?\n\nThanks,\nAlexey.\n"},{"id":"123187","messageId":"4AAE94D9.7000802@gmail.com","threadId":"20946","inReplyTo":"81b0412b0909140706s32e888ddwe4bbd668c3a7ccfd@mail.gmail.com","subject":"Re: [PATCH 15/17] Add MSVC to Makefile","fromName":"Marius Storm-Olsen","fromEmail":"marius@storm-olsen.com","sentAt":"2009-09-14T19:09:13Z","receivedAt":"2009-09-14T19:09:13Z","isPatch":true,"sender":{"key":"marius@storm-olsen.com","avatar":"https://avatars.githubusercontent.com/u/1500?v=4"},"body":"\nAlex Riesen said the following on 14.09.2009 16:06:\n> On Mon, Sep 14, 2009 at 15:11, Marius Storm-Olsen <mstormo@gmail.com> wrote:\n>> @@ -1327,7 +1379,7 @@ strip: $(PROGRAMS) git$X\n>>  git.o: git.c common-cmds.h GIT-CFLAGS\n>>        $(QUIET_CC)$(CC) -DGIT_VERSION='\"$(GIT_VERSION)\"' \\\n>>                '-DGIT_HTML_PATH=\"$(htmldir_SQ)\"' \\\n>> -               $(ALL_CFLAGS) -c $(filter %.c,$^)\n>> +               $(ALL_CFLAGS) -o git.o -c $(filter %.c,$^)\n> \n> Why do you use \"-o git.o\" instead of \"-o $@\"?\n\nNo reason really. I'll resend tomorrow.\n\n--\n.marius\n"},{"id":"123189","messageId":"7v1vm9cohd.fsf@alter.siamese.dyndns.org","threadId":"20946","inReplyTo":"8da5dcea21ce49b3a57fd224c088785a9f98e867.1252925290.git.mstormo@gmail.com","subject":"Re: [PATCH 08/17] Test for WIN32 instead of __MINGW32_","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2009-09-14T19:31:26Z","receivedAt":"2009-09-14T19:31:26Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Marius Storm-Olsen <mstormo@gmail.com> writes:\n\n> From: Frank Li <lznuaa@gmail.com>\n>\n> The code which is conditional on MinGW32 is actually conditional on Windows.\n> Use the WIN32 symbol, which is defined by the MINGW32 and MSVC environments,\n> but not by Cygwin.\n>\n> Signed-off-by: Frank Li <lznuaa@gmail.com>\n> Signed-off-by: Marius Storm-Olsen <mstormo@gmail.com>\n\nThe description sounds very sensible; I wish I read this one first, before\nwasting time scratching my head while reading 03/17.  Shouldn't that patch\nbe squashed into this one?\n\n> ---\n>  help.c        |    2 +-\n>  pager.c       |    4 ++--\n>  run-command.c |    8 ++++----\n>  run-command.h |    2 +-\n>  setup.c       |    2 +-\n>  5 files changed, 9 insertions(+), 9 deletions(-)\n>\n> diff --git a/help.c b/help.c\n> index fd51b8e..e8db31f 100644\n> --- a/help.c\n> +++ b/help.c\n> @@ -126,7 +126,7 @@ static int is_executable(const char *name)\n>  \t    !S_ISREG(st.st_mode))\n>  \t\treturn 0;\n>  \n> -#ifdef __MINGW32__\n> +#ifdef WIN32\n>  {\t/* cannot trust the executable bit, peek into the file instead */\n>  \tchar buf[3] = { 0 };\n>  \tint n;\n> diff --git a/pager.c b/pager.c\n> index f416d38..86facec 100644\n> --- a/pager.c\n> +++ b/pager.c\n> @@ -9,7 +9,7 @@\n>  \n>  static int spawned_pager;\n>  \n> -#ifndef __MINGW32__\n> +#ifndef WIN32\n>  static void pager_preexec(void)\n>  {\n>  \t/*\n> @@ -72,7 +72,7 @@ void setup_pager(void)\n>  \t\tstatic const char *env[] = { \"LESS=FRSX\", NULL };\n>  \t\tpager_process.env = env;\n>  \t}\n> -#ifndef __MINGW32__\n> +#ifndef WIN32\n>  \tpager_process.preexec_cb = pager_preexec;\n>  #endif\n>  \tif (start_command(&pager_process))\n> diff --git a/run-command.c b/run-command.c\n> index 91f6d2e..cb006e7 100644\n> --- a/run-command.c\n> +++ b/run-command.c\n> @@ -75,7 +75,7 @@ fail_pipe:\n>  \n>  \ttrace_argv_printf(cmd->argv, \"trace: run_command:\");\n>  \n> -#ifndef __MINGW32__\n> +#ifndef WIN32\n>  \tfflush(NULL);\n>  \tcmd->pid = fork();\n>  \tif (!cmd->pid) {\n> @@ -315,7 +315,7 @@ int run_command_v_opt_cd_env(const char **argv, int opt, const char *dir, const\n>  \treturn run_command(&cmd);\n>  }\n>  \n> -#ifdef __MINGW32__\n> +#ifdef WIN32\n>  static unsigned WINAPI run_thread(void *data)\n>  {\n>  \tstruct async *async = data;\n> @@ -331,7 +331,7 @@ int start_async(struct async *async)\n>  \t\treturn error(\"cannot create pipe: %s\", strerror(errno));\n>  \tasync->out = pipe_out[0];\n>  \n> -#ifndef __MINGW32__\n> +#ifndef WIN32\n>  \t/* Flush stdio before fork() to avoid cloning buffers */\n>  \tfflush(NULL);\n>  \n> @@ -360,7 +360,7 @@ int start_async(struct async *async)\n>  \n>  int finish_async(struct async *async)\n>  {\n> -#ifndef __MINGW32__\n> +#ifndef WIN32\n>  \tint ret = wait_or_whine(async->pid, \"child process\", 0);\n>  #else\n>  \tDWORD ret = 0;\n> diff --git a/run-command.h b/run-command.h\n> index 0c00b25..fb34209 100644\n> --- a/run-command.h\n> +++ b/run-command.h\n> @@ -70,7 +70,7 @@ struct async {\n>  \tint (*proc)(int fd, void *data);\n>  \tvoid *data;\n>  \tint out;\t/* caller reads from here and closes it */\n> -#ifndef __MINGW32__\n> +#ifndef WIN32\n>  \tpid_t pid;\n>  #else\n>  \tHANDLE tid;\n> diff --git a/setup.c b/setup.c\n> index e3781b6..029371e 100644\n> --- a/setup.c\n> +++ b/setup.c\n> @@ -41,7 +41,7 @@ const char *prefix_path(const char *prefix, int len, const char *path)\n>  const char *prefix_filename(const char *pfx, int pfx_len, const char *arg)\n>  {\n>  \tstatic char path[PATH_MAX];\n> -#ifndef __MINGW32__\n> +#ifndef WIN32\n>  \tif (!pfx || !*pfx || is_absolute_path(arg))\n>  \t\treturn arg;\n>  \tmemcpy(path, pfx, pfx_len);\n> -- \n> 1.6.2.1.418.g33d56.dirty\n"},{"id":"123190","messageId":"4AAE9CA8.1070900@gmail.com","threadId":"20946","inReplyTo":"7v1vm9cohd.fsf@alter.siamese.dyndns.org","subject":"Re: [PATCH 08/17] Test for WIN32 instead of __MINGW32_","fromName":"Marius Storm-Olsen","fromEmail":"marius@storm-olsen.com","sentAt":"2009-09-14T19:42:32Z","receivedAt":"2009-09-14T19:42:32Z","isPatch":true,"sender":{"key":"marius@storm-olsen.com","avatar":"https://avatars.githubusercontent.com/u/1500?v=4"},"body":"Junio C Hamano said the following on 14.09.2009 21:31:\n> Marius Storm-Olsen <mstormo@gmail.com> writes:\n> \n>> From: Frank Li <lznuaa@gmail.com>\n>>\n>> The code which is conditional on MinGW32 is actually conditional on Windows.\n>> Use the WIN32 symbol, which is defined by the MINGW32 and MSVC environments,\n>> but not by Cygwin.\n>>\n>> Signed-off-by: Frank Li <lznuaa@gmail.com>\n>> Signed-off-by: Marius Storm-Olsen <mstormo@gmail.com>\n> \n> The description sounds very sensible; I wish I read this one first, before\n> wasting time scratching my head while reading 03/17.  Shouldn't that patch\n> be squashed into this one?\n\nHeh, yeah, I agree. After patch got updated with suggestions from last \nroll, it clearly makes more sense hear now. I'll update tomorrow. Thanks.\n\n--\n.marius\n"},{"id":"123191","messageId":"7vws41b946.fsf@alter.siamese.dyndns.org","threadId":"20946","inReplyTo":"c95a367520435feec0833d2d0edc33d86cf939a8.1252925290.git.mstormo@gmail.com","subject":"Re: [PATCH 14/17] Add ftruncate implementation for MSVC","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2009-09-14T19:48:41Z","receivedAt":"2009-09-14T19:48:41Z","isPatch":true,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"\nMarius Storm-Olsen <mstormo@gmail.com> writes:\n\n> The MSVC Posix implementation doesn't contain ftruncate, so add our own\n> which can handle large files (64bit offsets).\n>\n> Signed-off-by: Marius Storm-Olsen <mstormo@gmail.com>\n> ---\n>  compat/msvc.c |    8 ++++++++\n>  compat/msvc.h |    2 ++\n>  2 files changed, 10 insertions(+), 0 deletions(-)\n>\n> diff --git a/compat/msvc.c b/compat/msvc.c\n> index ac04a4c..b96b045 100644\n> --- a/compat/msvc.c\n> +++ b/compat/msvc.c\n> @@ -32,4 +32,12 @@ int closedir(DIR *dir)\n>  \treturn 0;\n>  }\n>  \n> +int ftruncate(int fd, __int64 length)\n> +{\n> +\tHANDLE fh = (HANDLE)_get_osfhandle(fd);\n> +\tif (!fh || _lseeki64(fd, length, SEEK_SET))\n> +\t\treturn -1;\n> +\treturn SetEndOfFile(fh) ? 0 : -1;\n> +}\n> +\n\n\nWouldn't it break this toy program?  ftruncate() should preserve the file\noffset and use of the seek in the above feels iffy.\n\n#include <stdlib.h>\n#include <sys/types.h>\n#include <fcntl.h>\n#include <unistd.h>\n\nint main(int ac, char **av)\n{\n        int fd = open(\"testfile\", O_CREAT|O_WRONLY, 0666);\n        if (fd < 0)\n                exit(1);\n        write(fd, \"abcdefghijklmnopqrstuvwxyz\\n\", 27);\n        lseek(fd, 7, SEEK_SET);\n        write(fd, \"H\", 1);\n        ftruncate(fd, 24);\n        write(fd, \"IJ\", 2);\n        close(fd);\n        exit(0);\n}\n\nThe only two in-tree users of ftruncate() do not care about this, though.\nThey both seek to the beginning and then truncate to zero length.\n"},{"id":"123192","messageId":"200909142200.52174.j6t@kdbg.org","threadId":"20946","inReplyTo":"1d699897d4163224ce22db9400569fab20547e9d.1252925290.git.mstormo@gmail.com","subject":"Re: [PATCH 07/17] Fix __stdcall/WINAPI placement and function prototype","fromName":"Johannes Sixt","fromEmail":"j6t@kdbg.org","sentAt":"2009-09-14T20:00:52Z","receivedAt":"2009-09-14T20:00:52Z","isPatch":true,"sender":{"key":"j6t@kdbg.org","avatar":"https://avatars.githubusercontent.com/u/14810926?v=4"},"body":"\nOn Montag, 14. September 2009, Marius Storm-Olsen wrote:\n> WINAPI is a macro which translates into the proper calling convention, so\n> replace __stdcall with that.\n\nI've already pointed out elsewhere that the documentation of _beginthreadex \nexplicitly says that the calling convention of the function pointer must be \n__stdcall. It does not mention WINAPI. Therefore, I think that these two \nchanges are not correct:\n\n> -static __stdcall unsigned ticktack(void *dummy)\n> +static unsigned WINAPI ticktack(void *dummy)\n\n> -static __stdcall unsigned run_thread(void *data)\n> +static unsigned WINAPI run_thread(void *data)\n\nYou should s/WINAPI/__stdcall/.\n\n-- Hannes\n"},{"id":"123197","messageId":"alpine.DEB.1.00.0909150224010.8306@pacific.mpi-cbg.de","threadId":"20946","inReplyTo":"200909142200.52174.j6t@kdbg.org","subject":"Re: [msysGit] [PATCH 07/17] Fix __stdcall/WINAPI placement and function prototype","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2009-09-15T00:24:53Z","receivedAt":"2009-09-15T00:24:53Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"Hi,\n\nOn Mon, 14 Sep 2009, Johannes Sixt wrote:\n\n> On Montag, 14. September 2009, Marius Storm-Olsen wrote:\n> > WINAPI is a macro which translates into the proper calling convention, so\n> > replace __stdcall with that.\n> \n> I've already pointed out elsewhere that the documentation of \n> _beginthreadex explicitly says that the calling convention of the \n> function pointer must be __stdcall. It does not mention WINAPI. \n> Therefore, I think that these two changes are not correct:\n> \n> > -static __stdcall unsigned ticktack(void *dummy)\n> > +static unsigned WINAPI ticktack(void *dummy)\n> \n> > -static __stdcall unsigned run_thread(void *data)\n> > +static unsigned WINAPI run_thread(void *data)\n> \n> You should s/WINAPI/__stdcall/.\n\nI don't think that comments by our most proficient MSys guy should be \ndisregarded as thee comments were.\n\nCiao,\nDscho\n"},{"id":"123207","messageId":"4AAF2D3E.3030706@gmail.com","threadId":"20946","inReplyTo":"alpine.DEB.1.00.0909150224010.8306@pacific.mpi-cbg.de","subject":"Re: [msysGit] [PATCH 07/17] Fix __stdcall/WINAPI placement and function prototype","fromName":"Marius Storm-Olsen","fromEmail":"mstormo@gmail.com","sentAt":"2009-09-15T05:59:26Z","receivedAt":"2009-09-15T05:59:26Z","isPatch":true,"sender":{"key":"mstormo@gmail.com","avatar":"https://avatars.githubusercontent.com/u/1500?v=4"},"body":"Johannes Schindelin said the following on 15.09.2009 02:24:\n> Hi,\n> \n> On Mon, 14 Sep 2009, Johannes Sixt wrote:\n> \n>> On Montag, 14. September 2009, Marius Storm-Olsen wrote:\n>>> WINAPI is a macro which translates into the proper calling convention, so\n>>> replace __stdcall with that.\n>> I've already pointed out elsewhere that the documentation of \n>> _beginthreadex explicitly says that the calling convention of the \n>> function pointer must be __stdcall. It does not mention WINAPI. \n>> Therefore, I think that these two changes are not correct:\n>>\n>>> -static __stdcall unsigned ticktack(void *dummy)\n>>> +static unsigned WINAPI ticktack(void *dummy)\n>>> -static __stdcall unsigned run_thread(void *data)\n>>> +static unsigned WINAPI run_thread(void *data)\n>> You should s/WINAPI/__stdcall/.\n> \n> I don't think that comments by our most proficient MSys guy should be \n> disregarded as thee comments were.\n\nI also pointed out that WINAPI is just a define for __stdcall (since \n_MSC_VER >= 800; VC 6.0 being _MSC_VER == 1200 and VC 2008 being \n_MSC_VER == 1500), and that's probably never going to change now. So, \nthe change is not as bad as Hannes portrays it to be, and makes things \nless convoluted by using the same convention all over.\n\nHowever, I'll cave for the pressure, and reroll the commit :)\n\n--\n.marius\n"}]}