From a2171043b5df6232661beebc422de4139a26450c Mon Sep 17 00:00:00 2001 From: Doug Turner Date: Mon, 22 Sep 2008 23:07:21 +0100 Subject: [PATCH] Bug 444485 - Make WinMobile Build work with Visual Studio 2008. New Files. patch by wolfe. r=dougt+ted. npodb --- .../shunt/build/vs9/mozce_shunt_static.sln | 62 + .../shunt/build/vs9/mozce_shunt_static.vcproj | 1261 +++++++++++++++++ build/wince/shunt/mozce_dbg.c | 81 ++ .../wince/tools/vs8ppc2003arm/arm-wince-res.c | 19 + .../wince/tools/vs9ppc2003arm/arm-wince-as.c | 17 + .../wince/tools/vs9ppc2003arm/arm-wince-gcc.c | 92 ++ .../wince/tools/vs9ppc2003arm/arm-wince-lib.c | 16 + .../tools/vs9ppc2003arm/arm-wince-link.c | 62 + .../wince/tools/vs9ppc2003arm/arm-wince-res.c | 19 + build/wince/tools/vs9ppc2003arm/toolspath.h | 277 ++++ 10 files changed, 1906 insertions(+) create mode 100644 build/wince/shunt/build/vs9/mozce_shunt_static.sln create mode 100644 build/wince/shunt/build/vs9/mozce_shunt_static.vcproj create mode 100644 build/wince/shunt/mozce_dbg.c create mode 100644 build/wince/tools/vs8ppc2003arm/arm-wince-res.c create mode 100644 build/wince/tools/vs9ppc2003arm/arm-wince-as.c create mode 100644 build/wince/tools/vs9ppc2003arm/arm-wince-gcc.c create mode 100644 build/wince/tools/vs9ppc2003arm/arm-wince-lib.c create mode 100644 build/wince/tools/vs9ppc2003arm/arm-wince-link.c create mode 100644 build/wince/tools/vs9ppc2003arm/arm-wince-res.c create mode 100644 build/wince/tools/vs9ppc2003arm/toolspath.h diff --git a/build/wince/shunt/build/vs9/mozce_shunt_static.sln b/build/wince/shunt/build/vs9/mozce_shunt_static.sln new file mode 100644 index 000000000000..01cc9cf214cc --- /dev/null +++ b/build/wince/shunt/build/vs9/mozce_shunt_static.sln @@ -0,0 +1,62 @@ + +Microsoft Visual Studio Solution File, Format Version 10.00 +# Visual Studio 2008 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mozce_shunt_static", "mozce_shunt_static.vcproj", "{082BAB06-D10F-4C57-B123-F84DC06C246D}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Pocket PC 2003 (ARMV4) = Debug|Pocket PC 2003 (ARMV4) + Debug|Smartphone 2003 (ARMV4) = Debug|Smartphone 2003 (ARMV4) + Debug|Windows Mobile 5.0 Pocket PC SDK (ARMV4I) = Debug|Windows Mobile 5.0 Pocket PC SDK (ARMV4I) + Debug|Windows Mobile 5.0 Smartphone SDK (ARMV4I) = Debug|Windows Mobile 5.0 Smartphone SDK (ARMV4I) + Debug|Windows Mobile 6 Professional SDK (ARMV4I) = Debug|Windows Mobile 6 Professional SDK (ARMV4I) + Debug|Windows Mobile 6 Standard SDK (ARMV4I) = Debug|Windows Mobile 6 Standard SDK (ARMV4I) + Release|Pocket PC 2003 (ARMV4) = Release|Pocket PC 2003 (ARMV4) + Release|Smartphone 2003 (ARMV4) = Release|Smartphone 2003 (ARMV4) + Release|Windows Mobile 5.0 Pocket PC SDK (ARMV4I) = Release|Windows Mobile 5.0 Pocket PC SDK (ARMV4I) + Release|Windows Mobile 5.0 Smartphone SDK (ARMV4I) = Release|Windows Mobile 5.0 Smartphone SDK (ARMV4I) + Release|Windows Mobile 6 Professional SDK (ARMV4I) = Release|Windows Mobile 6 Professional SDK (ARMV4I) + Release|Windows Mobile 6 Standard SDK (ARMV4I) = Release|Windows Mobile 6 Standard SDK (ARMV4I) + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {082BAB06-D10F-4C57-B123-F84DC06C246D}.Debug|Pocket PC 2003 (ARMV4).ActiveCfg = Debug|Pocket PC 2003 (ARMV4) + {082BAB06-D10F-4C57-B123-F84DC06C246D}.Debug|Pocket PC 2003 (ARMV4).Build.0 = Debug|Pocket PC 2003 (ARMV4) + {082BAB06-D10F-4C57-B123-F84DC06C246D}.Debug|Pocket PC 2003 (ARMV4).Deploy.0 = Debug|Pocket PC 2003 (ARMV4) + {082BAB06-D10F-4C57-B123-F84DC06C246D}.Debug|Smartphone 2003 (ARMV4).ActiveCfg = Debug|Smartphone 2003 (ARMV4) + {082BAB06-D10F-4C57-B123-F84DC06C246D}.Debug|Smartphone 2003 (ARMV4).Build.0 = Debug|Smartphone 2003 (ARMV4) + {082BAB06-D10F-4C57-B123-F84DC06C246D}.Debug|Smartphone 2003 (ARMV4).Deploy.0 = Debug|Smartphone 2003 (ARMV4) + {082BAB06-D10F-4C57-B123-F84DC06C246D}.Debug|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).ActiveCfg = Debug|Windows Mobile 5.0 Pocket PC SDK (ARMV4I) + {082BAB06-D10F-4C57-B123-F84DC06C246D}.Debug|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).Build.0 = Debug|Windows Mobile 5.0 Pocket PC SDK (ARMV4I) + {082BAB06-D10F-4C57-B123-F84DC06C246D}.Debug|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).Deploy.0 = Debug|Windows Mobile 5.0 Pocket PC SDK (ARMV4I) + {082BAB06-D10F-4C57-B123-F84DC06C246D}.Debug|Windows Mobile 5.0 Smartphone SDK (ARMV4I).ActiveCfg = Debug|Windows Mobile 5.0 Smartphone SDK (ARMV4I) + {082BAB06-D10F-4C57-B123-F84DC06C246D}.Debug|Windows Mobile 5.0 Smartphone SDK (ARMV4I).Build.0 = Debug|Windows Mobile 5.0 Smartphone SDK (ARMV4I) + {082BAB06-D10F-4C57-B123-F84DC06C246D}.Debug|Windows Mobile 5.0 Smartphone SDK (ARMV4I).Deploy.0 = Debug|Windows Mobile 5.0 Smartphone SDK (ARMV4I) + {082BAB06-D10F-4C57-B123-F84DC06C246D}.Debug|Windows Mobile 6 Professional SDK (ARMV4I).ActiveCfg = Debug|Windows Mobile 6 Professional SDK (ARMV4I) + {082BAB06-D10F-4C57-B123-F84DC06C246D}.Debug|Windows Mobile 6 Professional SDK (ARMV4I).Build.0 = Debug|Windows Mobile 6 Professional SDK (ARMV4I) + {082BAB06-D10F-4C57-B123-F84DC06C246D}.Debug|Windows Mobile 6 Professional SDK (ARMV4I).Deploy.0 = Debug|Windows Mobile 6 Professional SDK (ARMV4I) + {082BAB06-D10F-4C57-B123-F84DC06C246D}.Debug|Windows Mobile 6 Standard SDK (ARMV4I).ActiveCfg = Debug|Windows Mobile 6 Standard SDK (ARMV4I) + {082BAB06-D10F-4C57-B123-F84DC06C246D}.Debug|Windows Mobile 6 Standard SDK (ARMV4I).Build.0 = Debug|Windows Mobile 6 Standard SDK (ARMV4I) + {082BAB06-D10F-4C57-B123-F84DC06C246D}.Debug|Windows Mobile 6 Standard SDK (ARMV4I).Deploy.0 = Debug|Windows Mobile 6 Standard SDK (ARMV4I) + {082BAB06-D10F-4C57-B123-F84DC06C246D}.Release|Pocket PC 2003 (ARMV4).ActiveCfg = Release|Pocket PC 2003 (ARMV4) + {082BAB06-D10F-4C57-B123-F84DC06C246D}.Release|Pocket PC 2003 (ARMV4).Build.0 = Release|Pocket PC 2003 (ARMV4) + {082BAB06-D10F-4C57-B123-F84DC06C246D}.Release|Pocket PC 2003 (ARMV4).Deploy.0 = Release|Pocket PC 2003 (ARMV4) + {082BAB06-D10F-4C57-B123-F84DC06C246D}.Release|Smartphone 2003 (ARMV4).ActiveCfg = Release|Smartphone 2003 (ARMV4) + {082BAB06-D10F-4C57-B123-F84DC06C246D}.Release|Smartphone 2003 (ARMV4).Build.0 = Release|Smartphone 2003 (ARMV4) + {082BAB06-D10F-4C57-B123-F84DC06C246D}.Release|Smartphone 2003 (ARMV4).Deploy.0 = Release|Smartphone 2003 (ARMV4) + {082BAB06-D10F-4C57-B123-F84DC06C246D}.Release|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).ActiveCfg = Release|Windows Mobile 5.0 Pocket PC SDK (ARMV4I) + {082BAB06-D10F-4C57-B123-F84DC06C246D}.Release|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).Build.0 = Release|Windows Mobile 5.0 Pocket PC SDK (ARMV4I) + {082BAB06-D10F-4C57-B123-F84DC06C246D}.Release|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).Deploy.0 = Release|Windows Mobile 5.0 Pocket PC SDK (ARMV4I) + {082BAB06-D10F-4C57-B123-F84DC06C246D}.Release|Windows Mobile 5.0 Smartphone SDK (ARMV4I).ActiveCfg = Release|Windows Mobile 5.0 Smartphone SDK (ARMV4I) + {082BAB06-D10F-4C57-B123-F84DC06C246D}.Release|Windows Mobile 5.0 Smartphone SDK (ARMV4I).Build.0 = Release|Windows Mobile 5.0 Smartphone SDK (ARMV4I) + {082BAB06-D10F-4C57-B123-F84DC06C246D}.Release|Windows Mobile 5.0 Smartphone SDK (ARMV4I).Deploy.0 = Release|Windows Mobile 5.0 Smartphone SDK (ARMV4I) + {082BAB06-D10F-4C57-B123-F84DC06C246D}.Release|Windows Mobile 6 Professional SDK (ARMV4I).ActiveCfg = Release|Windows Mobile 6 Professional SDK (ARMV4I) + {082BAB06-D10F-4C57-B123-F84DC06C246D}.Release|Windows Mobile 6 Professional SDK (ARMV4I).Build.0 = Release|Windows Mobile 6 Professional SDK (ARMV4I) + {082BAB06-D10F-4C57-B123-F84DC06C246D}.Release|Windows Mobile 6 Professional SDK (ARMV4I).Deploy.0 = Release|Windows Mobile 6 Professional SDK (ARMV4I) + {082BAB06-D10F-4C57-B123-F84DC06C246D}.Release|Windows Mobile 6 Standard SDK (ARMV4I).ActiveCfg = Release|Windows Mobile 6 Standard SDK (ARMV4I) + {082BAB06-D10F-4C57-B123-F84DC06C246D}.Release|Windows Mobile 6 Standard SDK (ARMV4I).Build.0 = Release|Windows Mobile 6 Standard SDK (ARMV4I) + {082BAB06-D10F-4C57-B123-F84DC06C246D}.Release|Windows Mobile 6 Standard SDK (ARMV4I).Deploy.0 = Release|Windows Mobile 6 Standard SDK (ARMV4I) + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/build/wince/shunt/build/vs9/mozce_shunt_static.vcproj b/build/wince/shunt/build/vs9/mozce_shunt_static.vcproj new file mode 100644 index 000000000000..d9a1c819fd6f --- /dev/null +++ b/build/wince/shunt/build/vs9/mozce_shunt_static.vcproj @@ -0,0 +1,1261 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/build/wince/shunt/mozce_dbg.c b/build/wince/shunt/mozce_dbg.c new file mode 100644 index 000000000000..ea5ca1ffd849 --- /dev/null +++ b/build/wince/shunt/mozce_dbg.c @@ -0,0 +1,81 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- + * + * ***** BEGIN LICENSE BLOCK ***** + * Version: MPL 1.1/GPL 2.0/LGPL 2.1 + * + * The contents of this file are subject to the Mozilla Public License Version + * 1.1 (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * http://www.mozilla.org/MPL/ + * + * Software distributed under the License is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License + * for the specific language governing rights and limitations under the + * License. + * + * The Original Code is Mozilla CE Shunt Library. + * + * The Initial Developer of the Original Code is Mozilla Corporation. + * Portions created by the Initial Developer are Copyright (C) 2008 + * the Initial Developer. All Rights Reserved. + * + * Contributor(s): + * John Wolfe, 21-July-2008 + * + * Alternatively, the contents of this file may be used under the terms of + * either the GNU General Public License Version 2 or later (the "GPL"), or + * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"), + * in which case the provisions of the GPL or the LGPL are applicable instead + * of those above. If you wish to allow use of your version of this file only + * under the terms of either the GPL or the LGPL, and not to allow others to + * use your version of this file under the terms of the MPL, indicate your + * decision by deleting the provisions above and replace them with the notice + * and other provisions required by the GPL or the LGPL. If you do not delete + * the provisions above, a recipient may use your version of this file under + * the terms of any one of the MPL, the GPL or the LGPL. + * + * ***** END LICENSE BLOCK ***** */ + +#include "mozce_internal.h" + +#include + + +#ifndef SHUNT_LOG_ENABLED + +void mozce_DebugInit() { }; +void mozce_DebugDeinit() { }; +void mozce_DebugWriteToLog(char *str) { }; + +#else + +#define LOGFILE "\\Storage Card\\shuntlog.txt" + +FILE *gpDebugFile = NULL; + +void mozce_DebugInit() +{ + if ( NULL == gpDebugFile ) + gpDebugFile = fopen(LOGFILE, "a+"); +} + +void mozce_DebugDeinit() +{ + if ( gpDebugFile ) { + fclose( gpDebugFile ); + gpDebugFile = NULL; + } +} + +void mozce_DebugWriteToLog(char *str) +{ + if ( NULL == gpDebugFile ) + mozce_DebugInit(); + + if ( gpDebugFile ) { + fprintf(gpDebugFile, "%s", str); + fflush(gpDebugFile); + } +} + +#endif diff --git a/build/wince/tools/vs8ppc2003arm/arm-wince-res.c b/build/wince/tools/vs8ppc2003arm/arm-wince-res.c new file mode 100644 index 000000000000..07ae5917d6c3 --- /dev/null +++ b/build/wince/tools/vs8ppc2003arm/arm-wince-res.c @@ -0,0 +1,19 @@ +#include "toolspath.h" + +int +main(int argc, char **argv) +{ + int iRetVal; + char* args[1000]; + int i = 0; + int j = 0; + int k = 0; + int s = 0; + args[i++] = RC_PATH; + + argpath_conv(&argv[1], &args[i]); + + dumpargs(args); + + return run(args); +} diff --git a/build/wince/tools/vs9ppc2003arm/arm-wince-as.c b/build/wince/tools/vs9ppc2003arm/arm-wince-as.c new file mode 100644 index 000000000000..6852513b190f --- /dev/null +++ b/build/wince/tools/vs9ppc2003arm/arm-wince-as.c @@ -0,0 +1,17 @@ +#include "toolspath.h" + +int +main(int argc, char **argv) +{ + char* args[1000]; + int i = 0; + + args[i++] = ASM_PATH; + args[i++] = "-I\"" WCE_INC "\""; + + i += argpath_conv(&argv[1], &args[i]); + + dumpargs(args); + + return run(args); +} diff --git a/build/wince/tools/vs9ppc2003arm/arm-wince-gcc.c b/build/wince/tools/vs9ppc2003arm/arm-wince-gcc.c new file mode 100644 index 000000000000..b61a2ee21a6d --- /dev/null +++ b/build/wince/tools/vs9ppc2003arm/arm-wince-gcc.c @@ -0,0 +1,92 @@ +#include "toolspath.h" + +int +main(int argc, char **argv) +{ + int startOfArgvs; + int i = 0; + int j = 0; + int link = 0; + + char* args[1000]; + char outputFileArg[1000]; + + args[i++] = CL_PATH; + args[i++] = "/I\"" WCE_INC "\""; + args[i++] = "/I\"" SHUNT_INC "\""; + args[i++] = "/FI\"mozce_shunt.h\""; + + args[i++] = "/DMOZCE_STATIC_BUILD"; + args[i++] = "/DUNICODE"; + args[i++] = "/D_UNICODE_"; + args[i++] = "/DARM"; + args[i++] = "/D_ARM_"; + args[i++] = "/DWINCE"; + args[i++] = "/D_WIN32_WCE=0x502"; + args[i++] = "/DUNDER_CE"; + args[i++] = "/DWIN32_PLATFORM_WFSP"; +// args[i++] = "/DWIN32_PLATFORM_PSPC"; +// args[i++] = "/DPOCKETPC2003_UI_MODEL"; + args[i++] = "/D_WINDOWS"; + + args[i++] = "/Zc:wchar_t-"; // + args[i++] = "/GS-"; // disable security checks + args[i++] = "/GR-"; // disable C++ RTTI + args[i++] = "/fp:fast"; + + startOfArgvs = i; + + i += argpath_conv(&argv[1], &args[i]); + + // if /Fe is passed, then link + // + // if -o is passed, then blank out this argument, and place a "/Fo" + // before the next argument + while(argv[j]) + { + if (strncmp(argv[j], "-o", 2) == 0) + { + printf("%s is -o\n",argv[j]); + + + link = strstr(args[startOfArgvs+j], ".obj") ? 0:1; + + + // If we are outputting a .OBJ file, then we are + // NOT linking, and we need to do some fancy + // footwork to output "/FoFILENAME" as an argument + args[startOfArgvs+j-1] = ""; + strcpy(outputFileArg, ( strstr(args[startOfArgvs+j], ".exe") )?"/Fe":"/Fo"); + strcat(outputFileArg, args[startOfArgvs+j]); + args[startOfArgvs+j] = outputFileArg; + } + j++; + } + + if (link) + { + args[i++] = "/link"; + + args[i++] = "/ENTRY:main"; + + args[i++] = "/SUBSYSTEM:WINDOWSCE,5.02"; + + args[i++] = "/LIBPATH:\"" WCE_LIB "\""; + args[i++] = "/LIBPATH:\"" WCE_CRT "\""; + args[i++] = "/LIBPATH:\"" SHUNT_LIB "\""; + args[i++] = "mozce_shunt.lib"; + args[i++] = "winsock.lib"; + args[i++] = "corelibc.lib"; + args[i++] = "coredll.lib"; + + + args[i++] = "/NODEFAULTLIB:LIBC"; + args[i++] = "/NODEFAULTLIB:OLDNAMES"; + + } + + args[i] = NULL; + + dumpargs(args); + return run(args); +} diff --git a/build/wince/tools/vs9ppc2003arm/arm-wince-lib.c b/build/wince/tools/vs9ppc2003arm/arm-wince-lib.c new file mode 100644 index 000000000000..1c0e79b3df1b --- /dev/null +++ b/build/wince/tools/vs9ppc2003arm/arm-wince-lib.c @@ -0,0 +1,16 @@ +#include "toolspath.h" + + +int +main(int argc, char **argv) +{ + char* args[1000]; + int i = 0; + + args[i++] = LIB_PATH; + + argpath_conv(&argv[1], &args[i]); + + return run(args); + +} diff --git a/build/wince/tools/vs9ppc2003arm/arm-wince-link.c b/build/wince/tools/vs9ppc2003arm/arm-wince-link.c new file mode 100644 index 000000000000..eb09456c446b --- /dev/null +++ b/build/wince/tools/vs9ppc2003arm/arm-wince-link.c @@ -0,0 +1,62 @@ +#include "toolspath.h" + +int +main(int argc, char **argv) +{ + int iRetVal; + char* args[1000]; + int i = 0; + int j = 0; + int k = 0; + int s = 0; + args[i++] = LINK_PATH; + + args[i++] = "/LIBPATH:\"" WCE_LIB "\""; + args[i++] = "/LIBPATH:\"" WCE_CRT "\""; + args[i++] = "/LIBPATH:\"" SHUNT_LIB "\""; + + args[i++] = "winsock.lib"; + args[i++] = "corelibc.lib"; + args[i++] = "coredll.lib"; + args[i++] = "ceshell.lib"; + args[i++] = "ole32.lib"; + args[i++] = "mmtimer.lib"; + args[i++] = "mozce_shunt.lib"; + + args[i++] = "/NODEFAULTLIB:LIBC"; + args[i++] = "/NODEFAULTLIB:OLDNAMES"; + + // if -DLL is not passed, then change the entry to 'main' + while(argv[j]) + { + if (strncmp(argv[j], "-DLL", 4) == 0 || strncmp(argv[j], "/DLL", 4) == 0) + { + k = 1; + + } + if (strncmp(argv[j], "-entry", 6) == 0 || strncmp(argv[j], "/entry", 6) == 0 || strncmp(argv[j], "-ENTRY", 6) == 0 || strncmp(argv[j], "/ENTRY",6 ) == 0) + { + k = 1; + + } + if (strncmp(argv[j], "-subsystem:", 11) == 0 || strncmp(argv[j], "/subsystem:", 11) == 0 || strncmp(argv[j], "-SUBSYSTEM:", 11) == 0 || strncmp(argv[j], "/SUBSYSTEM:", 11) == 0) + { + s = 1; + + } + j++; + } + + if (k==0) + args[i++] = "/ENTRY:main"; + + if (s==0){ + args[i++] = "/subsystem:\"WINDOWSCE,5.02\""; + } + + argpath_conv(&argv[1], &args[i]); + + dumpargs(args); + + return run(args); +} diff --git a/build/wince/tools/vs9ppc2003arm/arm-wince-res.c b/build/wince/tools/vs9ppc2003arm/arm-wince-res.c new file mode 100644 index 000000000000..07ae5917d6c3 --- /dev/null +++ b/build/wince/tools/vs9ppc2003arm/arm-wince-res.c @@ -0,0 +1,19 @@ +#include "toolspath.h" + +int +main(int argc, char **argv) +{ + int iRetVal; + char* args[1000]; + int i = 0; + int j = 0; + int k = 0; + int s = 0; + args[i++] = RC_PATH; + + argpath_conv(&argv[1], &args[i]); + + dumpargs(args); + + return run(args); +} diff --git a/build/wince/tools/vs9ppc2003arm/toolspath.h b/build/wince/tools/vs9ppc2003arm/toolspath.h new file mode 100644 index 000000000000..0160d5a6068b --- /dev/null +++ b/build/wince/tools/vs9ppc2003arm/toolspath.h @@ -0,0 +1,277 @@ +#include +#include +#include + +#ifndef TOPSRCDIR +#include "../topsrcdir.h" +#endif + +#define WCE_BIN "c:\\Program Files\\Microsoft Visual Studio 9.0\\VC\\ce\\bin\\x86_arm\\" +#define WCE_RC_BIN "c:\\Program Files\\Microsoft SDKs\\Windows\\v6.0a\\bin\\" +#define WCE_CRT "c:\\Program Files\\Microsoft Visual Studio 9.0\\VC\\ce\\lib\\armv4i" +#define WCE_INC "c:\\Program Files\\Windows Mobile 6 SDK\\Smartphone\\Include\\Armv4i" +#define WCE_LIB "c:\\Program Files\\Windows Mobile 6 SDK\\Smartphone\\Lib\\Armv4i" + + +#define SHUNT_LIB TOPSRCDIR "/build/wince/shunt/build/vs9/" +#define SHUNT_INC TOPSRCDIR "/build/wince/shunt/include/" + +#define ASM_PATH WCE_BIN "armasm.exe" +#define CL_PATH WCE_BIN "cl.exe" +#define LIB_PATH WCE_BIN "lib.exe" +#define LINK_PATH WCE_BIN "link.exe" +#define RC_PATH WCE_RC_BIN "rc.exe" + +#define MAX_NOLEAK_BUFFERS 100 +char noleak_buffers[MAX_NOLEAK_BUFFERS][1024]; +static int next_buffer = 0; + +int argpath_conv(char **args_in, char **args_out) +{ + int i = 0; + + while (args_in[i]) + { + char *offset; + + args_out[i] = args_in[i]; + + if (args_in[i]) + { + // First, look for the case of "-Fo/c/xxxxxxx" and "/Fo/c/xxxxx" + if ( (args_out[i][0] == '-' || args_out[i][0] == '/') && + (args_out[i][1] == 'F') && (args_out[i][2] == 'o') && + (args_out[i][3] == '/') && (strlen(args_out[i]) > 5) ) { + + //printf("ARGS_IN: -FoXXXX is %s\n",args_in[i]); + + strcpy(noleak_buffers[next_buffer], args_in[i]); + + noleak_buffers[next_buffer][0] = '/'; + noleak_buffers[next_buffer][3] = noleak_buffers[next_buffer][4]; + noleak_buffers[next_buffer][4] = ':'; + + args_out[i] = noleak_buffers[next_buffer]; + + //printf("ARGS_OUT: -FoXXXX is %s\n",args_out[i]); + + next_buffer++; + } + else if ((args_out[i][0] == '/') && (args_out[i][2] == '/')) + { + // Assume this is a pathname, and adjust accordingly + //printf("ARGS_IN: PATHNAME ASSUMED: %s\n", args_in[i]); + + strcpy(noleak_buffers[next_buffer], args_in[i]); + + noleak_buffers[next_buffer][0] = noleak_buffers[next_buffer][1]; + noleak_buffers[next_buffer][1] = ':'; + + args_out[i] = noleak_buffers[next_buffer]; + //printf("ARGS_OUT: PATHNAME MODIFIED TO BE: %s\n", args_out[i]); + + next_buffer++; + } + else if ((args_out[i][0] == '\\') && (args_out[i][2] == '\\')) + { + // Assume this is a pathname, and adjust accordingly + //printf("ARGS_IN: PATHNAME ASSUMED: %s\n", args_in[i]); + + strcpy(noleak_buffers[next_buffer], args_in[i]); + + noleak_buffers[next_buffer][0] = noleak_buffers[next_buffer][1]; + noleak_buffers[next_buffer][1] = ':'; + + args_out[i] = noleak_buffers[next_buffer]; + //printf("ARGS_OUT: PATHNAME MODIFIED TO BE: %s\n", args_out[i]); + + next_buffer++; + } + else if ((args_out[i][0] == '\\') && (args_out[i][1] == '\\') && + (args_out[i][3] == '\\') && (args_out[i][4] == '\\')) + { + // Assume this is a pathname, and adjust accordingly + //printf("ARGS_IN: PATHNAME ASSUMED: %s\n", args_in[i]); + + noleak_buffers[next_buffer][0] = args_in[i][2]; + noleak_buffers[next_buffer][1] = ':'; + noleak_buffers[next_buffer][2] = '\0'; + + strcpy(noleak_buffers[next_buffer], &args_in[i][3]); + + args_out[i] = noleak_buffers[next_buffer]; + //printf("ARGS_OUT: PATHNAME MODIFIED TO BE: %s\n", args_out[i]); + + next_buffer++; + } + else if ( strstr(args_out[i], "OUT:") || strstr(args_out[i], "DEF:") ) + { + // Deal with -OUT:/c/.... + // + // NOTE: THERE IS A BUG IN THIS IMPLEMENTATION IF + // THERE IS A SPACE IN THE TOPSRCDIR PATH. + // + // Should really check for spaces, then double-quote + // the path if any space is found. + // -- wolfe@lobo.us 25-Aug-08 + if ((args_out[i][5] == '/') && (args_out[i][7] == '/')) + { + // Assume this is a pathname, and adjust accordingly + //printf("ARGS_IN: PATHNAME ASSUMED: %s\n", args_in[i]); + + strcpy(noleak_buffers[next_buffer], args_in[i]); + + noleak_buffers[next_buffer][5] = noleak_buffers[next_buffer][6]; + noleak_buffers[next_buffer][6] = ':'; + + args_out[i] = noleak_buffers[next_buffer]; + //printf("ARGS_OUT: PATHNAME MODIFIED TO BE: %s\n", args_out[i]); + } + // Deal with -OUT:"/c/...." + else if ((args_out[i][6] == '/') && (args_out[i][8] == '/')) + { + // Assume this is a pathname, and adjust accordingly + //printf("ARGS_IN: PATHNAME ASSUMED: %s\n", args_in[i]); + + strcpy(noleak_buffers[next_buffer], args_in[i]); + + noleak_buffers[next_buffer][6] = noleak_buffers[next_buffer][7]; + noleak_buffers[next_buffer][7] = ':'; + + args_out[i] = noleak_buffers[next_buffer]; + //printf("ARGS_OUT: PATHNAME MODIFIED TO BE: %s\n", args_out[i]); + } + + next_buffer++; + } + else + { + char *offset = strstr(args_out[i], "/cygdrive/"); + + if (offset) { + + strcpy(offset, offset+9); + offset[0] = offset[1]; + offset[1] = ':'; + offset[2] = '/'; + } + + if ( (args_out[i][0] == '-' || args_out[i][0] == '/') && + (args_out[i][1] == 'D')) + { + + offset = strstr(args_out[i]+2, "="); + if (offset) + { + char* equalsChar = offset; + + if (equalsChar[1] == '"') + { + *equalsChar = '\0'; + + strcpy(noleak_buffers[next_buffer], args_out[i]); + + *equalsChar = '='; + + strcat(noleak_buffers[next_buffer], "=\\\""); + strcat(noleak_buffers[next_buffer], equalsChar+1); + strcat(noleak_buffers[next_buffer], "\\\""); + + args_out[i] = noleak_buffers[next_buffer]; + + next_buffer++; + } + } + } + } + + if (next_buffer > MAX_NOLEAK_BUFFERS) { + printf("OOPS - next_buffer > MAX_NOLEAK_BUFFERS\n"); + exit(-1); + } + } + i++; + } + args_out[i] = NULL; + return i; +} + +void dumpargs(char** args) +{ + int i = 0; + + if (args[0] == NULL) + printf(":: first element is null!\n"); + + while(args[i]) + printf("%s ", args[i++]); + + printf("\n"); + fflush(stdout); + fflush(stderr); +} + + +DWORD run(char** args) +{ + + DWORD exitCode; + STARTUPINFO si; + PROCESS_INFORMATION pi; + + char theArgs[1024*16]; + + int totalLen = 0; + int i, j; + + + // Clear any link env variable that might get us tangled up + _putenv("LINK="); + _putenv("LIBPATH="); + _putenv("CC="); + + _putenv("INCLUDE=" WCE_INC); + _putenv("LIB=" WCE_LIB); + + for (j=1; args[j]; j++) + { + int len = strlen(args[j]); + strcat(&theArgs[totalLen], args[j]); + totalLen += len; + + strcat(&theArgs[totalLen], " "); + totalLen++; + } + + i = strlen(args[0]); + for (j=0; j