From 93869a8ef23bd07351309ed86e10a0acd66ae973 Mon Sep 17 00:00:00 2001 From: "Mark Palange (Mani)" Date: Tue, 15 Sep 2009 12:32:22 -0700 Subject: Fixed up CopyWinLibs.cmake post moap/viewer-2.0.0-3 merge. Added CRT assembly check to viewer_manifest.py. twiddled test_win32_manifest.py for ease of use. --- indra/lib/python/indra/util/test_win32_manifest.py | 126 +++++++++++++++++++++ 1 file changed, 126 insertions(+) create mode 100644 indra/lib/python/indra/util/test_win32_manifest.py (limited to 'indra/lib/python') 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 ' + + 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) + + + -- cgit v1.3 From afb053ebd7c50482088ea2ddf585efe8446969cf Mon Sep 17 00:00:00 2001 From: brad kittenbrink Date: Fri, 18 Sep 2009 19:30:10 -0400 Subject: Minor tweaks of test_win32_manifest output. --- indra/lib/python/indra/util/test_win32_manifest.py | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) (limited to 'indra/lib/python') diff --git a/indra/lib/python/indra/util/test_win32_manifest.py b/indra/lib/python/indra/util/test_win32_manifest.py index 7aa7a10928..460e5fd487 100644 --- a/indra/lib/python/indra/util/test_win32_manifest.py +++ b/indra/lib/python/indra/util/test_win32_manifest.py @@ -1,3 +1,4 @@ +#!/usr/bin/env python # @file test_win32_manifest.py # @brief Test an assembly binding version and uniqueness in a windows dll or exe. # @@ -37,21 +38,21 @@ def get_HKLM_registry_value(key_str, value_str): 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 + #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: + 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) + return get_HKLM_registry_value(key_str, value_str) except WindowsError, err: x64_key_str = (r'SOFTWARE\Wow6432Node\Microsoft\VisualStudio\%s\Setup\VS' % - version) + version) try: return get_HKLM_registry_value(x64_key_str, value_str) except: @@ -65,6 +66,8 @@ def find_mt_path(): return mt_path def test_assembly_binding(src_filename, assembly_name, assembly_ver): + print "checking %s dependency %s..." % (src_filename, assembly_name) + (tmp_file_fd, tmp_file_name) = tempfile.mkstemp(suffix='.xml') tmp_file = os.fdopen(tmp_file_fd) tmp_file.close() @@ -101,12 +104,15 @@ def test_assembly_binding(src_filename, assembly_name, assembly_ver): raise Exception("Unexpected version") os.remove(tmp_file_name) + + print "SUCCESS: %s OK!" % src_filename + print if __name__ == '__main__': - print "Running test_win32_manifest.py..." print + print "Running test_win32_manifest.py..." usage = 'test_win32_manfest ' @@ -121,6 +127,5 @@ if __name__ == '__main__': raise test_assembly_binding(src_filename, assembly_name, assembly_ver) - -- cgit v1.3 From 17f9fd5f9653077b6059b34147a447310a30daec Mon Sep 17 00:00:00 2001 From: "Mark Palange (Mani)" Date: Fri, 25 Sep 2009 19:23:24 -0700 Subject: Changes force no crt manifest linking in windows plugin files. --- indra/lib/python/indra/util/test_win32_manifest.py | 9 ++-- indra/media_plugins/quicktime/CMakeLists.txt | 8 +++ indra/media_plugins/webkit/CMakeLists.txt | 8 +++ indra/newview/viewer_manifest.py | 58 ++++++++++++++++------ 4 files changed, 65 insertions(+), 18 deletions(-) (limited to 'indra/lib/python') diff --git a/indra/lib/python/indra/util/test_win32_manifest.py b/indra/lib/python/indra/util/test_win32_manifest.py index 460e5fd487..75473ff55f 100644 --- a/indra/lib/python/indra/util/test_win32_manifest.py +++ b/indra/lib/python/indra/util/test_win32_manifest.py @@ -78,7 +78,10 @@ def test_assembly_binding(src_filename, assembly_name, assembly_ver): 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) + mt_result = os.system(system_call) + if mt_result == 31: + print "No manifest found in %s" % src_filename + raise Exception("No manifest found") manifest_dom = parse(tmp_file_name) nodes = manifest_dom.getElementsByTagName('assemblyIdentity') @@ -89,7 +92,8 @@ def test_assembly_binding(src_filename, assembly_name, assembly_ver): versions.append(node.getAttribute('version')) if len(versions) == 0: - print "No manifest found for %s" % src_filename + print "No matching assemblies found in %s" % src_filename + raise Exception("No matching assembly") elif len(versions) > 1: print "Multiple bindings to %s found:" % assembly_name @@ -108,7 +112,6 @@ def test_assembly_binding(src_filename, assembly_name, assembly_ver): print "SUCCESS: %s OK!" % src_filename print - if __name__ == '__main__': print diff --git a/indra/media_plugins/quicktime/CMakeLists.txt b/indra/media_plugins/quicktime/CMakeLists.txt index db11c9ae21..f0b8f0d167 100644 --- a/indra/media_plugins/quicktime/CMakeLists.txt +++ b/indra/media_plugins/quicktime/CMakeLists.txt @@ -56,6 +56,14 @@ add_dependencies(media_plugin_quicktime ${LLCOMMON_LIBRARIES} ) +if (WINDOWS) + set_target_properties( + media_plugin_quicktime + PROPERTIES + LINK_FLAGS "/MANIFEST:NO" + ) +endif (WINDOWS) + if (QUICKTIME) add_definitions(-DLL_QUICKTIME_ENABLED=1) diff --git a/indra/media_plugins/webkit/CMakeLists.txt b/indra/media_plugins/webkit/CMakeLists.txt index d96477279d..5bccd589d8 100644 --- a/indra/media_plugins/webkit/CMakeLists.txt +++ b/indra/media_plugins/webkit/CMakeLists.txt @@ -52,6 +52,14 @@ add_dependencies(media_plugin_webkit ${LLCOMMON_LIBRARIES} ) +if (WINDOWS) + set_target_properties( + media_plugin_webkit + PROPERTIES + LINK_FLAGS "/MANIFEST:NO" + ) +endif (WINDOWS) + if (DARWIN) # Don't prepend 'lib' to the executable name, and don't embed a full path in the library's install name set_target_properties( diff --git a/indra/newview/viewer_manifest.py b/indra/newview/viewer_manifest.py index af3868394b..d21e520974 100755 --- a/indra/newview/viewer_manifest.py +++ b/indra/newview/viewer_manifest.py @@ -165,7 +165,7 @@ class WindowsManifest(ViewerManifest): def test_msvcrt_and_copy_action(self, src, dst): - # This can is used to test a dll manifest. + # This 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)): @@ -183,10 +183,38 @@ class WindowsManifest(ViewerManifest): else: print "Doesn't exist:", src - def enable_crt_check(self): + def test_for_no_msvcrt_manifest_and_copy_action(self, src, dst): + # This is used to test that no manifest for the msvcrt exists. + # 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): + try: + if(self.args['configuration'].lower() == 'debug'): + test_assembly_binding(src, "Microsoft.VC80.DebugCRT", "") + else: + test_assembly_binding(src, "Microsoft.VC80.CRT", "") + raise Exception("Unknown condition") + except Exception, err: + if err.message != "No matching assembly" or err.message != "No manifest found": + raise Exception("Found unexpected MSVCRT manifest binding") + + 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_manifest_check(self): WindowsManifest.copy_action = WindowsManifest.test_msvcrt_and_copy_action - def disable_crt_check(self): + def enable_no_crt_manifest_check(self): + WindowsManifest.copy_action = WindowsManifest.test_for_no_msvcrt_manifest_and_copy_action + + def disable_manifest_check(self): del WindowsManifest.copy_action def construct(self): @@ -194,7 +222,7 @@ class WindowsManifest(ViewerManifest): # 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() + self.enable_crt_manifest_check() # Plugin host application self.path(os.path.join(os.pardir, @@ -220,7 +248,15 @@ class WindowsManifest(ViewerManifest): except RuntimeError: print "Skipping llkdu.dll" - self.disable_crt_check() + self.disable_manifest_check() + + # For textures + if self.prefix(src=self.args['configuration'], dst=""): + if(self.args['configuration'].lower() == 'debug'): + self.path("openjpegd.dll") + else: + self.path("openjpeg.dll") + self.end_prefix() self.path(src="licenses-win32.txt", dst="licenses.txt") self.path("featuretable.txt") @@ -231,15 +267,7 @@ 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'): - self.path("openjpegd.dll") - else: - self.path("openjpeg.dll") - self.end_prefix() + self.enable_no_crt_manifest_check() # Media plugins - QuickTime if self.prefix(src='../media_plugins/quicktime/%s' % self.args['configuration'], dst="llplugin"): @@ -271,7 +299,7 @@ class WindowsManifest(ViewerManifest): self.path("qtiff4.dll") self.end_prefix() - self.disable_crt_check() + self.disable_manifest_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 -- cgit v1.3 From 292aecbb3e14658c470978efeb7cd790ec156fd2 Mon Sep 17 00:00:00 2001 From: brad kittenbrink Date: Wed, 30 Sep 2009 18:57:00 -0700 Subject: Updated test_win32_manifest.py to throw custom exception objects, rather than relying on string comparison. --- indra/lib/python/indra/util/test_win32_manifest.py | 23 ++++++++++++++++++---- indra/newview/viewer_manifest.py | 8 +++++--- 2 files changed, 24 insertions(+), 7 deletions(-) (limited to 'indra/lib/python') diff --git a/indra/lib/python/indra/util/test_win32_manifest.py b/indra/lib/python/indra/util/test_win32_manifest.py index 75473ff55f..0a2ebc48d4 100644 --- a/indra/lib/python/indra/util/test_win32_manifest.py +++ b/indra/lib/python/indra/util/test_win32_manifest.py @@ -33,6 +33,21 @@ import sys, os import tempfile from xml.dom.minidom import parse +class AssemblyTestException(Exception): + pass + +class NoManifestException(AssemblyTestException): + pass + +class MultipleBindingsException(AssemblyTestException): + pass + +class UnexpectedVersionException(AssemblyTestException): + pass + +class NoMatchingAssemblyException(AssemblyTestException): + pass + def get_HKLM_registry_value(key_str, value_str): import _winreg reg = _winreg.ConnectRegistry(None, _winreg.HKEY_LOCAL_MACHINE) @@ -81,7 +96,7 @@ def test_assembly_binding(src_filename, assembly_name, assembly_ver): mt_result = os.system(system_call) if mt_result == 31: print "No manifest found in %s" % src_filename - raise Exception("No manifest found") + raise NoManifestException() manifest_dom = parse(tmp_file_name) nodes = manifest_dom.getElementsByTagName('assemblyIdentity') @@ -93,19 +108,19 @@ def test_assembly_binding(src_filename, assembly_name, assembly_ver): if len(versions) == 0: print "No matching assemblies found in %s" % src_filename - raise Exception("No matching assembly") + raise NoMatchingAssemblyException() elif len(versions) > 1: print "Multiple bindings to %s found:" % assembly_name print versions print - raise Exception("Multiple bindings") + raise MultipleBindingsException(versions) 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") + raise UnexpectedVersionException(assembly_ver, versions[0]) os.remove(tmp_file_name) diff --git a/indra/newview/viewer_manifest.py b/indra/newview/viewer_manifest.py index 579bfaa4d9..bda81a505d 100755 --- a/indra/newview/viewer_manifest.py +++ b/indra/newview/viewer_manifest.py @@ -187,6 +187,7 @@ class WindowsManifest(ViewerManifest): # This is used to test that no manifest for the msvcrt exists. # It is used as a temporary override during the construct method from test_win32_manifest import test_assembly_binding + from test_win32_manifest import NoManifestException, NoMatchingAssemblyException if src and (os.path.exists(src) or os.path.islink(src)): # ensure that destination path exists self.cmakedirs(os.path.dirname(dst)) @@ -198,9 +199,10 @@ class WindowsManifest(ViewerManifest): else: test_assembly_binding(src, "Microsoft.VC80.CRT", "") raise Exception("Unknown condition") - except Exception, err: - if err.message != "No matching assembly" or err.message != "No manifest found": - raise Exception("Found unexpected MSVCRT manifest binding") + except NoManifestException, err: + pass + except NoMatchingAssemblyException, err: + pass self.ccopy(src,dst) else: -- cgit v1.3 From 0d0840de0e9039e3e5b2fd3261b8ed2b5efba567 Mon Sep 17 00:00:00 2001 From: "Mark Palange (Mani)" Date: Thu, 1 Oct 2009 14:51:35 -0700 Subject: Routing mt.exe output to NUL to hopefully fix expected error build failures... --- indra/lib/python/indra/util/test_win32_manifest.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'indra/lib/python') diff --git a/indra/lib/python/indra/util/test_win32_manifest.py b/indra/lib/python/indra/util/test_win32_manifest.py index 0a2ebc48d4..0149b9f43a 100644 --- a/indra/lib/python/indra/util/test_win32_manifest.py +++ b/indra/lib/python/indra/util/test_win32_manifest.py @@ -91,7 +91,7 @@ def test_assembly_binding(src_filename, assembly_name, assembly_ver): 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) + system_call = '%s -nologo -inputresource:%s%s -out:%s > NUL' % (mt_path, src_filename, resource_id, tmp_file_name) print "Executing: %s" % system_call mt_result = os.system(system_call) if mt_result == 31: -- cgit v1.3