summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--indra/lib/python/indra/util/test_win32_manifest.py126
-rwxr-xr-xindra/newview/viewer_manifest.py39
2 files changed, 160 insertions, 5 deletions
diff --git a/indra/lib/python/indra/util/test_win32_manifest.py b/indra/lib/python/indra/util/test_win32_manifest.py
new file mode 100644
index 0000000000..7aa7a10928
--- /dev/null
+++ b/indra/lib/python/indra/util/test_win32_manifest.py
@@ -0,0 +1,126 @@
+# @file test_win32_manifest.py
+# @brief Test an assembly binding version and uniqueness in a windows dll or exe.
+#
+# $LicenseInfo:firstyear=2009&license=viewergpl$
+#
+# Copyright (c) 2009, Linden Research, Inc.
+#
+# Second Life Viewer Source Code
+# The source code in this file ("Source Code") is provided by Linden Lab
+# to you under the terms of the GNU General Public License, version 2.0
+# ("GPL"), unless you have obtained a separate licensing agreement
+# ("Other License"), formally executed by you and Linden Lab. Terms of
+# the GPL can be found in doc/GPL-license.txt in this distribution, or
+# online at http://secondlifegrid.net/programs/open_source/licensing/gplv2
+#
+# There are special exceptions to the terms and conditions of the GPL as
+# it is applied to this Source Code. View the full text of the exception
+# in the file doc/FLOSS-exception.txt in this software distribution, or
+# online at
+# http://secondlifegrid.net/programs/open_source/licensing/flossexception
+#
+# By copying, modifying or distributing this software, you acknowledge
+# that you have read and understood your obligations described above,
+# and agree to abide by those obligations.
+#
+# ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO
+# WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY,
+# COMPLETENESS OR PERFORMANCE.
+# $/LicenseInfo$
+
+import sys, os
+import tempfile
+from xml.dom.minidom import parse
+
+def get_HKLM_registry_value(key_str, value_str):
+ import _winreg
+ reg = _winreg.ConnectRegistry(None, _winreg.HKEY_LOCAL_MACHINE)
+ key = _winreg.OpenKey(reg, key_str)
+ value = _winreg.QueryValueEx(key, value_str)[0]
+ print 'Found: %s' % value
+ return value
+
+def find_vc_dir():
+ supported_versions = (r'8.0', r'9.0')
+ value_str = (r'ProductDir')
+
+ for version in supported_versions:
+ key_str = (r'SOFTWARE\Microsoft\VisualStudio\%s\Setup\VC' %
+ version)
+ try:
+ return get_HKLM_registry_value(key_str, value_str)
+ except WindowsError, err:
+ x64_key_str = (r'SOFTWARE\Wow6432Node\Microsoft\VisualStudio\%s\Setup\VS' %
+ version)
+ try:
+ return get_HKLM_registry_value(x64_key_str, value_str)
+ except:
+ print >> sys.stderr, "Didn't find MS VC version %s " % version
+
+ raise
+
+def find_mt_path():
+ vc_dir = find_vc_dir()
+ mt_path = '\"%sbin\\mt.exe\"' % vc_dir
+ return mt_path
+
+def test_assembly_binding(src_filename, assembly_name, assembly_ver):
+ (tmp_file_fd, tmp_file_name) = tempfile.mkstemp(suffix='.xml')
+ tmp_file = os.fdopen(tmp_file_fd)
+ tmp_file.close()
+
+ mt_path = find_mt_path()
+ resource_id = ""
+ if os.path.splitext(src_filename)[1].lower() == ".dll":
+ resource_id = ";#2"
+ system_call = '%s -nologo -inputresource:%s%s -out:%s' % (mt_path, src_filename, resource_id, tmp_file_name)
+ print "Executing: %s" % system_call
+ os.system(system_call)
+
+ manifest_dom = parse(tmp_file_name)
+ nodes = manifest_dom.getElementsByTagName('assemblyIdentity')
+
+ versions = list()
+ for node in nodes:
+ if node.getAttribute('name') == assembly_name:
+ versions.append(node.getAttribute('version'))
+
+ if len(versions) == 0:
+ print "No manifest found for %s" % src_filename
+
+ elif len(versions) > 1:
+ print "Multiple bindings to %s found:" % assembly_name
+ print versions
+ print
+ raise Exception("Multiple bindings")
+
+ elif versions[0] != assembly_ver:
+ print "Unexpected version found for %s:" % assembly_name
+ print "Wanted %s, found %s" % (assembly_ver, versions[0])
+ print
+ raise Exception("Unexpected version")
+
+ os.remove(tmp_file_name)
+
+
+if __name__ == '__main__':
+
+ print "Running test_win32_manifest.py..."
+ print
+
+ usage = 'test_win32_manfest <srcFileName> <assemblyName> <assemblyVersion>'
+
+ try:
+ src_filename = sys.argv[1]
+ assembly_name = sys.argv[2]
+ assembly_ver = sys.argv[3]
+ except:
+ print "Usage:"
+ print usage
+ print
+ raise
+
+ test_assembly_binding(src_filename, assembly_name, assembly_ver)
+
+
+
diff --git a/indra/newview/viewer_manifest.py b/indra/newview/viewer_manifest.py
index bb48e8e572..af7c474b03 100755
--- a/indra/newview/viewer_manifest.py
+++ b/indra/newview/viewer_manifest.py
@@ -164,11 +164,38 @@ class WindowsManifest(ViewerManifest):
return ''.join(self.channel().split()) + '.exe'
+ def test_msvcrt_and_copy_action(self, src, dst):
+ # This can is used to test a dll manifest.
+ # It is used as a temporary override during the construct method
+ from test_win32_manifest import test_assembly_binding
+ if src and (os.path.exists(src) or os.path.islink(src)):
+ # ensure that destination path exists
+ self.cmakedirs(os.path.dirname(dst))
+ self.created_paths.append(dst)
+ if not os.path.isdir(src):
+ if(self.args['configuration'].lower() == 'debug'):
+ test_assembly_binding(src, "Microsoft.VC80.DebugCRT", "8.0.50727.4053")
+ else:
+ test_assembly_binding(src, "Microsoft.VC80.CRT", "8.0.50727.4053")
+ self.ccopy(src,dst)
+ else:
+ raise Exception("Directories are not supported by test_CRT_and_copy_action()")
+ else:
+ print "Doesn't exist:", src
+
+ def enable_crt_check(self):
+ WindowsManifest.copy_action = WindowsManifest.test_msvcrt_and_copy_action
+
+ def disable_crt_check(self):
+ del WindowsManifest.copy_action
+
def construct(self):
super(WindowsManifest, self).construct()
# Find secondlife-bin.exe in the 'configuration' dir, then rename it to the result of final_exe.
self.path(src='%s/secondlife-bin.exe' % self.args['configuration'], dst=self.final_exe())
+ self.enable_crt_check()
+
# need to get the llcommon.dll from the build directory as well
if self.prefix(src=self.args['configuration'], dst=""):
try:
@@ -178,18 +205,17 @@ class WindowsManifest(ViewerManifest):
self.path('libapriconv-1.dll')
except:
print "Skipping llcommon.dll (assuming llcommon was linked statically)"
- pass
self.end_prefix()
# need to get the kdu dll from the build directory as well
try:
self.path('%s/llkdu.dll' % self.args['configuration'], dst='llkdu.dll')
- pass
except:
print "Skipping llkdu.dll"
- pass
- self.path(src="licenses-win32.txt", dst="licenses.txt")
+ self.disable_crt_check()
+
+ self.path(src="licenses-win32.txt", dst="licenses.txt")
self.path("featuretable.txt")
# For use in crash reporting (generates minidumps)
@@ -198,6 +224,8 @@ class WindowsManifest(ViewerManifest):
# For using FMOD for sound... DJS
self.path("fmod.dll")
+ self.enable_crt_check()
+
# For textures
if self.prefix(src=self.args['configuration'], dst=""):
if(self.args['configuration'].lower() == 'debug'):
@@ -221,7 +249,6 @@ class WindowsManifest(ViewerManifest):
self.path("media_plugin_webkit.dll")
self.end_prefix()
- # For WebKit/Qt plugin runtimes
if self.prefix(src="../../libraries/i686-win32/lib/release", dst="llplugin"):
self.path("libeay32.dll")
self.path("qtcore4.dll")
@@ -242,6 +269,8 @@ class WindowsManifest(ViewerManifest):
self.path("qtiff4.dll")
self.end_prefix()
+ self.disable_crt_check()
+
# These need to be installed as a SxS assembly, currently a 'private' assembly.
# See http://msdn.microsoft.com/en-us/library/ms235291(VS.80).aspx
if self.prefix(src=self.args['configuration'], dst=""):