diff options
author | peavey <peavey@e03df62e-2008-0410-955e-edbf42e46eb7> | 2009-10-10 14:06:35 +0000 |
---|---|---|
committer | peavey <peavey@e03df62e-2008-0410-955e-edbf42e46eb7> | 2009-10-10 14:06:35 +0000 |
commit | 72f1e30cb3983bc0c50cea6e87f589091e07dd23 (patch) | |
tree | d9c59048cdc2e7e8bd1422c7cf5ed66ffdc839c0 | |
parent | 027668741c47f894a914e8d40b2b74b15b824456 (diff) |
Add building of inspircd_version.h to windows port and remove the overlapping values from inspircd_config.h. Use a similar uname-ish build of SYSTEM info string as well as using the same exact info for VERSION and REVISION as the *nixes.
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@11818 e03df62e-2008-0410-955e-edbf42e46eb7
-rw-r--r-- | win/configure.cpp | 62 |
1 files changed, 51 insertions, 11 deletions
diff --git a/win/configure.cpp b/win/configure.cpp index b6f009fda..2ef102841 100644 --- a/win/configure.cpp +++ b/win/configure.cpp @@ -17,6 +17,7 @@ #define WIN32_LEAN_AND_MEAN #include <windows.h> #include <stdio.h> +#include <process.h> #include <string> #include <time.h> #include "inspircd_win32wrapper.h" @@ -144,6 +145,42 @@ int get_svn_revision(char * buffer, size_t len) return rev; } +void get_machine_info(char * buffer, size_t len) +{ + char buf[500]; + char buf2[500]; + + DWORD dwSize = sizeof(buf); + if (!GetComputerNameEx((COMPUTER_NAME_FORMAT)ComputerNameDnsFullyQualified, buf, &dwSize)) + sprintf(buf, "%s", "unknown"); + + FILE * f = fopen("ver.txt.tmp", "r"); + if (f) + { + while (fgets(buf2, 500, f)) { } + fclose(f); + //unlink("ver.txt.tmp"); + } + else + sprintf(buf2, "%s", "unknown"); + + sprintf(buffer, "%s ", buf); + //strip newlines + char* b = buffer + strlen(buf)+1; + char *b2 = buf2; + while (*b2) + { + if (*b2 != 10 && *b2 != 13) + { + *b = *b2; + b++; + } + *b2++; + } + *b = 0; + printf_c("\nLAL:%s:LAL\n", buffer); +} + int __stdcall WinMain(IN HINSTANCE hInstance, IN HINSTANCE hPrevInstance, IN LPSTR lpCmdLine, IN int nShowCmd ) { if (!strcmp(lpCmdLine, "/rebase")) @@ -151,6 +188,7 @@ int __stdcall WinMain(IN HINSTANCE hInstance, IN HINSTANCE hPrevInstance, IN LPS Rebase(); return 0; } + FILE * j = fopen("inspircd_config.h", "r"); if (j) { @@ -161,6 +199,9 @@ int __stdcall WinMain(IN HINSTANCE hInstance, IN HINSTANCE hPrevInstance, IN LPS } } + // call before we hook console handles + system("ver > ver.txt.tmp"); + AllocConsole(); // pipe standard handles to this console @@ -202,6 +243,8 @@ void Run() char openssl_lib_path[MAX_PATH]; int revision = get_svn_revision(revision_text, MAX_PATH); char version[514]; + char machine_text[MAX_PATH]; + get_machine_info(machine_text, MAX_PATH); // grab version FILE * fI = fopen("..\\src\\version.sh", "r"); @@ -331,17 +374,6 @@ void Run() fprintf(f, "#define MOD_PATH \"%s\"\n", mod_path); fprintf(f, "#define SOMAXCONN_S \"128\"\n"); fprintf(f, "#define LIBRARYDIR \"%s\"\n", library_dir); - fprintf(f, "#define VERSION \"%s\"\n", version); - fprintf(f, "#define REVISION \"%s\"\n", revision_text); - - OSVERSIONINFO vi; - vi.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); - GetVersionEx(&vi); -#ifdef WIN64 - fprintf(f, "#define SYSTEM \"Windows_x64 %u.%u.%u %s\"\n", vi.dwMajorVersion, vi.dwMinorVersion, vi.dwBuildNumber, vi.szCSDVersion); -#else - fprintf(f, "#define SYSTEM \"Windows_x32 %u.%u.%u %s\"\n", vi.dwMajorVersion, vi.dwMinorVersion, vi.dwBuildNumber, vi.szCSDVersion); -#endif fprintf(f, "#define MAXBUF 514\n"); fprintf(f, "\n#include \"inspircd_win32wrapper.h\""); @@ -362,6 +394,14 @@ void Run() fclose(f); sc(TGREEN); printf(" done\n"); sc(TNORMAL); + printf("Writing inspircd_version.h..."); + f = fopen("inspircd_version.h", "w"); + fprintf(f, "#define VERSION \"%s\"\n", version); + fprintf(f, "#define REVISION \"%d\"\n", revision); + fprintf(f, "#define SYSTEM \"%s\"\n", machine_text); + fclose(f); + + sc(TGREEN); printf(" done\n"); sc(TNORMAL); printf("Writing command and module compilation scripts..."); WriteCompileCommands(); WriteCompileModules(); |