diff options
author | unknown <iggy@recycle.(none)> | 2007-04-23 15:41:24 -0400 |
---|---|---|
committer | unknown <iggy@recycle.(none)> | 2007-04-23 15:41:24 -0400 |
commit | 1ce0d7c63b33bd7970b6ab53884e726858cee92d (patch) | |
tree | 20f198c8c6f8c6d19d7e0fae61409ab144e819dd /win | |
parent | b44eee2a6739afb44f59a06c2f7adb309f66b6a9 (diff) | |
download | mariadb-git-1ce0d7c63b33bd7970b6ab53884e726858cee92d.tar.gz |
Bug#24732 Executables do not include Vista manifests
- Added script to generate application specific manifest.
- Added new CMake MACRO to add customer build events which will first
generate a manifest and then embeds that manifest into an executable.
BitKeeper/etc/ignore:
Bug#24732 Executables do not include Vista manifests
- Revise ignore rules to disallow auto-generated cmake files but to allow
custom macros defined in a .cmake file.
CMakeLists.txt:
Bug#24732 Executables do not include Vista manifests
- Added logic for EMBED_MANIFESTS configuration option.
client/CMakeLists.txt:
Bug#24732 Executables do not include Vista manifests
- Embed manifest with custom CMake MACRO for client executables.
extra/CMakeLists.txt:
Bug#24732 Executables do not include Vista manifests
- Embed manifest with custom CMake MACRO for my_print_default executable.
libmysql/CMakeLists.txt:
Bug#24732 Executables do not include Vista manifests
- Embed manifest with custom CMake MACRO for myTest executable.
myisam/CMakeLists.txt:
Bug#24732 Executables do not include Vista manifests
- Embed manifest with custom CMake MACRO for myisam executables.
server-tools/instance-manager/CMakeLists.txt:
Bug#24732 Executables do not include Vista manifests
- Embed manifest with custom CMake MACRO for mysqlmanager executable.
sql/CMakeLists.txt:
Bug#24732 Executables do not include Vista manifests
- Embed manifest with custom CMake MACRO for mysqld executable.
win/README:
Bug#24732 Executables do not include Vista manifests
- Added new configuration option documentation.
win/configure.js:
Bug#24732 Executables do not include Vista manifests
- Added new EMBED_MANIFESTS configuration option.
win/create_manifest.js:
Bug#24732 Executables do not include Vista manifests
- Manifest generator. This script generates a basic manifest.
win/mysql_manifest.cmake:
Bug#24732 Executables do not include Vista manifests
- Define new CMake MACRO for adding Windows manifests to executables.
Diffstat (limited to 'win')
-rw-r--r-- | win/README | 2 | ||||
-rwxr-xr-x | win/configure.js | 1 | ||||
-rwxr-xr-x | win/create_manifest.js | 85 | ||||
-rwxr-xr-x | win/mysql_manifest.cmake | 20 |
4 files changed, 108 insertions, 0 deletions
diff --git a/win/README b/win/README index 871ae4efee7..118d619226a 100644 --- a/win/README +++ b/win/README @@ -50,6 +50,8 @@ The options right now are MYSQL_TCP_PORT=<port> Server port, default 3306 DISABLE_GRANT_OPTIONS Disables the use of --init-file and --skip-grant-tables options of mysqld.exe + EMBED_MANIFESTS Embed custom manifests into final exes, otherwise VS + default will be used. So the command line could look like: diff --git a/win/configure.js b/win/configure.js index 3488efacba3..a2502d96b80 100755 --- a/win/configure.js +++ b/win/configure.js @@ -47,6 +47,7 @@ try case "WITH_PARTITION_STORAGE_ENGINE": case "__NT__": case "DISABLE_GRANT_OPTIONS": + case "EMBED_MANIFESTS": configfile.WriteLine("SET (" + args.Item(i) + " TRUE)"); break; case "MYSQL_SERVER_SUFFIX": diff --git a/win/create_manifest.js b/win/create_manifest.js new file mode 100755 index 00000000000..5605f57ef74 --- /dev/null +++ b/win/create_manifest.js @@ -0,0 +1,85 @@ +/* + manifest.js - Writes a custom XML manifest for each executable/library + 6 command line options must be supplied: + name - Name of the executable/library into which the mainfest will be + embedded. + version - Version of the executable + arch - Architecture intended. + type - Application type. + exe_level - Application execution level. + [asInvoker|highestAvailable|requireAdministrator] + outfile - Final destination where mainfest will be written. + + Example: + cscript manifest.js name=mysql version=5.0.32 arch=X86 type=win32 + exe_level=asInvoker outfile=out.xml +*/ + +try +{ + var args = WScript.Arguments + for (i=0; i < args.Count(); i++) + { + var parts = args.Item(i).split('='); + switch (parts[0]) + { + case "name": + var app_name= parts[1]; + break; + case "version": + var app_version= parts[1]; + break; + case "arch": + var app_arch= parts[1]; + break; + case "type": + var app_type= parts[1]; + break; + case "exe_level": + var app_exe_level= parts[1]; + break; + case "outfile": + var manifest_file= parts[1]; + break; + default: + WScript.echo("Invalid argument supplied."); + } + } + if (i != 6) + throw new Error(1, "Incorrect number of arguments."); + + var manifest_xml= "<?xml version=\'1.0\' encoding=\'UTF-8\' standalone=\'yes\'?>\r\n"; + manifest_xml+= "<assembly xmlns=\'urn:schemas-microsoft-com:asm.v1\'"; + manifest_xml+= " manifestVersion=\'1.0\'>\r\n"; + // Application Information + manifest_xml+= "\t<assemblyIdentity name=\'" + app_name + "\'"; + manifest_xml+= " version=\'" + app_version + "\'"; + manifest_xml+= " processorArchitecture=\'" + app_arch + "\'"; + // TOADD - Add publicKeyToken attribute once we have Authenticode key. + manifest_xml+= " type=\'" + app_type + "\' />\r\n"; + // Identify the application security requirements. + manifest_xml+= "\t<trustInfo xmlns=\'urn:schemas-microsoft-com:asm.v2\'>\r\n"; + manifest_xml+= "\t\t<security>\r\n\t\t\t<requestedPrivileges>\r\n\t\t\t\t"; + manifest_xml+= "<requestedExecutionLevel level=\'" + app_exe_level + "\'"; + manifest_xml+= " uiAccess=\'false\'/>\r\n"; + manifest_xml+= "\t\t\t</requestedPrivileges>\r\n\t\t</security>\r\n"; + manifest_xml+= "\t</trustInfo>\r\n</assembly>\r\n"; + + // Write the valid XML to it's final destination. + var outfileXML = WScript.CreateObject("Msxml2.DOMDocument.3.0"); + outfileXML.async = false; + if (!outfileXML.loadXML(manifest_xml)) + { + WScript.Echo(manifest_xml); + throw new Error(2, "Invalid XML"); + } + outfileXML.save(manifest_file); + + WScript.Echo("Success, created custom manifest!"); + WScript.Quit(0); +} +catch (e) +{ + WScript.Echo("Error: " + e.description); + WScript.Quit(1); +} diff --git a/win/mysql_manifest.cmake b/win/mysql_manifest.cmake new file mode 100755 index 00000000000..b5bb6fda8fb --- /dev/null +++ b/win/mysql_manifest.cmake @@ -0,0 +1,20 @@ + +# - MYSQL_EMBED_MANIFEST(target_name required_privs) +# Create a manifest for target_name. Set the execution level to require_privs +# +# NOTE. PROCESSOR_ARCH must be defined before this MACRO is called. + +MACRO(MYSQL_EMBED_MANIFEST _target_name _required_privs) + ADD_CUSTOM_COMMAND( + TARGET ${_target_name} + PRE_LINK + COMMAND cscript.exe + ARGS "${PROJECT_SOURCE_DIR}/win/create_manifest.js" name=$(ProjectName) version=${VERSION} arch=${PROCESSOR_ARCH} type=$(PlatformName) exe_level=${_required_privs} outfile=$(IntDir)\\$(TargetFileName).intermediate.manifest + COMMENT "Generates the contents of the manifest contents.") + ADD_CUSTOM_COMMAND( + TARGET ${_target_name} + POST_BUILD + COMMAND mt.exe + ARGS -nologo -manifest $(IntDir)\\$(TargetFileName).intermediate.manifest -outputresource:$(TargetPath) + COMMENT "Embeds the manifest contents.") +ENDMACRO(MYSQL_EMBED_MANIFEST) |