Author: mturk
Date: Wed Jun 17 05:33:52 2009
New Revision: 785477

URL: http://svn.apache.org/viewvc?rev=785477&view=rev
Log:
Add common FindCpuType function.
The problem is that environment variable doesn't always set AMD64. This is true 
only for amd processors.
If present and not IA64 the %PROCESSOR_ARCHITEW6432% must be x86_64

Modified:
    tomcat/trunk/res/tomcat.nsi

Modified: tomcat/trunk/res/tomcat.nsi
URL: 
http://svn.apache.org/viewvc/tomcat/trunk/res/tomcat.nsi?rev=785477&r1=785476&r2=785477&view=diff
==============================================================================
--- tomcat/trunk/res/tomcat.nsi (original)
+++ tomcat/trunk/res/tomcat.nsi Wed Jun 17 05:33:52 2009
@@ -172,14 +172,13 @@
   File bin\tom...@version_major@w.exe
 
   ; Get the current platform x86 / AMD64 / IA64
-  ExpandEnvStrings $0 "%PROCESSOR_ARCHITEW6432%"
-  StrCmp $0 "%PROCESSOR_ARCHITEW6432%" 0 +2
-  ExpandEnvStrings $0 "%PROCESSOR_ARCHITECTURE%"
+  Call FindCpuType
+  Pop $0
   StrCmp $0 "x86" 0 +2
   File /oname=tom...@version_major@.exe bin\tom...@version_major@.exe
-  StrCmp $0 "AMD64" 0 +2
+  StrCmp $0 "x86_64" 0 +2
   File /oname=tom...@version_major@.exe bin\x86_64\tom...@version_major@.exe
-  StrCmp $0 "IA64" 0 +2
+  StrCmp $0 "ia64" 0 +2
   File /oname=tom...@version_major@.exe bin\ia64\tom...@version_major@.exe
 
   InstallRetry:
@@ -224,14 +223,14 @@
   SectionIn 3
 
   SetOutPath $INSTDIR\bin
-  ExpandEnvStrings $0 "%PROCESSOR_ARCHITEW6432%"
-  StrCmp $0 "%PROCESSOR_ARCHITEW6432%" 0 +2
-  ExpandEnvStrings $0 "%PROCESSOR_ARCHITECTURE%"
+  Call FindCpuType
+  Pop $0
+
   StrCmp $0 "x86" 0 +2
   File bin\tcnative-1.dll
-  StrCmp $0 "AMD64" 0 +2
+  StrCmp $0 "x86_64" 0 +2
   File /oname=tcnative-1.dll bin\x86_64\tcnative-1.dll
-  StrCmp $0 "IA64" 0 +2
+  StrCmp $0 "ia64" 0 +2
   File /oname=tcnative-1.dll bin\ia64\tcnative-1.dll
 
   ClearErrors
@@ -364,6 +363,31 @@
 ;  !insertmacro MUI_DESCRIPTION_TEXT ${SecWebapps} $(DESC_SecWebapps)
 !insertmacro MUI_FUNCTION_DESCRIPTION_END
 
+; =====================
+; FindCpuType Function
+; =====================
+;
+; Find the CPU used on the system, and put the result on the top of the
+; stack
+;
+Function FindCpuType
+
+  ClearErrors
+  ; Default CPU is always x86
+  StrCpy $1 "x86"
+  ExpandEnvStrings $0 "%PROCESSOR_ARCHITEW6432%"
+  StrCmp $0 "%PROCESSOR_ARCHITEW6432%" 0 +5
+  StrCmp $0 "IA64" 0 +3        
+  StrCpy $1 "ia64"
+  Goto FoundCpu
+  StrCpy $1 "x86_64"
+
+FoundCpu:
+  ; Put the result in the stack
+  Push $1
+
+FunctionEnd
+
 
 ; =====================
 ; CheckUserType Function



---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to