diff options
Diffstat (limited to 'win')
-rw-r--r-- | win/configure.cpp | 58 | ||||
-rw-r--r-- | win/m_spanningtreeVC80.vcproj | 2 | ||||
-rw-r--r-- | win/rebase.bat | 3 |
3 files changed, 63 insertions, 0 deletions
diff --git a/win/configure.cpp b/win/configure.cpp index 94d1b898c..1b097da06 100644 --- a/win/configure.cpp +++ b/win/configure.cpp @@ -26,6 +26,7 @@ void Run(); void Banner(); void WriteCompileModules(); void WriteCompileCommands(); +void Rebase(); /* detects if we are running windows xp or higher (5.1) */ bool iswinxp() @@ -143,6 +144,17 @@ int get_svn_revision(char * buffer, size_t len) int __stdcall WinMain(IN HINSTANCE hInstance, IN HINSTANCE hPrevInstance, IN LPSTR lpCmdLine, IN int nShowCmd ) { + if (!strcmp(lpCmdLine, "/rebase")) + { + AllocConsole(); + // pipe standard handles to this console + freopen("CONIN$", "r", stdin); + freopen("CONOUT$", "w", stdout); + freopen("CONOUT$", "w", stderr); + Rebase(); + FreeConsole(); + return 0; + } FILE * j = fopen("inspircd_config.h", "r"); if (j) { @@ -412,6 +424,52 @@ void Run() printf("\nconfigure is done.. exiting!\n"); } +void Rebase() +{ + char dest[65535]; + char command[65535]; + + *dest = 0; + + WIN32_FIND_DATA fd; + HANDLE fh = FindFirstFile("..\\bin\\release\\lib\\*.so", &fd); + if(fh == INVALID_HANDLE_VALUE) + return; + + do + { + strcat(dest, " ..\\bin\\release\\lib\\"); + strcat(dest, fd.cFileName); + } + while (FindNextFile(fh, &fd)); + + FindClose(fh); + + sprintf(command, "rebase.exe -v -b 10000000 -c baseaddr_commands.txt %s", dest); + printf("%s\n", command); + system(command); + + fh = FindFirstFile("..\\bin\\release\\modules\\*.so", &fd); + if(fh == INVALID_HANDLE_VALUE) + return; + + *dest = 0; + + do + { + strcat(dest, " ..\\bin\\release\\modules\\"); + strcat(dest, fd.cFileName); + } + while (FindNextFile(fh, &fd)); + + sprintf(command, "rebase.exe -v -b 10000000 -c baseaddr_modules.txt %s", dest); + printf("%s\n", command); + system(command); + + FindClose(fh); + +} + void WriteCompileCommands() { char commands[300][100]; diff --git a/win/m_spanningtreeVC80.vcproj b/win/m_spanningtreeVC80.vcproj index db0552de7..59b2e1ca4 100644 --- a/win/m_spanningtreeVC80.vcproj +++ b/win/m_spanningtreeVC80.vcproj @@ -180,6 +180,8 @@ />
<Tool
Name="VCPostBuildEventTool"
+ Description="Re-basing shared objects..."
+ CommandLine="$(InputDir)\rebase.bat
"
/>
</Configuration>
<Configuration
diff --git a/win/rebase.bat b/win/rebase.bat new file mode 100644 index 000000000..e954f0a46 --- /dev/null +++ b/win/rebase.bat @@ -0,0 +1,3 @@ +rem just in case +set PATH=%PATH%;C:\Program Files\Microsoft Platform SDK for Windows Server 2003 R2\Bin +configure.exe /rebase |